Command-Line Interface
The heddlemd binary has three subcommands: run (executes the
simulation), lint (validates inputs without running), and analyze
(post-processes a trajectory written by run).
Usage
heddlemd run <config-path>
heddlemd lint <config-path> [--with-gpu]
heddlemd analyze <analysis-path>
Invoking heddlemd with no arguments, an unknown subcommand, or a
subcommand without its required path argument prints
usage: heddlemd run <config-path>
heddlemd lint <config-path> [--with-gpu]
heddlemd analyze <analysis-path>
to stderr and exits with code 1.
heddlemd run <config-path>
Loads the TOML config at <config-path> and runs the simulation it
describes to completion.
<config-path>is the path to a TOML config file. Relative paths are resolved against the current working directory.- All output paths in the config (
init,output.trajectory_path,output.log_path,output.timings_path, optionaltopology) are resolved relative to the config file’s directory, not the current working directory. Absolute paths are honored as-is.
What it does, in order
- Parses the CLI arguments.
- Loads and validates the TOML config.
- Checks that none of the enabled output files already exist. Failing this check up front means the runner never starts a long run that would be unable to write its results.
- Loads the init file and, when supplied, the topology file.
- Initialises CUDA and uploads the particle state to the GPU.
- Generates initial velocities (only when the init file omits them).
- For each phase in source-document order across
[[phase]]and[[minimization]]: opens the phase’s output files, runs either the timestep loop ([[phase]]) forphase.n_stepsiterations writing frames and log rows at the configured cadences, or the steepest-descent outer loop ([[minimization]]) writing per-iteration.minlogrows until a convergence criterion fires (see Configuration →[[minimization]]). Flushes the files, then writes the phase’s.timingsfile before moving on.
On success
Prints one line per phase plus a final aggregate on stdout. MD phases
report a step count; minimization phases report an iteration count
and the convergence reason (force_tolerance, energy_tolerance,
force_zero):
[heddlemd] phase `<name>`: <N> steps in <T> ms (frames: <F>, log rows: <R>)
[heddlemd] phase `<name>`: <N> iters in <T> ms (converged: <reason>, frames: <F>, log rows: <R>)
...
[heddlemd] complete: <total_phases> phases, <total_N> steps in <total_T> ms
and exits with code 0. For very short runs (< 10 ms) the elapsed
time is shown in microseconds instead (<T> µs).
On failure
Prints a single line to stderr beginning with error: , followed by a
human-readable description that names the offending file or field where
applicable, and exits with the appropriate non-zero code.
Exit codes
| Code | Meaning |
|---|---|
0 | Simulation completed; every requested step ran and every output flushed. |
1 | Any error before the integration loop started: malformed CLI args, config-load failure, init-state load failure, output-file overwrite check failure, GPU initialisation failure, box-vs-cutoff compatibility failure, cuFFT determinism smoke-test failure. |
2 | Any error during the integration loop or minimization loop: a kernel launch failed, a write to the trajectory / log / .minlog failed, a device-to-host download failed, or a [[minimization]] phase reached max_iterations without satisfying any physical convergence criterion. |
The split between exit code 1 and 2 makes it cheap for a wrapper
script to distinguish input mistakes (re-edit the config) from
mid-flight failures (likely transient: re-run, check GPU health, or
relax minimization tolerances).
heddlemd lint <config-path> [--with-gpu]
Validates the config and its referenced inputs against every error the
runner can detect without executing the integration loop, then exits
without writing any output files. Designed for HPC contexts where a
long submission queue makes trial-and-error iteration expensive: run
heddlemd lint on a login node before queueing a job, and fix any
reported issues up front instead of after the queue eventually grants
GPU time.
The subcommand dispatches on the file extension:
-
<path>.in.tomlruns the simulation lint pipeline (described in What it checks below). -
<path>.in.analysisruns the analyze lint pipeline (described under Analysis andrqm/analysis/framework.md). -
--with-gpu(optional) is accepted only for the simulation lint pipeline; it extends the lint to include device initialisation, the cuFFT determinism smoke test (when SPME is configured), the host-to-device upload, slot construction, and the force-field allocation. Passing--with-gputogether with a.in.analysispath is rejected (analysis is CPU-only in v1). -
Lint writes no files at any time. Pre-existing output files are detected with
Path::exists(); the filesystem is otherwise unchanged. -
Stops at the first failed check (short-circuit). Subsequent stages appear as
skipped (earlier check failed)in the per-stage report.
What it checks
Stages run in the order below. Each stage reports Ok, FAIL,
Skipped, or not checked (re-run with --with-gpu) in the per-stage
report.
config— TOML parse, the.in.tomlfilename convention, every per-field domain check, path-collision check, and per-kind registry dispatch.output paths— checks each enabled output path withPath::exists(). A pre-existing file is reported as a FAIL with the sameOutputExistspayloadrunwould surface.init— loads the extended-XYZ init file, reports the particle count and box dimensions.box/cutoff— for cell-list mode, verifiesmin_perpendicular_width ≥ 3 · (cutoff_max + r_skin). For all-pairs mode, reported asnot applicable.topology— loads the topology file (when supplied) and reports the bond, angle, dihedral, and constraint-group counts. When the config omitstopology, reported asnot supplied.gpu— only attempted with--with-gpu. Runsinit_device(including the cuFFT smoke test for SPME configs), allocates the particle buffers, constructs every slot, and constructs the force field. Without--with-gpu, reported asnot checked.
On success
Prints the per-stage report on stdout (header [heddlemd lint] OK)
and exits with code 0:
[heddlemd lint] OK
config /path/to/argon.in.toml
output paths none pre-exist
init resolved, 10000 particles, box 8.0e-9 × 8.0e-9 × 1.0e-8 m
box/cutoff min perp width 8.00e-9 m ≥ required 3.32e-9 m
topology not supplied
gpu not checked (re-run with --with-gpu)
On failure
Prints the per-stage report on stdout (header [heddlemd lint] FAIL),
followed by a single error: <message> line on stderr that matches
what run would print for the same condition, and exits with code
1:
[heddlemd lint] FAIL
config /path/to/argon.in.toml
output paths none pre-exist
init resolved, 10000 particles, box 2.0e-9 × 5.0e-9 × 5.0e-9 m
box/cutoff FAIL — min perp width 2.00e-9 m along `a` < required 3.30e-9 m
topology skipped (earlier check failed)
gpu not checked (re-run with --with-gpu)
error: simulation box perpendicular width along lattice direction `a` is 2e-9, below the required 3.3e-9
Exit codes
| Code | Meaning |
|---|---|
0 | Every check passed. |
1 | At least one check failed, or the CLI was invoked with bad arguments. |
heddlemd analyze <analysis-path>
Runs every analysis declared in <analysis-path> (a
<root>.in.analysis file) against the trajectory it points at, and
writes one CSV per analysis. See Analysis for
the input-file schema, the implicit pairing rule, the trajectory
selection knobs, and the built-in rdf kind.
<analysis-path>is the path to a<root>.in.analysisfile. The filename must end in.in.analysis. Relative paths are resolved against the current working directory.- Implicit pairing: when the analysis file does not set
simulationortrajectoryexplicitly, the runner pairs with the sibling<root>.in.toml(the same<root>as the analysis filename) and reads the trajectory from that config’s resolvedoutput.trajectory_path. - v1 is CPU-only; no
--with-gpuflag. - Output files default to
<root>.out.<name>.csv(where<name>comes from each[[analyses]]entry’snamefield). Each per-analysisoutput_pathfield overrides. - Pre-existing output files cause a hard error (
OutputExists) at pre-flight, before any frame is read.
On success
Prints one line on stdout:
[heddlemd] analyze complete: <K> analyses over <F> frames in <T> ms
where <K> is the number of analyses and <F> is the number of
frames consumed after first_frame, last_frame, and stride are
applied.
Exit codes
| Code | Meaning |
|---|---|
0 | Every analysis ran to completion and every CSV flushed. |
1 | Error before the trajectory pass: filename-convention violation, parse error, sibling-config load failure, trajectory open failure, output-path collision, pre-existing output. |
2 | Error during the trajectory pass or output write. |
What is not provided
Schema v1 deliberately keeps the CLI minimal. There are no environment variables or alternative config sources — every parameter affecting the trajectory lives in the TOML config so that two runs of the same file produce identical bits.
The following do not exist:
- A
--seedflag (setsimulation.seedand any thermostat/barostatseedfield in the config). - A
--stepsor--dtflag (setphase.n_stepsandphase.dtin the relevant[[phase]]). - A
--output-dirflag (set the paths under[phase.output]). - A
--helpflag. The only help is this book and the usage line above.