Simulation control options¶
Simulation parameters are read from an .ini file (e.g. md.ini) by
topo.read_simulation_config(), which returns a
SimulationConfig. The section title [OPTIONS] is
required.
Comments: inline or on their own line, starting with
;or#.Keyword and value are separated by
=or:.Every option below has a default except the ones marked required; you only need to set the options you want to change.
Running a simulation¶
The runner lives in the package as topo.mdrun. Once TOPO is installed
(pip install -e . from the repo root) any of these are equivalent:
topo-mdrun -f md.ini # installed console command
python -m topo.mdrun -f md.ini # module form
python run_simulation.py -f md.ini # tutorial shim (calls topo.mdrun)
Example md.ini:
[OPTIONS]
md_steps = 500_000 ; number of steps (underscores allowed)
dt = 0.01 ; time step in ps
nstxout = 1000 ; steps between trajectory (DCD) writes
nstlog = 1000 ; steps between log writes
nstchk = 5000 ; steps between checkpoint writes (default: nstxout)
nstcomm = 100 ; center-of-mass motion removal; omit for multi-chain runs
log_precision = 4 ; decimal places for float columns in the .log
log_width = 14 ; min column width for aligned, fixed-width .log
model = topo ; TOPO model (only option currently)
constraints = AllBonds ; AllBonds (rigid) or None (flexible bonds)
; temperature coupling
tcoupl = yes
ref_t = 310 ; Kelvin (also the low/refold temperature when annealing)
tau_t = 0.05 ; ps^-1
; temperature protocol (annealing / quenching) -- off by default.
; Two phases: a quench (-> <outname>_quench.dcd/.log) then production
; (md_steps at ref_t -> <outname>.dcd/.log). anneal_steps is SEPARATE
; from md_steps; grand total = anneal_steps (+ ramp) + md_steps.
; anneal = yes ; hold at t_high then quench/cool down to ref_t
; t_high = 600 ; Kelvin (high/unfolding temperature)
; anneal_steps = 1_000_000 ; quench-phase steps held at t_high
; anneal_ramp = jump ; jump (instant drop) or linear (gradual cool)
; anneal_ramp_steps = 500_000 ; linear only: quench-phase ramp t_high -> ref_t
; anneal_ramp_increments = 20 ; linear only: discrete T steps in the ramp
; pressure coupling
pcoupl = no
ref_p = 1
frequency_p = 25
; periodic boundary condition
pbc = yes
box_dimension = 30 ; cubic 30 nm; or [30, 30, 60] for a box
; input
pdb_file = 2ww4.pdb
; init_position = traj/traj_final.pdb ; optional starting coordinates
domain_def = domain.yaml ; optional
stride_output_file = stride.dat ; optional
; output (all files -> <output_dir>/<outname>.*, default traj/traj.*)
output_dir = traj
outname = traj
; hardware
device = GPU
ppn = 4
; restart
restart = no
minimize = no
Parameter summary¶
“Required = yes” means the run cannot proceed without it. Options with a default
may be omitted. — in the Default column means there is no default (the
option is either required, or only meaningful in a specific mode noted in the
description).
Option |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
int |
no |
|
Total number of integration steps. Underscores are allowed ( |
|
float [ps] |
no |
|
Integration time step. |
|
int |
no |
|
Steps between writing the trajectory (DCD). |
|
int |
no |
|
Steps between writing the energy/temperature log. |
|
int |
no |
|
Steps between writing the checkpoint. Defaults to |
|
int |
no |
|
Steps between center-of-mass motion removals. Unset by default → no COM removal. COM removal suits a single chain but couples the drift of independent chains, so leave it off for multi-copy runs ( |
|
int |
no |
|
Decimal places for floating-point columns (energies, time, temperature, …) in the |
|
int |
no |
|
Minimum width (characters) of each |
|
str |
no |
|
Force-field model. Only |
|
str |
no |
|
Bond treatment: |
|
float |
no |
|
Integrator relative constraint tolerance. Only meaningful with |
|
bool |
no |
|
Langevin thermostat on/off. (NVE is not used.) |
|
float [K] |
no |
|
Reference temperature. Used when |
|
float [ps⁻¹] |
no |
|
Friction coefficient coupling the system to the heat bath. Used when |
|
bool |
no |
|
Temperature protocol. |
|
float [K] |
if |
|
High (unfolding) temperature held during the quench phase. |
|
int ( |
no |
|
Quench-phase steps held at |
|
str |
no |
|
|
|
int |
no |
|
Additional quench-phase steps spent ramping |
|
int |
no |
|
Number of discrete temperature steps in the ramp; the last lands exactly on |
|
bool |
no |
|
Monte Carlo barostat on/off. Requires |
|
float [bar] |
no |
|
Reference pressure. Used when |
|
int [steps] |
no |
|
Barostat move attempt frequency. Used when |
|
bool |
no |
|
Periodic boundary conditions on/off. |
|
float or [x,y,z] [nm] |
if |
|
Box size: a scalar |
|
str |
yes |
|
Input structure ( |
|
str |
no |
|
Optional PDB of starting coordinates for a fresh run (atom count must match the system). If unset, the coordinates from |
|
str |
no |
|
Folder for all generated files; created if missing. One run = one self-contained folder. |
|
str |
no |
|
Basename for generated files: |
|
str |
no |
|
Explicit checkpoint path override. Normally leave unset so it lands in the run folder. |
|
str |
no |
|
Path to a domain YAML for per-domain sidechain-contact scaling. If omitted, all SS contacts use scale 1.0. See Domain definition file (domain.yaml). |
|
str |
no |
|
Path to a precomputed STRIDE output. If omitted, STRIDE is run automatically on the structure (and cached to |
|
str |
no |
|
Compute platform: |
|
int |
no |
|
Number of CPU threads. Used when |
|
int |
no |
|
Number of independent, non-interacting copies of the input chain to pack into one simulation (better GPU utilization; |
|
float [nm] |
no |
|
Initial x-translation between successive copies. Only used when |
|
bool |
no |
|
Restart from |
|
bool |
no |
|
Energy-minimize the input structure before dynamics. Forced |
Note
Boolean options accept yes/no, true/false, 1/0
(parsed by topo.utils.config.strtobool()).
Notes on individual options¶
- Output layout (
output_dir/outname) Every generated file is written to
<output_dir>/<outname><suffix>, so a run is one self-contained folder (defaulttraj/):traj.dcd(trajectory),traj.log(state log),traj.psf(single-chain topology),traj.chk(checkpoint),traj_final.pdb(last conformation — reusable asinit_positionfor a follow-up run),traj_runinfo.log(provenance), andtraj_multi.psffor a multi-copy run.output_diris created automatically if missing. To keep several runs side by side, point each at its own folder (e.g.output_dir = runs/P0CX28_T300) or changeoutname.- Output frequency and log formatting (
nstxout/nstchk/nstcomm/log_precision/log_width) nstxoutcontrols trajectory (DCD) frames;nstchkcontrols checkpoint writes and defaults tonstxoutwhen unset, so the two can be decoupled.nstcommis off unless set — center-of-mass motion removal is only appropriate for a single chain (it couples the drift of independent chains), so leave it unset for multi-copy runs. The log reporter istopo.topoReporter, which writes a fixed-width, aligned.log:log_precisionsets the decimals for float columns (default4;Nonefor full precision) andlog_widthsets the minimum column width (default14;Noneto disable padding). Columns are separated by two spaces and the header is a#comment, so the log stays both human-readable and machine-parsable (seetopo.reporter.readOpenMMReporterFile()).- Bond treatment (
constraints) AllBonds(default) makes every bond a rigid distance constraint and adds no harmonic bond force — appropriate for the standard CA model and required for the usual 15 fs / 0.015 ps time step.None(alsonone/ empty) instead adds a harmonic bond force and no constraints (flexible bonds). The two modes are mutually exclusive.- Temperature / pressure coupling
ref_tandtau_tare only consumed whentcoupl = yes;ref_pandfrequency_ponly whenpcoupl = yes. Pressure coupling additionally requirespbc = yes(asserted at parse time).- Temperature protocol (
anneal/t_high/anneal_*) By default a run is equilibrium: the Langevin thermostat is held at
ref_tfor allmd_steps, written to<outname>.dcd/.log. Settinganneal = yessplits the run into two phases, each writing its own trajectory and log:Quench — hold at
t_highforanneal_stepsand, foranneal_ramp = linear, cool toref_toveranneal_ramp_steps(inanneal_ramp_incrementsdiscrete temperature steps). Written to<outname>_quench.dcd/.log.Production —
md_stepsatref_t. Written to the usual<outname>.dcd/.log, so the production trajectory is never contaminated by the hot hold.
anneal_stepsis therefore separate frommd_steps: the grand total isanneal_steps(+anneal_ramp_stepsforlinear) +md_steps. Foranneal_ramp = jumpthe drop toref_tis instantaneous and lands exactly on the boundary between the two files.ref_tis always the low / refold temperature — there is no separatet_lowkey. The runner prints both phases at startup.The quench is a one-time preparation: it writes no checkpoint, and the step/time clock is reset to zero when production starts, so the production run looks like an ordinary standalone run (
Stepfrom 0) and the single checkpoint<outname>.chkholds only production state. Positions and velocities carry over in the same context. Consequently restart applies to production only:restart = yesskips the quench and resumes production from the checkpoint (appending to<outname>.dcd/.log); a run killed during the short quench has no checkpoint yet, so a restart falls back to a fresh run and simply redoes the quench.Choose
jumpfor clean folding kinetics (folding happens at a single temperature) andlinearfor maximum refolding yield. Crucially, a Langevin thermostat relaxes toward a new setpoint over roughly1/tau_t, soanneal_stepsmust be many relaxation times (and long enough to actually unfold the protein) — with a production-typicaltau_t = 0.05ps⁻¹ (≈20 ps relaxation) that means a hold of many nanoseconds. Annealing requirestcoupl = yes. See Tutorial 6 — Temperature annealing & quenching for a full walkthrough.- Periodic boundary conditions
Turning
pbcon affects the non-bonded forces and how coordinates are written to the PDB/DCD (handled internally).box_dimensionmust be given whenpbc = yes; an invalid/empty value silently disables PBC.domain_defandstride_output_fileBoth are optional inputs to the TOPO structure-based non-bonded potential. Omit
domain_deffor no domain scaling (every SS contact scaled by 1.0). Omitstride_output_fileto let the builder run STRIDE for you (STRIDE must be onPATH); supply a path to reuse a precomputed file.restartandminimizerestart = yesloads positions and velocities fromcheckpointand continues; reporters append to the existing log/trajectory, andminimizeis forced off. Withrestart = noyou may chooseminimize. Note that a native input structure is already the energy minimum of the structure-based model, so minimization is usually unnecessary.- Initial coordinates and velocities (
init_position) The starting state is resolved as follows (and recorded in
<outname>_runinfo.logunderinitial_coordinates/initial_velocities):restart = yeswith the checkpoint present → positions and velocities come from the checkpoint.Otherwise (a fresh start, including
restart = yeswhen the checkpoint is missing — which prints a warning) → coordinates come frominit_positionif set, else frompdb_file; velocities are drawn from the Boltzmann distribution atref_t.
Every run also writes
<outname>_final.pdb(the last conformation), which you can pass asinit_positionto seed a follow-up run.- Hardware (
device/ppn) device = GPUruns on CUDA (mixed precision).device = CPUusesppnthreads;ppnis ignored on GPU.- Multi-copy runs (
n_copies/copy_shift) A single coarse-grained chain (a few hundred beads) badly underuses a GPU. Setting
n_copies > 1packs that many independent copies of the input chain into oneSystemand yields one trajectory per copy. The copies are guaranteed non-interacting: bonded terms and constraints are duplicated per copy, and everyCustomNonbondedForce(Yukawa electrostatics and the structure-based contacts) is restricted to intra-copy interaction groups, so the total potential energy is exactlyn_copies ×the single-chain energy.copy_shiftsets the initial x-offset between copies (layout only). The runner (topo.mdrun) replicates automatically viatopo.make_noninteracting_copies()whenevern_copies > 1; afterwards split the combined trajectory into per-copy DCDs withtopo.split_chains()(memory-bounded streaming; CLIpython -m topo.utils.multichain). See Tutorial 4 — Many copies in one run (better GPU utilization) for a complete walkthrough.