nvt_nose_hoover_invariant

torch_sim.integrators.nvt.nvt_nose_hoover_invariant(state, kT)[source]

Calculate the conserved quantity for NVT ensemble with Nose-Hoover thermostat.

This function computes the conserved Hamiltonian of the extended system for NVT dynamics with a Nose-Hoover chain thermostat. The invariant includes: 1. System potential energy 2. System kinetic energy 3. Chain thermostat energy terms

This quantity should remain approximately constant during simulation and is useful for validating the thermostat implementation.

Parameters:
  • energy_fn – Function that computes system potential energy given positions

  • state (NVTNoseHooverState) – Current state of the system including chain variables

  • kT (Tensor) – Target temperature in energy units

Returns:

The conserved Hamiltonian of the extended NVT dynamics

Return type:

Tensor

Notes

  • Conservation indicates correct thermostat implementation

  • Drift in this quantity suggests numerical instability

  • Includes both physical and thermostat degrees of freedom

  • Useful for debugging thermostat behavior