CLI reference¶
jaxrens is installed as a console script (jaxrens) and as
python -m jaxrens.cli.cli. Five subcommands are available:
run, validate, dump-schema, plot, and analyze.
Before the per-command details: every CLI invocation flows through
the schema → resolve → run pipeline — pydantic validates the
YAML, the resolver builds runtime objects (backend instance, walker
positions, replica topology from jax.local_devices()), then the
library core runs NS. That pipeline is documented in
Schema → resolve → run with diagrams and a
concrete trace; this page focuses on the subcommand surface itself.
jaxrens validate¶
Check a YAML config and print a one-screen summary, without running NS. Validation comes in three tiers, because the checks differ enormously in cost — the expensive ones build an energy model and compile a kernel that validation never calls.
jaxrens validate -c config.yaml --parse-only # schema only
jaxrens validate -c config.yaml # + resolver plan (default)
jaxrens validate -c config.yaml --full # + startup rehearsal
Tier |
Checks |
Cost |
|---|---|---|
|
pydantic only: field names, types, ranges, cross-field validators |
milliseconds |
(default) |
the above, plus the resolver plan — replica topology and divisibility, interval-unit scaling, |
well under a second |
|
the above, plus startup rehearsal — builds the backend, places the walker population, evaluates its initial energies |
seconds (toy backends) to minutes (MLIPs) |
The default tier deliberately stops short of loading anything. It ends
with a skipped line naming what it did not check, so a pass is never
mistaken for a full rehearsal:
✓ OK — configuration plan valid
topology SingleRun (1 replica, 1 GPU)
run n_live=128, max_iterations=2000
moves 4 move(s) [gmc, volume, shear, stretch]
backend lj, n_atoms=64
output format=extxyz, prefix=lj8_npt
skipped backend build, walker placement, initial energies — rerun with --full to check those
n_atoms is derived from init.start_species (or a single read of
init.start_config_file), not from placed walkers. A config initialised
from a walker set or a restart file carries its atom count inside the
data, so the plan tier omits the field rather than guessing.
Use --full before submitting a long job: it is the tier that proves the
checkpoint actually loads and that a valid initial configuration exists.
jaxrens validate -c config.yaml --set run.n_live=64
Exit code is zero on success. For a multi-run config it prints the derived topology:
OK — multi-run dispatch
topology: n_gpu=4 × n_per_gpu=2 = 8 replica(s)
run: n_live=64, max_iterations=1000
moves: 4 move(s) [gmc, volume, shear, stretch]
backend: mace, n_atoms=40
output: format=extxyz, prefix=mace_srtio3
jaxrens run¶
Run NS with the given config. Dispatches to single-run
(run_ns) or multi-GPU (run_ns_multi_gpu) automatically based on
the replica axis implied by the config.
jaxrens run -c config.yaml
jaxrens run -c config.yaml --set run.max_iterations=5000 \
--set run.seed=7
All fields accept --set key.path=value overrides; nested paths use
dots (run.n_live, ensemble.pressure, inter_re.re_interval). Lists
and nested structures are YAML-parsed, so --set 'ensemble.pressure=[0.5, 1.0, 2.0]' works.
Output artifacts land under output.working_dir (default ./)
with the prefix from output.out_file_prefix.
Additional flags guard the run and control restart behaviour:
Flag |
Effect |
|---|---|
|
Assert JAX sees exactly |
|
Delete pre-existing artifacts in |
|
Resume by auto-discovering a checkpoint in |
jaxrens run -c config.yaml --n-gpus $SLURM_GPUS_ON_NODE
jaxrens run -c config.yaml --resume
jaxrens run -c config.yaml --force
jaxrens dump-schema¶
Emit the JSON schema for RootSpec,
the top-level config model. Useful for editor
autocomplete (point your YAML LSP at the generated schema).
jaxrens dump-schema --format json > jaxrens.schema.json
jaxrens plot¶
Render a quick-look PNG from a single run artefact. The kind of plot is auto-detected from the filename suffix, so you just point it at a file:
jaxrens plot output/run.adaptation.h5
jaxrens plot output/run.energies -o energies.png
By default the PNG is written next to the input as
<stem>.<kind>.png; override with -o/--output. Four artefact kinds
are recognised:
Suffix |
Plot |
|---|---|
|
2-panel step-size + acceptance-rate trace (mean ± std across replicas) |
|
swap acceptance per adjacent replica pair vs iteration |
|
2-panel: per-walker neighbor-count percentiles (top) + distribution heatmap (bottom), with bucket overlay |
|
dead-point energy trail (and volume, if present) |
This is the “quick look at one file” utility. For full multi-run
cohort analysis, use MonitorCollection.from_multi_run_directory and
the methods on the collection (see API reference).
jaxrens analyze¶
Turn a run’s dead-point energy ladder into a thermodynamic observable —
heat capacity, log partition function, or free energy — over a
temperature sweep. Unlike plot, which dispatches on a single
self-contained artefact, analyze dispatches on a checkpoint file
and pulls the sibling .energies log from the same directory (via
Monitor.from_directory), since the live-walker energies and the
dead-point history live in different files.
jaxrens analyze output/run.final.checkpoint.h5 --t-min 0.05 --t-max 3.0
The primary output is data, not a picture — T against the observable,
ready for a notebook or another run’s comparison without a detour
through a PNG:
Wrote output/run.heat_capacity.csv
T, Cv
0.05, 0.44239143
0.064824121, 0.72091224
...
Flag |
Effect |
|---|---|
|
|
|
|
|
Temperature sweep bounds, in the run’s energy units divided by |
|
Number of temperature points (default 200). |
|
Boltzmann constant in energy-units-per-T, e.g. |
|
|
|
Data-file path. Default: sibling |
|
Also render a PNG of the same data, via the same |
|
PNG path when |
See 3. LJ cluster — heat capacity for a worked example, including the
--format json output shape.
The YAML surface¶
Every YAML config has eleven top-level sections plus one scalar key. Not all are required — most have sensible defaults.
Section |
Purpose |
Cardinality |
|---|---|---|
|
NS parameters (n_live, max_iter, seed, …) |
required |
|
ordered list of MCMC kernels |
required |
|
energy model (lj/mace/neuralil/nequix/jaxmd/toy) |
required |
|
file format, intervals, working dir |
required |
|
NVT / NPT / semi-grand + optional pressure list |
optional |
|
replica-exchange flavor (pressure/xrens/semi_grand) |
optional |
|
step-size adaptation policy + per-move overrides |
optional |
|
list of stopping criteria |
optional |
|
starting walkers (species / config file / restart) |
optional |
|
cell-shape / volume constraints |
optional |
|
hard configuration constraints (e.g. minimum distance) |
optional |
|
scalar: |
optional |
For the full schema — every field of every section, with its type,
default, and constraints — see the Configuration. For a
machine-readable version (e.g. editor autocomplete), use the JSON dump
(jaxrens dump-schema).