nvalchemi.dynamics.NPT#

class nvalchemi.dynamics.NPT(model, dt, temperature, pressure, barostat_time, thermostat_time, pressure_coupling='isotropic', chain_length=3, n_steps=None, hooks=None, convergence_hook=None, **kwargs)[source]#

Isothermal-isobaric (NPT) integrator via MTK barostat and NHC thermostat.

Samples the NPT ensemble. Two Nosé-Hoover chains control the temperature: one coupled to the particle velocities and one coupled to the barostat (cell) degrees of freedom.

Parameters:
  • model (BaseModelMixin) – The neural network potential model. Must produce "stress" output in addition to forces.

  • dt (float or torch.Tensor) – Integration timestep in femtoseconds [M] or scalar.

  • temperature (float or torch.Tensor) – Target temperature in Kelvin [M] or scalar.

  • pressure (float or torch.Tensor) – Target pressure in \(\mathrm{eV}/\mathrm{\AA}^3\) (positive for compression); the value is used directly by the barostat with no bar/GPa conversion applied. Shape [M] (isotropic), [M, 3] (anisotropic), or [M, 3, 3] (triclinic). Scalar is broadcast to [M] isotropic. For reference, \(1\,\mathrm{eV}/\mathrm{\AA}^3 \approx 1.602\times10^{6}\,\mathrm{bar} \approx 160.2\,\mathrm{GPa}\).

  • barostat_time (float or torch.Tensor) – Barostat coupling time \(\tau_P\) in femtoseconds [M] or scalar.

  • thermostat_time (float or torch.Tensor) – Thermostat coupling time \(\tau_T\) in femtoseconds [M] or scalar.

  • pressure_coupling ({"isotropic", "anisotropic", "triclinic"}) – Pressure control mode. Default "isotropic".

  • chain_length (int, optional) – Number of links in each Nosé-Hoover chain. Default 3.

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

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

  • convergence_hook (ConvergenceHook or dict, optional) – Convergence criterion.

  • **kwargs – Forwarded to BaseDynamics.

__needs_keys__#

{"forces", "stress"}.

Type:

set[str]

__provides_keys__#

{"positions", "velocities", "cell"}.

Type:

set[str]

post_update(batch)[source]#

Force/barostat v half → baro half → NHC-b half → NHC-p half.

Parameters:

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

Return type:

None

pre_update(batch)[source]#

NHC-p half → NHC-b half → baro half → force/barostat v half → r full → cell full.

Parameters:

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

Return type:

None