npt_nose_hoover_invariant¶
- torch_sim.integrators.npt.npt_nose_hoover_invariant(state, kT, external_pressure)[source]¶
Computes the conserved quantity for NPT ensemble with Nose-Hoover thermostat.
This function calculates the Hamiltonian of the extended NPT dynamics, which should be conserved during the simulation. It’s useful for validating the correctness of NPT simulations.
The conserved quantity includes: - Potential energy of the systems - Kinetic energy of the particles - Energy contributions from thermostat chains (per system) - Energy contributions from barostat chains (per system) - PV work term - Cell kinetic energy
- Parameters:
state (NPTNoseHooverState) – Current state of the NPT simulation system. Must contain position, momentum, cell, cell_momentum, cell_mass, thermostat, and barostat with proper batching for multiple systems.
external_pressure (Tensor) – Target external pressure of the system.
kT (Tensor) – Target thermal energy (Boltzmann constant x temperature).
- Returns:
- The conserved quantity (extended Hamiltonian) of the NPT system.
Returns a scalar for a single system or tensor with shape [n_systems] for multiple systems.
- Return type: