atomistics.calculators.lammps.shared.get_box_relax_command

atomistics.calculators.lammps.shared.get_box_relax_command#

atomistics.calculators.lammps.shared.get_box_relax_command(pressure: float | Iterable[float | None], vmax: float | None) str[source]#

Build a LAMMPS fix box/relax command string for the given pressure specification.

When pressure is a scalar the command uses isotropic relaxation (iso). When pressure is an iterable of length 3, the x/y/z components are set individually; components that are None are omitted. An iterable of length 6 additionally sets the xy/xz/yz off-diagonal components.

Parameters:
  • pressure (float | Iterable[float | None]) – Target pressure in bar. A scalar applies isotropic pressure; an iterable of 3 or 6 elements applies anisotropic pressure component-wise (None entries are skipped).

  • vmax (float | None) – Maximum fractional volume change per timestep (LAMMPS vmax keyword). No vmax clause is added when None.

Returns:

A complete LAMMPS fix command string.

Return type:

str

Raises:
  • ValueError – If pressure is an iterable whose length is not 3 or 6.

  • TypeError – If vmax is not a float.