RPMDIntegrator

class openmm.openmm.RPMDIntegrator(*args)

This is an Integrator which simulates a System using ring polymer molecular dynamics (RPMD). It simulates many copies of the System, with successive copies connected by harmonic springs to form a ring. This allows certain quantum mechanical effects to be efficiently simulated.

By default this Integrator applies a PILE thermostat to the system to simulate constant temperature dynamics. You can disable the thermostat by calling setApplyThermostat(false).

Because this Integrator simulates many copies of the System at once, it must be used differently from other Integrators. Instead of setting positions and velocities by calling methods of the Context, you should use the corresponding methods of the Integrator to set them for specific copies of the System. Similarly, you should retrieve state information for particular copies by calling getState() on the Integrator. Do not query the Context for state information.

You can optionally specify a set of “ring polymer contractions”, by which different force groups are evaluated on different numbers of copies, instead of computing every force on every copy. This can be much more efficient, since different forces may vary widely in how many times they must be evaluated to produce sufficient accuracy. For example, you might simulate a 32 copy ring polymer and evaluate bonded forces on every copy, but contract it down to only 6 copies for computing nonbonded interactions, and down to only a single copy (the centroid) for computing the reciprocal space part of PME.

__init__(self, numCopies, temperature, frictionCoeff, stepSize)RPMDIntegrator
__init__(self, numCopies, temperature, frictionCoeff, stepSize, contractions)RPMDIntegrator
__init__(self, other)RPMDIntegrator

Create a RPMDIntegrator.

Parameters
  • numCopies (int) – the number of copies of the system that should be simulated

  • temperature (double) – the temperature of the heat bath (in Kelvin)

  • frictionCoeff (double) – the friction coefficient which couples the system to the heat bath (in inverse picoseconds)

  • stepSize (double) – the step size with which to integrator the system (in picoseconds)

  • contractions (map< int, int >) – the ring polymer contractions to use for evaluating different force groups. Each key in the map is the index of a force group, and the corresponding value is the number of copies to evaluate that force group on. If no entry is provided for a force group (the default), it is evaluated independently on every copy.

Methods

__init__(-> RPMDIntegrator  -> RPMDIntegrator)

Create a RPMDIntegrator.

getApplyThermostat(self)

Get whether a thermostat is applied to the system.

getConstraintTolerance(self)

Get the distance tolerance within which constraints are maintained, as a fraction of the constrained distance.

getContractions(self)

Get the ring polymer contractions to use for evaluating different force groups.

getFriction(self)

Get the friction coefficient which determines how strongly the system is coupled to the heat bath (in inverse ps).

getIntegrationForceGroups(self)

Get which force groups to use for integration.

getNumCopies(self)

Get the number of copies of the system being simulated.

getRandomNumberSeed(self)

Get the random number seed.

getState(copy[, getPositions, …])

Get a State object recording the current state information about one copy of the system.

getStepSize(self)

Get the size of each time step, in picoseconds.

getTemperature(self)

Get the temperature of the heat bath (in Kelvin).

getTotalEnergy(self)

Get the total energy of the ring polymer.

setApplyThermostat(self, apply)

Set whether a thermostat is applied to the system.

setConstraintTolerance(self, tol)

Set the distance tolerance within which constraints are maintained, as a fraction of the constrained distance.

setFriction(self, coeff)

Set the friction coefficient which determines how strongly the system is coupled to the heat bath (in inverse ps).

setIntegrationForceGroups(groups)

Set which force groups to use for integration.

setPositions(self, copy, positions)

Set the positions of all particles in one copy of the system.

setRandomNumberSeed(self, seed)

Set the random number seed.

setStepSize(self, size)

Set the size of each time step, in picoseconds.

setTemperature(self, temp)

Set the temperature of the heat bath (in Kelvin).

setVelocities(self, copy, velocities)

Get the velocities of all particles in one copy of the system.

step(self, steps)

Advance a simulation through time by taking a series of time steps.

Attributes

thisown

The membership flag

property thisown

The membership flag

getNumCopies(self)int

Get the number of copies of the system being simulated.

getTemperature(self)double

Get the temperature of the heat bath (in Kelvin).

Returns

the temperature of the heat bath, measured in Kelvin

Return type

double

setTemperature(self, temp)

Set the temperature of the heat bath (in Kelvin).

Parameters

temp (double) – the temperature of the heat bath, measured in Kelvin

getFriction(self)double

Get the friction coefficient which determines how strongly the system is coupled to the heat bath (in inverse ps).

Returns

the friction coefficient, measured in 1/ps

Return type

double

setFriction(self, coeff)

Set the friction coefficient which determines how strongly the system is coupled to the heat bath (in inverse ps).

Parameters

coeff (double) – the friction coefficient, measured in 1/ps

getApplyThermostat(self)bool

Get whether a thermostat is applied to the system.

setApplyThermostat(self, apply)

Set whether a thermostat is applied to the system.

getRandomNumberSeed(self)int

Get the random number seed. See setRandomNumberSeed() for details.

setRandomNumberSeed(self, seed)

Set the random number seed. The precise meaning of this parameter is undefined, and is left up to each Platform to interpret in an appropriate way. It is guaranteed that if two simulations are run with different random number seeds, the sequence of random forces will be different. On the other hand, no guarantees are made about the behavior of simulations that use the same seed. In particular, Platforms are permitted to use non-deterministic algorithms which produce different results on successive runs, even if those runs were initialized identically.

If seed is set to 0 (which is the default value assigned), a unique seed is chosen when a Context is created from this Force. This is done to ensure that each Context receives unique random seeds without you needing to set them explicitly.

getContractions(self)mapii

Get the ring polymer contractions to use for evaluating different force groups. Each key in the map is the index of a force group, and the corresponding value is the number of copies to evaluate that force group on. If no entry is provided for a force group, it is evaluated independently on every copy.

setPositions(self, copy, positions)

Set the positions of all particles in one copy of the system.

Parameters
  • copy (int) – the index of the copy for which to set positions

  • positions (vector< Vec3 >) – the positions of all particles in the system

setVelocities(self, copy, velocities)

Get the velocities of all particles in one copy of the system.

Parameters
  • copy (int) – the index of the copy for which to set velocities

  • velocities (vector< Vec3 >) – the velocities of all particles in the system

getTotalEnergy(self)double

Get the total energy of the ring polymer. This includes the potential and kinetic energies of all copies, plus the potential energy of the harmonic springs that link copies together.

step(self, steps)

Advance a simulation through time by taking a series of time steps.

Parameters

steps (int) – the number of time steps to take

getState(copy, getPositions=False, getVelocities=False, getForces=False, getEnergy=False, getParameters=False, getParameterDerivatives=False, enforcePeriodicBox=False, groups=- 1)

Get a State object recording the current state information about one copy of the system.

Parameters
  • copy (int) – the index of the copy for which to retrieve state information

  • getPositions (bool=False) – whether to store particle positions in the State

  • getVelocities (bool=False) – whether to store particle velocities in the State

  • getForces (bool=False) – whether to store the forces acting on particles in the State

  • getEnergy (bool=False) – whether to store potential and kinetic energy in the State

  • getParameters (bool=False) – whether to store context parameters in the State

  • getParameterDerivatives (bool=False) – whether to store parameter derivatives in the State

  • enforcePeriodicBox (bool=False) – if false, the position of each particle will be whatever position is stored in the Context, regardless of periodic boundary conditions. If true, particle positions will be translated so the center of every molecule lies in the same periodic box.

  • groups (set={0,1,2,...,31}) – a set of indices for which force groups to include when computing forces and energies. The default value includes all groups. groups can also be passed as an unsigned integer interpreted as a bitmask, in which case group i will be included if (groups&(1<<i)) != 0.

getConstraintTolerance(self)double

Get the distance tolerance within which constraints are maintained, as a fraction of the constrained distance.

getIntegrationForceGroups(self)int

Get which force groups to use for integration. By default, all force groups are included. This is interpreted as a set of bit flags: the forces from group i will be included if (groups&(1<<i)) != 0.

getStepSize(self)double

Get the size of each time step, in picoseconds. If this integrator uses variable time steps, the size of the most recent step is returned.

Returns

the step size, measured in ps

Return type

double

setConstraintTolerance(self, tol)

Set the distance tolerance within which constraints are maintained, as a fraction of the constrained distance.

setIntegrationForceGroups(groups)

Set which force groups to use for integration. By default, all force groups are included.

Parameters

groups (set or int) – a set of indices for which force groups to include when integrating the equations of motion. Alternatively, the groups can be passed as a single unsigned integer interpreted as a bitmask, in which case group i will be included if (groups&(1<<i)) != 0.

setStepSize(self, size)

Set the size of each time step, in picoseconds. If this integrator uses variable time steps, the effect of calling this method is undefined, and it may simply be ignored.

Parameters

size (double) – the step size, measured in ps