nvalchemi.dynamics.NVE#

class nvalchemi.dynamics.NVE(model, dt, n_steps=None, hooks=None, convergence_hook=None, **kwargs)[source]#

Microcanonical (NVE) integrator via velocity Verlet.

Conserves the total energy E = KE + PE. Best choice for validating model energy conservation and for generating reference trajectories.

Parameters:
  • model (BaseModelMixin) – The neural network potential model.

  • dt (float or torch.Tensor) – Integration timestep in femtoseconds. A scalar is broadcast to all systems; a tensor of shape [M] sets per-system timesteps (useful for heterogeneous batches or adaptive stepping via hooks).

  • n_steps (int, optional) – Total steps for run().

  • hooks (list[Hook], optional) – Initial hooks to register.

  • convergence_hook (ConvergenceHook or dict, optional) – Convergence criterion. For pure NVE trajectories this is rarely needed.

  • **kwargs – Forwarded to BaseDynamics.

__needs_keys__#

{"forces"} — forces must be present in model outputs.

Type:

set[str]

__provides_keys__#

{"positions", "velocities"} — updated each step.

Type:

set[str]

Examples

>>> nve = NVE(model, dt=1.0, n_steps=1000)
>>> nve.run(batch)
post_update(batch)[source]#

Finalize velocities with new forces.

Parameters:

batch (Batch) – Current batch; velocities updated in-place.

Return type:

None

pre_update(batch)[source]#

Position update and half-step velocity kick.

Parameters:

batch (Batch) – Current batch; positions and velocities updated in-place.

Return type:

None