MTTK

class hoomd.md.methods.thermostats.MTTK(kT, tau)

Bases: Thermostat

The Nosé-Hoover thermostat.

Controls the system temperature using velocity rescaling with the Nosé-Hoover thermostat.

Parameters:
  • kT (hoomd.variant.variant_like) – Temperature set point for the thermostat \([\mathrm{energy}]\).

  • tau (float) – Coupling constant for the thermostat \([\mathrm{time}]\)

The translational thermostat has a momentum \(\xi\) and position \(\eta\). The rotational thermostat has momentum \(\xi_{\mathrm{rot}}\) and position \(\eta_\mathrm{rot}\). Access these quantities using translational_dof and rotational_dof.

Note

The coupling constant tau should be set within a reasonable range to avoid abrupt fluctuations in the kinetic temperature and to avoid long time to equilibration. The recommended value for most systems is \(\tau = 100 \delta t\).

Examples:

mttk = hoomd.md.methods.thermostats.MTTK(
    kT=1.5,
    tau=simulation.operations.integrator.dt * 100,
)
simulation.operations.integrator.methods[0].thermostat = mttk
kT

Temperature set point for the thermostat \([\mathrm{energy}]\).

Examples:

mttk.kT = 1.0
mttk.kT = hoomd.variant.Ramp(A=1.0, B=2.0, t_start=0, t_ramp=1_000_000)
Type:

hoomd.variant.variant_like

tau

Coupling constant for the thermostat \([\mathrm{time}]\)

Example:

mttk.tau = 0.2
Type:

float

translational_dof

Additional degrees of freedom for the translational thermostat (\(\xi\), \(\eta\))

Save and restore the thermostat degrees of freedom when continuing simulations:

Examples:

Save before exiting:

numpy.save(
    file=path / "translational_dof.npy",
    arr=mttk.translational_dof,
)

Load when continuing:

mttk = hoomd.md.methods.thermostats.MTTK(
    kT=1.5,
    tau=simulation.operations.integrator.dt * 100,
)
simulation.operations.integrator.methods[0].thermostat = mttk

mttk.translational_dof = numpy.load(file=path / "translational_dof.npy")
Type:

tuple[float, float]

rotational_dof

Additional degrees of freedom for the rotational thermostat (\(\xi_\mathrm{rot}\), \(\eta_\mathrm{rot}\))

Save and restore the thermostat degrees of freedom when continuing simulations:

Examples:

Save before exiting:

numpy.save(
    file=path / "rotational_dof.npy",
    arr=mttk.rotational_dof,
)

Load when continuing:

mttk = hoomd.md.methods.thermostats.MTTK(
    kT=1.5,
    tau=simulation.operations.integrator.dt * 100,
)
simulation.operations.integrator.methods[0].thermostat = mttk

mttk.rotational_dof = numpy.load(file=path / "rotational_dof.npy")
Type:

tuple[float, float]

property energy

Energy the thermostat contributes to the Hamiltonian \([\mathrm{energy}]\).

Example:

logger.add(obj=mttk, quantities=['energy'])

(Loggable: category=”scalar”)

thermalize_dof()

Set the thermostat momenta to random values.

thermalize_dof sets a random value for the momentum \(\xi\). When hoomd.md.Integrator.integrate_rotational_dof is True, it also sets a random value for the rotational thermostat momentum \(\xi_{\mathrm{rot}}\). Call thermalize_dof to set a new random state for the thermostat.

Example

mttk.thermalize_dof()

Important

You must call Simulation.run before thermalize_dof.