Command line · guide
The caps command line
How the caps command is organised, the conventions every command shares, which command to reach for at each step of a project, and the scripts CAPS writes for you to run on a workstation or a cluster.
First steps
Run caps with no arguments to see every command and its main options on one screen. The workflow commands (coarse-graining and DFT surfaces) also take --help, which prints every option with its default and the reason for that default:
caps # the usage: every command
caps cgfit --help # one command's options, defaults and reasons
caps info ps.data # any structure: atoms, molecules, bonds, cell, framescaps info is the quickest check that a file reads as you expect. Sample structures and recipes ship in the program's samples folder.
Conventions every command shares
Units
CAPS works in LAMMPS real units throughout: lengths in Å, time in fs (time steps) or ps (run lengths, where an option says so), temperature in K, pressure in atm, energy in kcal/mol, density in g/cm³, charge in e. Options name their unit in the usage when it is not one of these.
Files
The format follows the extension, both ways:
| Kind | Read | Written |
|---|---|---|
| Structures | .data (LAMMPS), .pdb, .xyz, .mol2, .sdf/.mol, .cif, .car/.mdf, .gro + .top, .vasp/POSCAR/CONTCAR, AMBER prmtop with coordinates | the same, chosen by -o |
| Trajectories | LAMMPS dump (.lammpstrj), .dcd, .xtc, .trr, multi-frame .xyz, AMBER NetCDF / mdcrd | caps frames writes .lammpstrj, .dcd, .xyz, .pdb, .gro, .trr |
| Force fields | CAPS force-field JSON (data/forcefields), or a library name such as opls2005, pcff, compass | LAMMPS data + input, GROMACS .top/.itp/.gro/.mdp, DL_POLY |
| Recipes, pipelines | YAML or JSON | — |
A trajectory carries no bonds, so commands that read one take --topology DATA (the data file of the same atoms). -o names the output; a folder for the commands that write several files.
Seeds and threads
Everything random takes --seed (default 1): the same command, input and seed give the same result on the same build. The commands that run in parallel (md, run, pack) take --threads N (default: all cores).
Provenance
The recipe runner and the coarse-graining and DFT commands write FILE.provenance.json beside what they make: the program's version, the inputs' SHA-256, every step with its parameters, seed and the methods it follows. caps provenance FILE --methods turns it into a methods paragraph with numbered references, --bibtex into BibTeX, and --compare OTHER lists what differs between two runs.
Output and exit codes
Commands print a short report and the files they wrote. --json (recipes, coarse-graining and DFT commands) prints the result as JSON for scripts. A command exits 0 on success and non-zero on an error. caps run distinguishes 2 (bad input), 3 (parameters missing from the force field) and 4 (a failed run); caps validate exits 1 when a slab fails a check, so it can stop a batch script.
Which command for what
Each command links to its full entry in the command reference, which is generated from the program itself.
Build structures
Molecules, chains, cells, crystals, surfaces and fillers.
| Command | What it does |
|---|---|
caps build | a 3D molecule from SMILES, with conformers and a force-field clean-up |
caps grow | polymer chains of any repeat units grown in a periodic cell (tacticity, copolymer sequences) |
caps blend | two or more polymers in one cell: mixed, as slabs or as a droplet |
caps peptide | an all-atom peptide from a sequence: helix, strand or your secondary structure, at a pH |
caps crystal | a crystal from a space group and sites, or a CIF's symmetry found |
caps surface | a slab cut from a crystal at (hkl), terminations listed |
caps interface | a polymer film grown on a crystal surface |
caps nano | nanotubes, graphene sheets and nanoparticles, alone or in a polymer matrix |
caps pore | a fluid in a slit, cylindrical or framework pore |
caps solvate | solvent and ions packed around a solute |
caps pack | molecules packed by a packmol-style input |
caps edit | scripted edits: elements, bonds, hydrogens, geometry, stereo, supercells, vacuum |
Force fields
Types, charges and parameters; exports for LAMMPS, GROMACS and DL_POLY.
| Command | What it does |
|---|---|
caps ff | force fields: import, inspect, type atoms by SMARTS rules, apply parameters and export |
caps field | the default force field's types, terms and energy for a structure |
Relax and run
Minimisation, molecular dynamics, equilibration protocols, regrowth, crosslinking and recipes.
| Command | What it does |
|---|---|
caps relax | energy minimisation (L-BFGS, CG, FIRE) with push-off and box relaxation |
caps md | molecular dynamics: NVE, NVT, NPT, constraints, checkpoints |
caps equilibrate | equilibration protocols: Larsen's 21 steps, annealing cycles, push-off, until converged |
caps cbmc | configurational-bias Monte Carlo regrowth of chain ends |
caps react | crosslinking and curing by reaction templates, cycle by cycle |
caps run | a recipe (build to export in one file) or a saved pipeline over many inputs |
Properties
Mechanics, glass transition, elastic constants and interfaces.
| Command | What it does |
|---|---|
caps tensile | uniaxial tension: stress–strain curve, modulus, yield |
caps tg | glass transition from a cooling scan of density |
caps elastic | elastic constants by static strain or stress fluctuations |
caps pull | pull-out of a film from a surface: interfacial shear strength, work of separation |
Inspect and analyse
Files, structure, trajectories and figures.
| Command | What it does |
|---|---|
caps info | what a file holds: atoms, molecules, bonds, cell, frames |
caps check | file checks: counts, bonds, contacts, charges, cell |
caps contacts | the closest distance between atoms of different molecules |
caps chains | backbones and mean-square internal distances |
caps shape | per-molecule radius of gyration and shape |
caps rdf | radial distribution function of one structure |
caps analyze | properties over a trajectory: density, g(r), S(q), Rg, C∞, MSD, CED, free volume, interfaces |
caps frames | a trajectory thinned or converted |
caps convert | a structure in another format |
caps render | a picture (PNG or SVG) of a structure without the Studio |
caps pipeline | an analysis pipeline on one frame: attributes and tables |
Reproducibility
Provenance, bundles and the validation suite.
| Command | What it does |
|---|---|
caps provenance | how a file was made: steps, methods paragraph, BibTeX, comparison of two runs |
caps bundle | a figure's data with its pipeline, provenance and hashes |
caps reproduce | a bundle rebuilt from its input, checked by SHA-256 |
caps bench | the built-in validation suite against reference values |
Coarse-graining
Chemistry-aware mapping, bonded and non-bonded potentials, melts, entanglements, backmapping.
| Command | What it does |
|---|---|
caps cgmap | chemistry-aware mapping to beads by SMARTS rules; trajectories mapped frame by frame |
caps cgfit | CG potentials: bonded Boltzmann inversion, per-pair IBI, fits, T_g, σ/ε calibration |
caps cgbuild | a CG melt of repeat units with real sequence statistics |
caps ppa | entanglements: primitive paths and the N_e estimators |
caps mech | tension decks for CG melts and their analysis (modulus, yield, strain hardening) |
caps cgdyn | chain dynamics: g₁, g₂, g₃, D, τ_R, τ_e; CG-to-AA time mapping |
caps backmap | CG beads back to all atoms, fragment by fragment, with a relaxation deck |
Biomolecular coarse-graining
Secondary structure and Martini proteins.
| Command | What it does |
|---|---|
caps dssp | DSSP secondary structure of a protein |
caps martini | a Martini 2.2 or 3 protein model |
DFT surfaces
2D sheets, terminations, adsorption complexes and VASP case folders.
| Command | What it does |
|---|---|
caps sheet | a 2D sheet from a preset or cut from a bulk structure |
caps terminate | terminations (O, OH, F …) on both faces of a sheet |
caps validate | PASS/FAIL checks of a 2D slab |
caps adsorb-dft | a molecule on a slab in several placements, for DFT |
caps vasp-set | one VASP case folder: POSCAR, INCARs with reasons, KPOINTS, job script |
caps vasp-conv | ENCUT and k-mesh convergence |
caps vasp-scan | scans: make the cases, fit the curve |
caps vasp-derived | follow-up runs: charges, charge-density difference, frequencies, AIMD |
caps vasp-jobs | submit, update, reset, clean up and store many VASP jobs |
caps vasp-check | check a case before or after running |
caps vasp-progress | progress of running cases |
caps vasp-health | stuck or failing runs |
caps vasp-bind | adsorption energies from slab, molecule and complex |
caps vasp-analyze | geometry, work function, DOS, Δρ, Bader, frequencies, AIMD, the summary table |
Scripts CAPS writes for you to run
Long runs belong on a workstation or a cluster, not inside CAPS. For those, CAPS writes ready-to-run inputs and scripts, each with a comment block at the top saying how to run it and which variables it takes.
| File | Written by | Run it with |
|---|---|---|
STEM.in + STEM.data | caps ff apply … --lammps-input STEM.in, caps run | lmp -in STEM.in |
STEM.top, .itp, .gro, .mdp (+ STEM_em.mdp) | caps ff apply … --gromacs STEM, caps run | gmx grompp -f STEM.mdp -c STEM.gro -p STEM.top -o run.tpr then gmx mdrun -deffnm run |
react.in, *_pre.mol, *_post.mol, *_map.txt | Python Document.bond_react(...) | lmp -in react.in (LAMMPS with REACTION) |
bonded/bonded.in + tables | caps cgfit bonded | include it after read_data, with -var BONDED bonded |
ibi/run_ibi.sh, in.cg_run, in.cg_tg | caps cgfit ibi-start | bash ibi/run_ibi.sh 20 (20 iterations; CAPS_LMP picks the LAMMPS binary) |
melt/in.cg_equil | caps cgbuild | lmp -in in.cg_equil -var DATA melt.cg.data -var BONDED ../bonded -var PAIR ../lj -var OUT equil |
in.cg_ppa + STEM.ends.in | caps ppa … --method lammps | lmp -in in.cg_ppa -var DATA equil.data -var OUT ppa, then caps ppa MAP equil.data ppa.lammpstrj |
tension/run_tension.sh, in.cg_tensile_* | caps mech decks | DATA=equil.data bash run_tension.sh, then caps mech analyze |
aa/in.backmap, pair_coeffs.in | caps backmap | lmp -in in.backmap -var DATA backmapped.data -var OUT relaxed, then caps backmap check |
job.slurm, make_potcar.sh, INCAR.*, KPOINTS | caps vasp-set, caps adsorb-dft | bash make_potcar.sh (your PAW set), sbatch job.slurm; caps vasp-jobs submits and tracks many |
Putting commands together
A shell loop over seeds
Independent replicas differ only in the seed; the provenance records it, so caps provenance --compare shows exactly that difference.
for s in 1 2 3; do
caps grow -o ps_$s.data --chains 4 --dp 10 --density 0.5 --units '*CC(*)c1ccccc1' --seed $s
caps relax ps_$s.data -o ps_${s}_min.data --quiet
caps md ps_${s}_min.data -o ps_${s}_md.data --steps 2000 --barostat berendsen --seed $s --quiet
done
caps analyze ps_1_md.data --props densityA recipe instead of a script
When the chain is fixed (build, type, grow, relax, equilibrate, run, analyse, export), write it once as a recipe and run it with caps run. The recipe's hash, every stage's parameters and the seed go into the provenance, so the whole study can be rebuilt; see Tutorial 03.
Pipelines over many trajectories
caps pipeline FILE --steps STEPS.yaml runs a chain of analysis steps (the Studio's pipeline, including Python steps) on one frame; caps run PIPELINE.yaml --input 'runs/*/traj.lammpstrj' --csv results.csv runs it over many inputs and writes one row per input.
Command line, Python or Studio?
All three call the same core, so results agree. Use the command line for batch work, shell scripts and clusters; Python (import caps) when a study needs loops, conditions or your own analysis, or features with no command yet (CAPS React's fix bond/react export, polymer sweeps, χ by MD); the Studio to look at structures, build interactively, and read plots and the methods report. The Studio's Coarse-grain and DFT pages show the equivalent command line for what you set up, ready to copy.