Skip to main content

ddscatcli

DOI PyPI

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.par configuration file (shape, solver, FFT method, dielectric files, wavelength, etc.).
  • Run DDSCAT automatically — serial, MPI, or OpenMP.
  • Create timestamped backups of the original ddscat.par file.
  • Uses environment variables for configuration (no code editing).

Configuration

ddscatcli resolves ddscat.par in this order:

  1. $DDSCAT_PAR (absolute path recommended; relative paths are interpreted relative to your current working directory)
  2. ddscat.par (current working directory)

ddscatcli resolves the DDSCAT executable in this order:

  1. $DDSCAT_EXE (absolute path recommended; relative paths are interpreted relative to your current working directory)
  2. ddscat (current working directory)
  3. ddscat found on your PATH

Example:

export DDSCAT_PAR=/abs/path/to/ddscat.par
export DDSCAT_EXE=/abs/path/to/ddscat

Postprocessing (ddpostprocess)

ddscatcli can optionally run ddpostprocess (from DDSCAT) after a simulation, or independently using -post flag.

Environment variables

  • DDPOST_EXE: path to the ddpostprocess executable (absolute recommended)
  • DDPOST_PAR: path to ddpostprocess.par (absolute recommended)

If not set, ddscatcli looks in the current working directory for:

  • ddpostprocess
  • ddpostprocess.par

Installation

Install from PyPI:

pip install ddscatcli

This 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

Requirements

  • Python >= 3.10
  • Standard library only

Usage

  1. Get help and options:

    ddscatcli -h
    
  2. List available shapes:

    ddscatcli -CSHAPE -h
    
  3. 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.
  4. Parallel options:

    • -omp-threads N → set the number of OpenMP threads.
    • -mpi [launcher] -np N → run DDSCAT with MPI (e.g. mpirun, mpiexec, srun).

Examples

Preview edits without modifying:

ddscatcli -CSHAPE ANIRCTNGL -dry-run

Change the shape and run immediately:

ddscatcli -CSHAPE ELLIPSOID -SHPAR "16 8 4" -run

Set OpenMP threads:

ddscatcli -omp-threads 16 -run

You can repeat -DIEL once per material:

ddscatcli -NCOMP 3 -DIEL diel1.txt -DIEL diel2.txt -DIEL diel3.txt

Or provide them in a single flag:

ddscatcli -NCOMP 3 --diels diel1.txt diel2.txt diel3.txt

Note: if -NCOMP is provided, the number of dielectric entries must match NCOMP exactly.


Use from Python

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"])

Backups

Every modification automatically creates a timestamped backup:

ddscat.par.bak.YYYYMMDD-HHMMSS

Notes

  • Each parameter is matched using its identifying keyword in the ddscat.par file.
  • Supports dielectric and shape overrides via -DIEL, -NCOMP, -SHPAR, etc.
  • DDSCAT must be compiled and installed separately — this tool just wraps it.

License

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.


Citation

If you use ddscatcli, please cite:

Clément Argentin, ddscatcli (2025).
DOI: 10.5281/zenodo.17493074

You can click the “Cite this repository” button on the right-hand side of the GitHub page for citation formats (BibTeX, APA, etc.).

Metadata

Release files for ddscatcli 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ddscatcli 1.0.4
File Size Uploaded
ddscatcli-1.0.4.tar.gz 24.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ddscatcli 1.0.4
File Interpreter ABI Platform
ddscatcli-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 48.3 kB

Release files / ddscatcli-1.0.4.tar.gz

Download URL ddscatcli-1.0.4.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b7db6445d9fbef363bae8de71a3d2470485ceffa56dfeeaf4f1a5f404ee65a48
BLAKE2b-256 checksum
How to use checksums
c366298ba7cace5711a5dd599ee96a92f4968cc832e9af95558cebc464ef522a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / ddscatcli-1.0.4-py3-none-any.whl

Download URL ddscatcli-1.0.4-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f692c600a537a931ca03535b450fa5709e3407b0f899e27d22fe98b5ad058c0
BLAKE2b-256 checksum
How to use checksums
8041219b1bf26d236063241b41b2494b2d48b2798084c7471c5315f902108c6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page