nve_step¶
- torch_sim.integrators.nve.nve_step(state, model, *, dt, **_kwargs)[source]¶
Perform one complete NVE (microcanonical) integration step.
Implements the velocity Verlet algorithm for NVE dynamics, which provides energy-conserving, time-reversible integration of Hamilton’s equations of motion.
Equations (standard velocity Verlet):
\[\begin{split}\mathbf{p}_i(t + \Delta t/2) &= \mathbf{p}_i(t) + \frac{\Delta t}{2}\,\mathbf{F}_i(t) \\ \mathbf{r}_i(t + \Delta t) &= \mathbf{r}_i(t) + \Delta t\,\frac{\mathbf{p}_i(t + \Delta t/2)}{m_i} \\ \mathbf{F}_i(t + \Delta t) &= -\nabla_{\mathbf{r}_i} U\bigl( \mathbf{r}(t + \Delta t)\bigr) \\ \mathbf{p}_i(t + \Delta t) &= \mathbf{p}_i(t + \Delta t/2) + \frac{\Delta t}{2}\,\mathbf{F}_i(t + \Delta t)\end{split}\]Variable mapping (equation -> code):
Equation symbol
Code variable
\(\mathbf{r}_i\) (positions)
state.positions\(\mathbf{p}_i\) (momenta)
state.momenta\(m_i\) (masses)
state.masses\(\mathbf{F}_i\) (forces)
state.forces\(\Delta t\) (timestep)
dt- Parameters:
model (ModelInterface) – Neural network model that computes energies and forces. Must return a dict with ‘energy’ and ‘forces’ keys.
state (MDState) – Current system state containing positions, momenta, forces
dt (float | Tensor) – Integration timestep, either scalar or shape [n_systems]
_kwargs (Any)
- Returns:
- Updated state after one complete NVE step with new positions,
momenta, forces, and energy
- Return type:
Notes
Symplectic, time-reversible integrator of second order accuracy O(dt^2)
Conserves energy in the absence of numerical errors