MD task runs atomistic molecular dynamics (MD) using ASE dynamics integrators. It supports:
- Three statistical ensembles: NVE, NVT, NPT
- Multiple thermostat/barostat algorithms
- Time-dependent temperature and pressure schedules (annealing, ramps, etc.)
- Trajectory checkpointing and restart
- Dispersion corrections via
TorchDFTD3Calculator
Supported ensembles and dynamics
You can also pass any ASE
MolecularDynamics class directly to dynamics.
Function signature
Parameters
ase.Atoms
required
Atomic structure to simulate. A copy is made internally.
ase.calculators.calculator.BaseCalculator
required
Calculator for energy and force evaluations at each MD step.
string
default:"nvt"
Statistical ensemble. One of
"nve", "nvt", or "npt".str | MolecularDynamics
default:"langevin"
Dynamics integrator. Accepts a string (see table above) or an ASE
MolecularDynamics class. The string must be valid for the chosen ensemble.number | None
default:"None"
Integration time step in femtoseconds. Defaults to
0.5 fs if hydrogen is present, otherwise 2.0 fs.number
default:"1000"
Total simulation time in femtoseconds. The number of steps is
int(total_time / time_step).float | Sequence | ndarray | None
default:"300.0"
Target temperature in Kelvin. Can be:
- A scalar for a constant temperature.
- A sequence of values for a temperature schedule (linearly interpolated over the simulation).
- Ignored for NVE.
float | Sequence | ndarray | None
default:"None"
Target pressure in eV/ų for NPT simulations. Can be a scalar or a sequence. Ignored for NVE and NVT.
dict | None
default:"None"
Extra keyword arguments forwarded to the ASE dynamics constructor. For Langevin, the default friction is
10.0 × 10⁻³ / fs (10 ps⁻¹) if not provided.integer | None
default:"None"
Random seed for Maxwell-Boltzmann velocity initialization. Set for reproducible simulations.
boolean
default:"true"
Remove the total linear momentum from the initial velocity distribution.
boolean
default:"true"
Remove the total angular momentum from the initial velocity distribution.
str | Path | None
default:"None"
Path to an ASE
.traj file for saving simulation frames. Parent directories are created automatically.integer
default:"1"
Write a frame to
traj_file every this many steps.boolean
default:"true"
If
True and traj_file exists, resume the simulation from the last frame. Velocity and position information are restored from the trajectory.Return value
Examples
- NVE
- NVT (Langevin)
- NVT with annealing schedule
- With dispersion
Temperature and pressure scheduling
Pass a list of values totemperature (or pressure for NPT) to define a piecewise schedule. The values are linearly interpolated over the total number of steps.
Trajectory checkpointing
Whentraj_file is set and restart=True, the task detects an existing trajectory and continues from the last saved frame. This allows long simulations to be interrupted and resumed without losing progress.
For NPT simulations, ASE requires an upper-triangular cell. The task automatically applies a Schur decomposition to transform the cell before initializing the dynamics.