Skip to content

mavrikak/Helios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

alt text

HELIOS - HomogEneous and Layered medIa Optical Scattering

HELIOS is a C++ / Python toolkit for simulating electromagnetic scattering from objects embedded either in homogeneous media (isolated objects and periodic structures) or layered media, using the surface integral equation (SIE) method. It provides a modern, scriptable workflow around two compiled applications (SIENano and SIENanoPP) and a set of Python utilities for job generation, mesh conversion, post-processing, and visualization.


πŸ—‚οΈ Table of contents


πŸ“ Citations


✨ Highlights

  • Three modes:
    • isolated scatterer in homogeneous background,
    • periodic structure in homogeneous background, and
    • isolated scatterer in layered background.
  • Scriptable orchestration with run_sie.py: prepare jobs, run solvers, and post-process results from the command line.
  • Robust job generation from a compact config.txt using pytools/jobwriter.py, including layered stacks and tabulated materials.
  • COMSOL mesh imports: convert .mphtxt to the compact .mesh format with pytools/meshconvert.py, including optional periodic cropping.
  • Near-field & cross-section visualization with pytools/visualization.py in 2D, 3D, and 1D line-cut modes.
  • Designed to work with C++11 builds of apps/SIENano and apps/SIENanoPP.

🧭 Repository layout

Helios/
β”œβ”€β”€ docs/                  # C++ code documentation folder
β”œβ”€β”€ include/               # header files and blitz++ files
β”œβ”€β”€ materials/             # Ξ΅(Ξ») tables for named materials
β”œβ”€β”€ pytools/               # python orchestration & utilities
β”‚   β”œβ”€β”€ drude_model.py         # Drude model for tabulated materials
β”‚   β”œβ”€β”€ jobwriter.py           # turns sim_data/<sim>/config.txt into jobs/job.N.xml
β”‚   β”œβ”€β”€ meshconvert.py         # COMSOL .mphtxt β†’ .mesh
β”‚   β”œβ”€β”€ plot_mesh.py           # plot simulation mesh
β”‚   └── visualization.py       # plot cross sections and near-fields
β”œβ”€β”€ sim_data/              # your data inputs (per simulation)
β”‚   └── <SimName>/           # simulation data folder(s)
β”‚       β”œβ”€β”€ config.txt         # compact configuration for jobwriter.py
β”‚       └── mesh.mphtxt        # COMSOL text mesh (.mphtxt)
β”œβ”€β”€ sim_res/               # data outputs (auto-created per simulation)
β”‚   └── <SimName>/           # simulation results folder(s)
β”‚       β”œβ”€β”€ jobs/              # folder where job.N.xml files are found
β”‚       β”œβ”€β”€ logs/              # one logfiles per run (different for solver/post-processor)
β”‚       β”œβ”€β”€ out/               # solver & post-processor data outputs
β”‚       β”‚  β”œβ”€ csc/             # cross sections' data
β”‚       β”‚  β”œβ”€ fields/          # .ein/.esc/.hin/.hsc fields' data organized by points set
β”‚       β”‚  └─ media/           # location for PNG plots
β”‚       β”œβ”€β”€ points/            # generated sampling points sets (.pos)
β”‚       β”œβ”€β”€ lambdalist.txt     # Ξ»[nm] mapping for plots
β”‚       └── mesh.mesh          # converted surface mesh
β”œβ”€β”€ src/                   # C++ source code
β”œβ”€β”€ third_party/           # third-party fortran files
β”‚   β”œβ”€β”€ amos/                   # amos library files
β”‚   β”œβ”€β”€ legacy_f                # congugate gradient solver
β”‚   β”œβ”€β”€ quadpack                # quadpack routines
β”‚   β”œβ”€β”€ regridpack              # regridpack routines
β”‚   └── erfc.bin                # erfc lookup table for periodic jobs
β”œβ”€β”€ dist_run_helios.py     # parallel job launcher for distributed runs
β”œβ”€β”€ environment.yml        # conda env (see below)
β”œβ”€β”€ helios_gui.py          # Python GUI
β”œβ”€β”€ makefile               # compilation instructions
β”œβ”€β”€ README.md              # this file
└── run_sie.py             # orchestration: prepare β†’ solve β†’ generate points β†’ post-process

βš™οΈ Dependencies

System Overview

The project consists of:

  • C++11 core code (compiled via makefile),
  • Fortran numerical kernels (AMOS, QUADPACK, REGRIDPACK),
  • Python tools (for job management, post-processing, and visualization),
  • Optional bash launchers (for distributed runs).

All builds have been tested on Linux using conda compilers and OpenBLAS.

🧰 Core Build Dependencies

Category Package Purpose
Compiler (C++) gxx_linux-64 C++11 compiler used for all main code.
Compiler (Fortran) gfortran_linux-64 Fortran compiler for numerical submodules.
Math Library openblas Provides BLAS and LAPACK routines.
C++ Array Library blitz++ High-performance multi-dimensional arrays used in the solver.
Threads pthread (system) Required by OpenBLAS.

Fortran sources included in the project:

  • third_party/amos/*.f β€” Bessel and Hankel functions,
  • third_party/quadpack/*.f β€” Gauss-Kronrod integration,
  • third_party/regridpack/*.f90 β€” interpolation routines,
  • third_party/legacy_f/cg.f β€” conjugate-gradient solver.

These are compiled automatically and do not require separate installation.

🐍 Python Dependencies

Used by the helper tools under pytools/ and for running the main run_sie.py script and helios_gui.py.

Package Purpose
python β‰₯ 3.10 Base interpreter.
numpy Numerical processing and mesh handling.
scipy Numerical routines.
matplotlib Plotting and visualization.
PySide6 Qt bindings.
tqdm Progress bars.
miepython Mie theory.

πŸ“– Documentation Dependencies

The documentation is already provided, but the following packages are required to regenerate it with Doxygen.

Package Purpose
doxygen Generates HTML and PDF documentation from C++ comments.
graphviz Renders dependency and call graphs (used by Doxygen).

🧱 Recommended Conda Environment

The project uses Miniconda to manage dependencies. The file environment.yml is provided to produce the proper conda environment. After installing Miniconda for linux, you can create and activate the environment with the following commands:

cd Helios/
conda env create -f environment.yml
conda activate Helios

πŸš€ Quick start

Linux users can clone the repository and install HELIOS with the following steps. For Windows users, the Windows Subsystem for Linux (WSL) is recommended.

  1. Install git and clone the repository:
sudo apt install git git-lfs && git lfs install
git clone https://github.com/mavrikak/Helios.git
  1. Create a conda environment with Miniconda and activate it:
cd Helios
conda env create -f environment.yml
conda activate Helios
  1. Build the project:
mkdir apps
mkdir build
make clean && make -j
  1. Place inputs for a simulation under sim_data/<SimName>/:

    • config.txt β€” simulation configuration (check examples in sim_data/ and next section for details)
    • mesh.mphtxt β€” COMSOL mesh text file
  2. [Optional] Rebuild the documentation:

cd docs
bash build.sh
  1. [Optional] Generate erfc(z) lookup table:
make table
python run_sie.py make-table erfc.bin --maxRe 10.0 --maxIm 10.0 --incRe 0.1 --incIm 0.1

🧩 Input data and configuration

Each simulation lives under sim_data/<SimName>/ and provides a config.txt. From this compact text, pytools/jobwriter.py produces the solver job XMLs. The configuration supports:

  • Wavelength sweep: Specify one value or a start stop step value range.

  • Domain description: tokens for each domain; plain materials can be either literals (real/complex numbers) or names of tabulated materials found in materials/.

  • Incident domain: the index of the domain where the illuminating field lives.

  • Polarization: s, p, TE, TM, LCP, RCP.

  • Incidence angles: $\theta$ and $\phi$ in degrees; specify one value or a start stop step value range.

Layered media blocks

Add two extra lines to list, per layered stack:

  • Materials per stack (comma-separated stacks, space-separated within a stack): 1 SiO2 1, Ag Au

  • Interface z-positions per stack (same structure): 0 150, 20

  • jobwriter.py expands each LayeredM# token in your domain line into a <domainLayers> section with <layer> entries (properties at the current wavelength) and <interface> tags.

Materials

Material tokens in config.txt can be:

  • Literals: $\varepsilon_r = \alpha + i \beta$ (2.25, 2.25+0.1i, 2.25+0.1j, (2.25, 0.1), [2.25,0.1], {2.25,0.1}).

  • Tabulated files in materials/<name>.txt with the format: $ \quad \lambda , [nm] \quad \Re(\varepsilon_r) \quad \Im(\varepsilon_r) \quad$.

Linear interpolation fills intermediate wavelengths; endpoints are linearly extrapolated.

Periodic structure blocks

Add one extra line to list:

  • (px, py): Unit cell dimensions in the x and y directions, respectively.
  • (cx, cy): Unit cell centers in the x and y directions, respectively.
  • z: Cut-off z position for the lower semi-infinite part of the unit cell.

πŸ–± Graphical user interface

The helios_gui.py script can be used to open the GUI and interactively prepare simulations, run them (both locally and distributed), and post-process the results. Additionally, it can be used to visualize the mesh and results of a simulation. All the user has to do is run python3 helios_gui.py in a terminal.


πŸ“œ Logging, progress, and exit codes

  • Every external run is tee-logged under sim_res/<sim>/logs/ with concise TTY progress when interactive.

  • Non-zero exit codes indicate user-facing errors (bad paths/flags/inputs).

  • On non-interactive terminals, spinners are suppressed to keep logs clean.


Releases

No releases published

Packages

 
 
 

Contributors

Languages