QPMS
Electromagnetic multiple scattering library and toolkit.
Loading...
Searching...
No Matches
QPMS

Build Status

QPMS README

QPMS (standing for QPMS Photonic Multiple Scattering) is a toolkit for frequency-domain simulations of photonic systems consisting of compact objects (particles) inside a homogeneous medium. Scattering properties of the individual particles are described by their T-matrices (which can be obtained using one of the built-in generators or e.g. with the scuff-tmatrix tool from the SCUFF-EM suite).

QPMS handles the multiple scattering of electromagnetic radiation between the particles. The system can consist either of a finite number of particles or an infinite number of periodically arranged lattices (with finite number of particles in a single unit cell).

Features

Finite systems

  • Computing multipole excitations and fields scattered from nanoparticle clusters illuminated by plane, spherical or cylindrical (TODO) waves.
  • Finding eigenmodes (optical resonances).
  • Calculating cross sections.
  • Reducing numerical complexity of the computations by exploiting symmetries of the cluster (decomposition to irreducible representations).

Infinite systems (lattices)

  • 1D-, 2D- and 3D-periodic systems with arbitrary unit cell geometry supported (Ewald-summated translation operators, mode problem matrices, and scattered-field evaluation).
  • Computing multipole excitations and fields scattered from nanoparticle clusters.
  • Finding eigenmodes and calculating dispersion relations.
  • Calculation of the scattered fields.
  • Calculation of total transmission and reflection properties (the transmission experiment of qpms-sim, with layered backgrounds supported; see CLIUTILS.md).
  • Reducing numerical complexity of the computations by exploiting symmetries of the lattice (decomposition to irreducible representations; automatic point-group detection for 2D- and 3D-periodic systems and rod-group detection for 1D chains, with per-irrep block decomposition of the mode problem at high-symmetry k — see CLIUTILS.md).

Getting the code

The codebase is available at the primary upstream public repository https://codeberg.org/QPMS/qpms.git (secondary: https://repo.or.cz/qpms.git) or any of the maintained mirrors. Just clone the repository with git and proceed to the installation instructions below.

Installation

The package depends on several python modules, a BLAS/LAPACK library with the respective C bindings (incl. the lapacke.h and cblas.h headers; OpenBLAS does have it all and is recommended), GSL (>= 2.0) and HDF5 (used by the C command line utilities for the T-matrix community format files). The python module dependencies should be installed automatically when running the installation script. If you have a recent enough OS, you can get GSL and HDF5 easily from the repositories; on Debian and derivatives, just run apt-get install libgsl-dev libhdf5-dev under root. Alternatively, you can get the GSL source and compile it yourself.

You also need a fresh enough version of cmake.

QPMS uses several vendored git submodules: a C version of the Amos library for calculating Bessel functions (camos), the YAML parser libfyaml, spglib, and the nonlinear eigensolver library libnles (extern/libnles; needed by the resonance and bandstructure solvers). Before proceeding with running cmake, the submodules need to be downloaded first (in the QPMS source root directory):

git submodule init
git submodule update

After GSL is installed and submodules updated, build the C library and the command line tools with cmake and install the Python bindings:

cmake -B build -DCMAKE_INSTALL_PREFIX=${YOUR_PREFIX}
cmake --build build
cmake --install build # optional; installs libqpms, the CLI apps and the headers
pip install -e . --no-build-isolation # the Python bindings (see PYAPI.md)

The Python bindings locate libqpms.so automatically (the CMake build directory, $QPMS_BUILD_DIR, or ~/.local/lib) and bake an rpath, so no LD_LIBRARY_PATH juggling is needed. NOTE: if you keep an installed copy at ~/.local/lib/libqpms.so, refresh it (cp build/qpms/libqpms.so ~/.local/lib/) after rebuilding the core — the LD_LIBRARY_PATH-installed copy shadows the build-tree one.

The Python API is documented in PYAPI.md; the legacy Python layer (pre-2026) has been replaced — old scripts require porting.

Above, replace ${YOUR_PREFIX} with the path to where you want to install the shared library; the Python bindings link the freshly built library from the CMake build directory themselves (see PYAPI.md), so no linker-path setup is needed for it, but the installed binaries may need the path ${YOUR_PREFIX}/lib included in your LD_LIBRARY_PATH environment variable at runtime. The same applies to the GSL and OpenBLAS dependencies: they must be installed where the installation scripts and linker can find them (setting the C_INCLUDE_PATH environment variable might be necessary as well).

Special care might need to be taken when installing QPMS in cluster environments.

Documentation

QPMS documentation is a work in progress. Most of the newer code is documented using doxygen comments. Documentation generated for the upstream version is hosted on the QPMS homepage https://qpms.necada.org.

To build the documentation yourself, just run doxygen in the QPMS source root directory; the documentation will then be found in docs/html/index.html.

Of course, the prerequisite of this is having doxygen installed. If you don't, you will probably find it easily in your OS's repositories. On Debian and derivatives, simply run apt-get install doxygen under root.

Tutorials

See also the examples directory in the source repository.

Command line utilities

Acknowledgments

This software has been developed in the Quantum Dynamics research group, Aalto University, Finland. If you use the code in your work, please cite M. Nečada and P. Törmä, Multiple-scattering T-matrix simulations for nanophotonics: symmetries and periodic lattices, arXiv: 2006.12968 (2020) in your publications, presentations, and similar.

Please also have a look at other publications by the group (google scholar Päivi Törmä), they may be useful for your work as well.

Bug reports

If you believe that some parts of QPMS behave incorrectly, please mail a bug report to marek@necada.org. To ensure that your message is not considered spam, please start the subject line with QPMS.

If you were able to fix a bug yourself, please include the patch as well, see below.

Contributions

Contributions to QPMS are welcome, be it bug fixes, improvements to the documentation, code quality, or new features.

You can send patches prepared using the git format-patch tool to marek@necada.org.

If you plan to contribute with major changes to the codebase, it is recommended to discuss that first (see the contact information below).

Contact & discussion

You can contact the main author e.g. via e-mail or Telegram.

You are also warmly welcome to the QPMS user chat in Telegram!