This script is a command-line utility to edit and run a ddscat.par file for DDSCAT in a reproducible and automated way.
It allows you to:
- Modify parameters inside a single
ddscat.parconfiguration file (shape, solver, FFT method, dielectric files, wavelength, etc.). - Run DDSCAT automatically — serial, MPI, or OpenMP.
- Create timestamped backups of the original
ddscat.parfile. - Uses environment variables for configuration (no code editing).
ddscatcli resolves ddscat.par in this order:
$DDSCAT_PAR(absolute path recommended; relative paths are interpreted relative to your current working directory)ddscat.par(current working directory)
ddscatcli resolves the DDSCAT executable in this order:
$DDSCAT_EXE(absolute path recommended; relative paths are interpreted relative to your current working directory)ddscat(current working directory)ddscatfound on yourPATH
Example:
export DDSCAT_PAR=/abs/path/to/ddscat.par
export DDSCAT_EXE=/abs/path/to/ddscatddscatcli can optionally run ddpostprocess (from DDSCAT) after a simulation, or independently using -post flag.
DDPOST_EXE: path to theddpostprocessexecutable (absolute recommended)DDPOST_PAR: path toddpostprocess.par(absolute recommended)
If not set, ddscatcli looks in the current working directory for:
ddpostprocessddpostprocess.par
Install from PyPI:
pip install ddscatcliThis installs the ddscatcli command globally. If you prefer to keep it isolated in a virtual environment:
python -m venv .venv
source .venv/bin/activate # on Linux/macOS
# .venv\Scripts\activate # on Windows
pip install ddscatcli- Python >= 3.10
- Standard library only
-
Get help and options:
ddscatcli -h
-
List available shapes:
ddscatcli -CSHAPE -h
-
Run modes:
-dry-run→ preview the edits only (no file modification).- (no flag) → apply edits to
ddscat.par. -run→ apply edits and automatically run DDSCAT.
-
Parallel options:
-omp-threads N→ set the number of OpenMP threads.-mpi [launcher] -np N→ run DDSCAT with MPI (e.g.mpirun,mpiexec,srun).
Preview edits without modifying:
ddscatcli -CSHAPE ANIRCTNGL -dry-runChange the shape and run immediately:
ddscatcli -CSHAPE ELLIPSOID -SHPAR "16 8 4" -runSet OpenMP threads:
ddscatcli -omp-threads 16 -runYou can repeat -DIEL once per material:
ddscatcli -NCOMP 3 -DIEL diel1.txt -DIEL diel2.txt -DIEL diel3.txtOr provide them in a single flag:
ddscatcli -NCOMP 3 --diels diel1.txt diel2.txt diel3.txtNote: if -NCOMP is provided, the number of dielectric entries must match NCOMP exactly.
ddscatcli exposes a run function.
import os
import ddscatcli
os.environ["DDSCAT_PAR"] = "/abs/path/to/ddscat.par"
os.environ["DDSCAT_EXE"] = "/abs/path/to/ddscat"
ddscatcli.run(["-dry-run", "-CSHAPE", "ELLIPSOID"])Every modification automatically creates a timestamped backup:
ddscat.par.bak.YYYYMMDD-HHMMSS
- Each parameter is matched using its identifying keyword in the
ddscat.parfile. - Supports dielectric and shape overrides via
-DIEL,-NCOMP,-SHPAR, etc. - DDSCAT must be compiled and installed separately — this tool just wraps it.
This project is licensed under the GNU General Public License v3.0 (GPLv3). You are free to use, modify, and share it under the same license.
This software was developed to produce the results presented in the following paper. If you use ddscatcli, please cite both the software and the paper:
Argentin C. (2025). ddscatcli. Zenodo.
10.5281/zenodo.17493074
Argentin, C., Chaumet, P. C., Gross, M., & Yurkin, M. A. (2026). Floating-point--consistent cross-verification methodology for reproducible and interoperable DDA solvers with fair benchmarking. arXiv:2603.02871
You can click the “Cite this repository” button on the right-hand side of the GitHub page for citation formats (BibTeX, APA, etc.).