NPTNoseHooverMonteCarlo

Included in QATK.Dynamics

class NPTNoseHooverMonteCarlo(initial_velocity=None, time_step=None, reservoir_temperature=None, reservoir_pressure=None, thermostat_timescale=None, chain_length=None, sampling_frequency=None, pressure_coupling=None, heating_rate=None, compression_rate=None)

The NVT Andersen integrator class which implements the Andersen thermostat.

Parameters:
  • initial_velocity (ConfigurationVelocities | ZeroVelocities | MaxwellBoltzmannDistribution) – A class that implements a distribution of initial velocities for the particles in the MD simulation.
    Default: MaxwellBoltzmannDistribution

  • time_step (PhysicalQuantity of type time) – The time-step interval used in the MD simulation.
    Default: 1 * fs

  • reservoir_temperature (PhysicalQuantity of type temperature) – The reservoir temperature in the simulation.
    Default: 300.0 * Kelvin

  • reservoir_pressure (PhysicalQuantity of type pressure) – The reservoir pressure in the simulation. The pressure can be given as a scalar pressure that acts equally on all coupled dimensions. For diagonal only pressure coupling, the pressure tensor diagonal can be given so that each length is coupled to a different pressure.
    Default: 1.0*bar

  • thermostat_timescale (PhysicalQuantity of type time) – The time constant for Andersen temperature coupling.
    Default: 100.0 * fs

  • chain_length (int) – The number of subsequent Nose-Hoover thermostats. Zero means no thermostat is invoked.
    Default: 3

  • sampling_frequency (int) – The step frequency with which new cell lengths are attempted.
    Default: 25

  • pressure_coupling (list of bool | Isotropic | DiagonalOnly | Anisotropic | None) – Specify the cell dimensions that are coupled to the pressure. Isotropic couples the cell volume to the barostat, scaling cell lengths equally. A list of three booleans can be given to specify the coupling of the diagonal elements of the pressure tensor, with off-diagonal elements not coupled. DiagonalOnly couples all three cell lengths independently to the barostat. Anisotropic couples all cell dimensions to the barostat, allowing the cell to change shape as well as volume during the simulation.
    Default: Isotropic

  • heating_rate (PhysicalQuantity of type temperature/time | None) – The heating rate of the target temperature. A value of None disables the heating of the system.
    Default: None

  • compression_rate (PhysicalQuantity of type pressure/time | None) – The compression rate of the target pressure. A value of None disables pressure coupling.
    Default: None

static getLogInfo(step, time, md_quantities)

Get the log information for the MD step.

Parameters:
  • step (int) – The current MD step.

  • time (PhysicalQuantity of type time) – The current MD time in fs.

  • md_quantities (MDQuantities) – The MD quantities to log.

Returns:

The header rows and the row with the MD information.

Return type:

list of str, str

isotropicCoupling()
Returns:

Whether the barostat applies isotropic or anisotropic pressure coupling.

Return type:

bool

kineticEnergy(configuration)
Parameters:

configuration (DistributedConfiguration) – The current configuration to calculate the kinetic energy of.

Returns:

The kinetic energy of the current configuration.

Return type:

PhysicalQuantity of type energy

kineticEnergyLeapfrog(configuration, forces)
Parameters:
  • configuration (DistributedConfiguration) – The current configuration to calculate the kinetic energy of.

  • forces (PhysicalQuantity of type energy per distance) – The current forces on the configuration.

Returns:

The kinetic energy of the current configuration.

Return type:

PhysicalQuantity of type energy

thermostats()
Returns:

The list of thermostats.

Return type:

list

timeStep()
Returns:

The time step.

Return type:

PhysicalQuantity of type time

uniqueString()

Return a unique string representing the state of the object.

Usage Examples

Do a simple NPT simulation with Andersen barostat

# Set the simulation
atomic_constraints = [FixCenterOfMass()]
method = NPTNoseHooverMonteCarlo(
    time_step=1*fs,
    initial_velocity=ConfigurationVelocities(),
    reservoir_temperature=300*Kelvin,
    reservoir_pressure=1*bar,
    pressure_coupling=Isotropic,
)
simulation = SoftMatterDynamicsSimulation(
    configuration, method, atomic_constraints=atomic_constraints
)

npt_nose_hoover_example.py equilibrated_imide.hdf5

Notes

The NPTNoseHooverMonteCarlo thermostat and barostat combines the NVTNoseHoover thermostat with a Monte Carlo barostat[1]. The barostat samples the NPT ensemble by proposing random changes in the cell dimensions. These are accepted or rejected using the Metropolis criteria based on the change in total enthalpy. Over a longer simulation this effectively samples the NPT ensemble.

The frequency with which cell changes are tried is set with the sampling_frequency argument. By default this is set to perform trial cell changes every 25 dynamics steps. Setting the sampling_frequency to zero means that no cell change moves are attempted, effectively turning off the barostat. This is possible because both the barostat and thermostat are implemented independently. Both barostat and thermostat also share the reservoir_temperature argument. In the barostat the temperature is used to determine the probability of volume change trial moves.

The thermostat_timescale and chain_length arguments, which are specific to the Nose-Hoover thermostat have the same effect as it does for the NVTNoseHoover thermostat.

The configuration can be coupled to the barostat in three different ways. This is controlled with the pressure_coupling argument. Giving the flag Isotropic causes just the overall volume to be coupled to the barostat. Individual cell lengths can be coupled using the flag DiagonalOnly. Specific directions can also be coupled by giving a list of three booleans, which when True indicate that the corresponding direction is to be coupled to the barostat. When individual cell lengths are coupled to the barostat it is also possible to give separate reservoir pressures for each direction. This is done in the reservoir_pressure argument giving a list of three pressures. Finally both the size and shape of the cell can be coupled to the barostat using the flag Anisotropic.

This barostat is only supported in the soft matter dynamics framework, and cannot be used in the general molecular dynamics framework. See the documentation for the SoftMatterDynamicsSimulation object to see which methods are supported in each dynamics framework.