Usage
PlasMol is designed to be run from the command line, with most parameters specified in a single input file. This page explains how to create and structure an input file, as well as details on each supported block and parameter. For step-by-step examples, see the Tutorials page.
General Process for Creating an Input File
-
Determine Simulation Type: PlasMol supports three modes based on your input file:
- Classical Only: Simulate a nanoparticle (NP) using FDTD (via MEEP). Include a
classicalblock but noquantumblock. - Quantum Only: Simulate a molecule using RT-TDDFT (via PySCF). Include a
quantumblock but noclassicalblock. - PlasMol (Full): Simulate NP-molecule interactions. Include both
classicalandquantumblocks.
- Classical Only: Simulate a nanoparticle (NP) using FDTD (via MEEP). Include a
-
Structure the Input File: The file uses a block-based format with
startandendkeywords. Comments start with#,--, or%. Sections can be nested.- Always start with a
generalorsettingsblock (these two keywords are interchangeable) for shared parameters (e.g., time step, end time). - Add
classicaland/orquantumblocks as needed. - Use templates from the
templates/directory as starting points:
- Always start with a
-
Run PlasMol: From the command line:
python src/main.py -f /path/to/plasmol.in -vv -l plasmol.log -ror
python -m src.main -f /path/to/plasmol.in -vv -l plasmol.log -r- Common options:
-v(verbose),-vv(debug),-l log.txt(log file),-r(restart, deletes old output files). - See
src/input/cli.pyor runpython src/main.py --helpfor full options.
- Common options:
-
Output Files: PlasMol can generate CSVs (e.g.,
eField.csv,pField.csv), images (e.g., via HDF5 or plots), and checkpoint files (.npz). For details, see thefilesblock below. -
Units and Conventions: Times are in atomic units (au) unless specified. Coordinates are in Bohr or Angstrom (specify in
units). Electric fields are in au. -
Customization: For advanced tweaks (e.g., custom sources or propagators), modify the code as noted in API Reference.
Input Blocks and Parameters
Below are details on each block, drawn from the code and templates. Parameters are listed with defaults (if any), types, and descriptions. Required parameters are marked with *.
General/Settings Block
Shared simulation parameters. Use start general or start settings (interchangeable). This block is required.
dt*: Float. Time step in au (e.g.,0.001).t_end*: Float. End time in au (e.g.,40).eField_path: String. Path to output CSV for electric field (e.g.,eField.csv).
Example:
start general
dt 0.001
t_end 40
eField_path eField.csv
end general
Classical Block
For NP simulations (FDTD via MEEP). Required for classical or full PlasMol modes.
Source Sub-Block
Defines the incident electric field. Required for most simulations. For more information about these sources, visit MEEP's documentation.
sourceType*: String. One of:continuous,gaussian,chirped,pulse.sourceCenter*: Float or list (microns) (e.g.,-0.04or-0.04 0 0). Center position. If one component given, assumed in the 'x' direction.sourceSize*: List of 3 floats (microns) (e.g.,0 0.1 0.1). Size dimensions.frequency: Float. Frequency (au); mutually exclusive withwavelength.wavelength: Float. Wavelength (microns); mutually exclusive withfrequency.width: Float (default 0). Gaussian width.fwidth: Float (default inf). Frequency width (alternative towidth).start_time: Float (default 0 or -inf). Start time.end_time: Float (default inf). End time.cutoff: Float (default 5.0, for Gaussian). Truncation cutoff.slowness: Float (default 3.0, for Continuous). Ramp-up slowness.peakTime: Float (for Chirped/Pulse). Peak time.chirpRate: Float (for Chirped). Chirp rate.is_integrated: Boolean (default True). Integrate source over time.component: String (default 'z'). Field component ('x', 'y', 'z').
Example (Continuous):
start source
sourceType continuous
sourceCenter -0.04
sourceSize 0 0.1 0.1
frequency 5
isIntegrated True
end source
Simulation Sub-Block
Core FDTD parameters. For more information about these parameters, visit MEEP's documentation.
cellLength*: Float (e.g.,0.1). Simulation cell size.pmlThickness*: Float (e.g.,0.01). PML boundary thickness.eFieldCutOff: Float (e.g.,1e-12). Threshold to trigger quantum propagation. Ignored if no quantum blocked defined.symmetries: List (e.g.,Y 1 Z -1). Mirror symmetries (X/Y/Z with phase ±1).surroundingMaterialIndex: Float (default 1.0). Refractive index of medium.resolution: Float (optional). Spatial resolution; auto-calculated fromdtif omitted.
Example:
start simulation
cellLength 0.1
pmlThickness 0.01
eFieldCutOff 1e-12
symmetries Y 1 Z -1
surroundingMaterialIndex 1.33
end simulation
Object Sub-Block
Defines the NP (currently supports spheres only).
material*: String. EitherAuorAg. Material type.radius*: Float (microns) (e.g.,0.03). Sphere radius.center*: List of 3 floats (e.g.,0 0 0). Center position.
Example:
start object
material Au
radius 0.03
center 0 0 0
end object
HDF5 Sub-Block
For generating 2D cross-section images of the simulation.
timestepsBetween*: Integer (e.g.,1). Interval for image output.intensityMin*: Float (e.g.,3). Min intensity for color scale.intensityMax*: Float (e.g.,10). Max intensity for color scale.imageDirName: String (optional, auto-generated if omitted). Output directory.
Example:
start hdf5
timestepsBetween 1
intensityMin 3
intensityMax 10
imageDirName images
end hdf5
Molecule Sub-Block
Places a molecule in the simulation (required for full PlasMol).
center*: List of 3 floats (microns) (e.g.,0 0 0). Molecule position.
Example:
start molecule
center 0 0 0
end molecule
Quantum Block
For molecule simulations (RT-TDDFT). Required for quantum or full PlasMol modes.
RTTDDFT Sub-Block
Core quantum parameters.
- Geometry sub-sub-block*:
- Atom coordinates. Inline after
start geometry.
- Atom coordinates. Inline after
units*: String (bohrorangstrom).check_tolerance: Float (default 1e-12). Tolerance for matrix checks for hermiticity.charge*: Integer (default 0).spin*: Integer (default 0).basis*: String (e.g.,6-31g).xc*: String (e.g.,pbe0). Exchange-correlation functional.propagator*: String, one ofstep,rk4, ormagnus2.pc_convergence: Float (only for magnus2, e.g.,1e-12).maxiter: Integer (only for magnus2, e.g.,200).transform: (No value needed). Enables absorption spectrum calculation. See the API Reference and Tutorial #3 for more details.
Example:
start rttddft
start geometry
O 0.0 0.0 -0.13
H 1.49 0.0 1.03
H -1.49 0.0 1.03
end geometry
units bohr
basis 6-31g
xc pbe0
propagator magnus2
transform
end rttddft
Files Sub-Block
Output paths.
chkfilesub-sub-block:frequencyint (e.g.,100). Number of time steps between checkpoints.pathstring (e.g.,chkfile.npz). Path to checkpoint file.
pField_path: String (e.g.,pField.csv). Polarization field CSV.eField_vs_pField_path: String (e.g.,output.png). Plot of fields.pField_Transform_path: String (e.g.,pField-transformed.npz). Transformed data (for spectrum).eV_spectrum_path: String (e.g.,spectrum.png). Absorption spectrum plot.
Example:
start files
start chkfile
frequency 100
path chkfile.npz
end chkfile
pField_path pField.csv
end files
Source Sub-Block (Quantum-Only)
Electric field for standalone quantum simulations.
shape*: String (pulseorkick).wavelength_nm: Float (for pulse).peak_time_au: Float.width_steps: Integer.intensity_au: Float.dir: String (x,y,z).
Example:
start source
shape pulse
wavelength_nm 500
peak_time_au 0.1
width_steps 5
intensity_au 5e-5
dir z
end source
For more details on code internals, see API Reference.