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 system - Kinetic energy of the particles - Energy contributions from thermostat chains - Energy contributions from barostat chains - 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.
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: