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
| Ensemble | Dynamics string | ASE class |
|---|---|---|
nve | velocityverlet | ase.md.verlet.VelocityVerlet |
nvt | langevin | ase.md.langevin.Langevin |
nvt | andersen | ase.md.andersen.Andersen |
nvt | berendsen | ase.md.nvtberendsen.NVTBerendsen |
nvt | nose-hoover | ase.md.npt.NPT |
npt | nose-hoover | ase.md.npt.NPT |
npt | berendsen | ase.md.nptberendsen.NPTBerendsen |
MolecularDynamics class directly to dynamics.
Function signature
Parameters
Atomic structure to simulate. A copy is made internally.
Calculator for energy and force evaluations at each MD step.
Statistical ensemble. One of
"nve", "nvt", or "npt".Dynamics integrator. Accepts a string (see table above) or an ASE
MolecularDynamics class. The string must be valid for the chosen ensemble.Integration time step in femtoseconds. Defaults to
0.5 fs if hydrogen is present, otherwise 2.0 fs.Total simulation time in femtoseconds. The number of steps is
int(total_time / time_step).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.
Target pressure in eV/ų for NPT simulations. Can be a scalar or a sequence. Ignored for NVE and NVT.
Extra keyword arguments forwarded to the ASE dynamics constructor. For Langevin, the default friction is
10.0 × 10⁻³ / fs (10 ps⁻¹) if not provided.Random seed for Maxwell-Boltzmann velocity initialization. Set for reproducible simulations.
Remove the total linear momentum from the initial velocity distribution.
Remove the total angular momentum from the initial velocity distribution.
Path to an ASE
.traj file for saving simulation frames. Parent directories are created automatically.Write a frame to
traj_file every this many steps.If
True and traj_file exists, resume the simulation from the last frame. Velocity and position information are restored from the trajectory.Return value
| Key | Type | Description |
|---|---|---|
atoms | ase.Atoms | Final structure after the simulation |
runtime | datetime.timedelta | Wall-clock time of the simulation |
n_steps | int | Number of MD steps executed |
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.