nve_init

torch_sim.integrators.nve.nve_init(state, model, *, kT, **_kwargs)[source]

Initialize an NVE state from input data.

Creates an initial state for NVE molecular dynamics by computing initial energies and forces, and sampling momenta from a Maxwell-Boltzmann distribution at the specified temperature.

To seed the RNG set state.rng = seed before calling.

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

  • state (SimState) – SimState containing positions, masses, cell, pbc, and other required state variables

  • kT (float | Tensor) – Temperature in energy units for initializing momenta, scalar or with shape [n_systems]

  • _kwargs (Any)

Returns:

Initialized state for NVE integration containing positions,

momenta, forces, energy, and other required attributes

Return type:

MDState

Notes

  • Initial velocities sampled from Maxwell-Boltzmann distribution

  • Time integration error scales as O(dt²)