nvt_vrescale_step

torch_sim.integrators.nvt.nvt_vrescale_step(model, state, *, dt, kT, tau=None)[source]

Perform one complete V-Rescale (CSVR) dynamics integration step.

Implements canonical sampling through velocity rescaling from Bussi, Donadio & Parrinello (2007) [1].

Stochastic differential equation for kinetic energy (Eq. 7 of [1]):

\[dK = \frac{\bar{K} - K}{\tau}\,dt + 2\sqrt{\frac{K\bar{K}}{N_f\tau}}\,dW\]

where \(\bar{K} = N_f k_BT/2\) is the target kinetic energy.

Discrete rescaling factor \(\alpha^2 = K'/K\) (Eq. 22 of [1]):

\[\alpha^2 = e^{-\Delta t/\tau} + \frac{\bar{K}}{N_f K}\bigl(1-e^{-\Delta t/\tau}\bigr) \Bigl(R_1^2 + \sum_{i=2}^{N_f} R_i^2\Bigr) + 2\,e^{-\Delta t/(2\tau)} \sqrt{\frac{\bar{K}}{N_f K} \bigl(1-e^{-\Delta t/\tau}\bigr)}\;R_1\]

where \(R_1 \sim \mathcal{N}(0,1)\) and \(\sum_{i=2}^{N_f} R_i^2 \sim \text{Gamma}\bigl((N_f-1)/2,\,2\bigr)\). Momenta are then rescaled as \(\mathbf{p} \leftarrow \alpha\,\mathbf{p}\).

Variable mapping (equation -> code):

Parameters:
  • model (ModelInterface) – Neural network model that computes energies and forces. Must return a dict with ‘energy’ and ‘forces’ keys.

  • state (NVTVRescaleState) – Current system state containing positions, momenta, forces

  • dt (float | Tensor) – Integration timestep, either scalar or shape [n_systems]

  • kT (float | Tensor) – Target temperature in energy units, either scalar or with shape [n_systems]

  • tau (float | Tensor | None) – Thermostat relaxation time controlling the coupling strength, either scalar or with shape [n_systems]. Defaults to 100*dt.

Returns:

Updated state after one complete V-Rescale step with new positions,

momenta, forces, and energy

Return type:

MDState

References