T-matrix for Electromagnetic Radiation with Multiple Scatterers — a set of Fortran modules/routines and Python scripts for T-matrix-based calculations and analysis of light scattering by clusters of individual scatterers. The source code can be either (i) compiled as a standalone Fortran program, driven by keywords via an input file; or (ii) built as a Python library (dubbed PyTERMS) using F2Py.
Electromagnetic field (i.e. light) is expanded in the basis of vector spherical waves (VSWs), with the Bessel/Hankel functions computed using TOMS644 library (source included in TERMS). Determining the collective scattering amounts to either solving or inverting a large linear system, which is done using LAPACK. All the relevant LAPACK routines are included in TERMS, but it is recommended to link with your system installed BLAS/LAPACK at compilation stage, because it can enable multi-threading during runtime.
src/ directory contains all the Fortran source code, which can be compiled from inside the ‘build’ directory by executing
bash buildTERMS.sh from a Linux terminal with bash. Edit ‘buildTERMS.sh’ to specify a compiler other than GFortran. Cross platform compilation tools, such as cmake, will most likely be utilised later.
Some LaTeX-ed notes are in the
doc/ directory, preliminary PyTERMS scripts are in
pyterms/, and a selection of useful (Python) post-processing tools are in
scripts/. Similarly, R scripts are packaged under
R/, and can be loaded with
library(terms) after installing this package locally.
Full-length studies (currently in progress) are in the
studies/ directory; for simpler examples of use the
vignettes/ directory contains more minimal illustrations of the different features of the program, as well as timing and convergence tests.
docs/ directory is auto-generated by a script, and serves the published website accessible at http://nano-optics.ac.nz/terms.
When running the stand-alone executable, main input parameters are read from a plain text input file (line by line and from left to right). Each line is interpreted as a sentence and split into space-separated words. The first (left-most) word is interpreted as a keyword, and the subsequent words as arguments for that keyword. In each sentence, text from the first word starting with the hash character (#) is interpreted as a human-readable comment and thus ignored by the program. All the supported keywords and corresponding arguments are documented on this page. The order of keywords generally doesn’t matter, with just two exceptions:
ModeAndScheme must be the first keyword, and
Scatterers must be the last.