Velocity Verlet with Nosé–Hoover thermostat

This NVT-ensemble integrator implements the Verlet algorithm algorithm with Nosé–Hoover chain thermostat with a chain length M = 2.

For reference and detailed description of the algorithm see the original papers by S. Nosé, W.G. Hoover and Martyna et al.:

class halmd.mdsim.integrators.verlet_nvt_hoover(args)

Construct velocity-Verlet integrator with Nosé–Hoover chain thermostat.

  • args (table) – keyword arguments
  • args.particle – instance of halmd.mdsim.particle
  • – instance of
  • args.timestep (number) – integration time step (defaults to halmd.mdsim.clock.timestep)
  • args.temperature (number) – temperature of heat bath
  • args.resonance_frequency (number) – coupling frequency of the thermostat

Set integration time step in MD units.

Parameters:timestep (number) – integration timestep

This method forwards to halmd.mdsim.clock.set_timestep(), to ensure that all integrators use an identical time step.


Integration time step in MD units.


Set temperature of heat bath.

Parameters:temperature (number) – temperature of heat bath

Temperature of heat bath.


Resonance frequency of the Nosé–Hoover thermostat, this is connected to the mass of the thermostat via m_1 = d N T / \Omega^2 and m_2 = T/\Omega^2, where \Omega is 2\pi\times\textrm{resonance frequency}, N the total number of (point) particles, and d the dimension of space.


Set mass of heat bath.

Parameters:mass (table) – Sequence of masses m_1, m_2 for the heat bath coupling.

Array of masses m_1, m_2 of heat bath, connected to the coupling strength of the thermostat.


Calculate first half-step.

By default this function is connected to halmd.mdsim.core.on_integrate().


Calculate second half-step.

By default this function is connected to halmd.mdsim.core.on_finalize().


Return current values of thermostat chain variables (which are generalised positions).


Return current “velocities” of the thermostat chain variables.


Return internal energy of thermostat variables divided by particle.nparticle.


Disconnect integrator from core and profiler.

class writer(args)

Write heat bath variables (generalised positions and velocities) and derived quantities (internal energy) to file.

  • args (table) – keyword arguments
  • args.file – instance of file writer
  • args.fields (table) – data field names to be written
  • args.location (string table) – location within file (optional)
  • args.every (number) – sampling interval (optional)

instance of group writer

The table fields specifies which data fields are written. It may either be passed as an indexed table, e.g. {"position", "velocity"}, or as a dictionary, e.g., {xi = "position", v_xi = "velocity"}; the table form is interpreted as {position = "position", ...}. The keys denote the field names in the file and are appended to location. Valid values are position, velocity, internal_energy.

The argument location specifies a path in a structured file format like H5MD given as a table of strings. If omitted it defaults to {"observables", "nose_hoover"}.

If every is not specified or 0, a phase space sample will be written at the start and end of the simulation.


Disconnect Nosé–Hoover writer from observables sampler.