OpenMM
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
RPMDIntegrator Class Reference

This is an Integrator which simulates a System using ring polymer molecular dynamics (RPMD). More...

#include <RPMDIntegrator.h>

+ Inheritance diagram for RPMDIntegrator:

Public Member Functions

 RPMDIntegrator (int numCopies, double temperature, double frictionCoeff, double stepSize)
 Create a RPMDIntegrator. More...
 
 RPMDIntegrator (int numCopies, double temperature, double frictionCoeff, double stepSize, const std::map< int, int > &contractions)
 Create a RPMDIntegrator. More...
 
int getNumCopies () const
 Get the number of copies of the system being simulated. More...
 
double getTemperature () const
 Get the temperature of the heat bath (in Kelvin). More...
 
void setTemperature (double temp)
 Set the temperature of the heat bath (in Kelvin). More...
 
double getFriction () const
 Get the friction coefficient which determines how strongly the system is coupled to the heat bath (in inverse ps). More...
 
void setFriction (double coeff)
 Set the friction coefficient which determines how strongly the system is coupled to the heat bath (in inverse ps). More...
 
bool getApplyThermostat () const
 Get whether a thermostat is applied to the system. More...
 
void setApplyThermostat (bool apply)
 Set whether a thermostat is applied to the system. More...
 
int getRandomNumberSeed () const
 Get the random number seed. More...
 
void setRandomNumberSeed (int seed)
 Set the random number seed. More...
 
const std::map< int, int > & getContractions () const
 Get the ring polymer contractions to use for evaluating different force groups. More...
 
void setPositions (int copy, const std::vector< Vec3 > &positions)
 Set the positions of all particles in one copy of the system. More...
 
void setVelocities (int copy, const std::vector< Vec3 > &velocities)
 Get the velocities of all particles in one copy of the system. More...
 
State getState (int copy, int types, bool enforcePeriodicBox=false, int groups=0xFFFFFFFF)
 Get a State object recording the current state information about one copy of the system. More...
 
void step (int steps)
 Advance a simulation through time by taking a series of time steps. More...
 
- Public Member Functions inherited from Integrator
 Integrator ()
 
virtual ~Integrator ()
 
double getStepSize () const
 Get the size of each time step, in picoseconds. More...
 
void setStepSize (double size)
 Set the size of each time step, in picoseconds. More...
 
double getConstraintTolerance () const
 Get the distance tolerance within which constraints are maintained, as a fraction of the constrained distance. More...
 
void setConstraintTolerance (double tol)
 Set the distance tolerance within which constraints are maintained, as a fraction of the constrained distance. More...
 

Protected Member Functions

void initialize (ContextImpl &context)
 This will be called by the Context when it is created. More...
 
void cleanup ()
 This will be called by the Context when it is destroyed to let the Integrator do any necessary cleanup. More...
 
void stateChanged (State::DataType changed)
 When the user modifies the state, we need to mark that the forces need to be recalculated. More...
 
std::vector< std::string > getKernelNames ()
 Get the names of all Kernels used by this Integrator. More...
 
double computeKineticEnergy ()
 Compute the kinetic energy of the system at the current time. More...
 

Additional Inherited Members

- Protected Attributes inherited from Integrator
ContextImplcontext
 
Contextowner
 

Detailed Description

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.

Constructor & Destructor Documentation

RPMDIntegrator ( int  numCopies,
double  temperature,
double  frictionCoeff,
double  stepSize 
)

Create a RPMDIntegrator.

Parameters
numCopiesthe number of copies of the system that should be simulated
temperaturethe temperature of the heat bath (in Kelvin)
frictionCoeffthe friction coefficient which couples the system to the heat bath (in inverse picoseconds)
stepSizethe step size with which to integrator the system (in picoseconds)
RPMDIntegrator ( int  numCopies,
double  temperature,
double  frictionCoeff,
double  stepSize,
const std::map< int, int > &  contractions 
)

Create a RPMDIntegrator.

Parameters
numCopiesthe number of copies of the system that should be simulated
temperaturethe temperature of the heat bath (in Kelvin)
frictionCoeffthe friction coefficient which couples the system to the heat bath (in inverse picoseconds)
stepSizethe step size with which to integrator the system (in picoseconds)
contractionsthe 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.

Member Function Documentation

void cleanup ( )
protectedvirtual

This will be called by the Context when it is destroyed to let the Integrator do any necessary cleanup.

It will also get called again if the application calls reinitialize() on the Context.

Reimplemented from Integrator.

double computeKineticEnergy ( )
protectedvirtual

Compute the kinetic energy of the system at the current time.

Implements Integrator.

bool getApplyThermostat ( ) const
inline

Get whether a thermostat is applied to the system.

const std::map<int, int>& getContractions ( ) const
inline

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.

double getFriction ( ) const
inline

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
std::vector<std::string> getKernelNames ( )
protectedvirtual

Get the names of all Kernels used by this Integrator.

Implements Integrator.

int getNumCopies ( ) const
inline

Get the number of copies of the system being simulated.

int getRandomNumberSeed ( ) const
inline

Get the random number seed.

See setRandomNumberSeed() for details.

State getState ( int  copy,
int  types,
bool  enforcePeriodicBox = false,
int  groups = 0xFFFFFFFF 
)

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

Parameters
copythe index of the copy for which to retrieve state information
typesthe set of data types which should be stored in the State object. This should be a union of DataType values, e.g. (State::Positions | State::Velocities).
enforcePeriodicBoxif false, the position of each particle will be whatever position is stored by the integrator, regardless of periodic boundary conditions. If true, particle positions will be translated so the center of every molecule lies in the same periodic box.
groupsa set of bit flags for which force groups to include when computing forces and energies. Group i will be included if (groups&(1<<i)) != 0. The default value includes all groups.
double getTemperature ( ) const
inline

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

Returns
the temperature of the heat bath, measured in Kelvin
void initialize ( ContextImpl context)
protectedvirtual

This will be called by the Context when it is created.

It informs the Integrator of what context it will be integrating, and gives it a chance to do any necessary initialization. It will also get called again if the application calls reinitialize() on the Context.

Implements Integrator.

void setApplyThermostat ( bool  apply)
inline

Set whether a thermostat is applied to the system.

void setFriction ( double  coeff)
inline

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

Parameters
coeffthe friction coefficient, measured in 1/ps
void setPositions ( int  copy,
const std::vector< Vec3 > &  positions 
)

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

Parameters
copythe index of the copy for which to set positions
positionsthe positions of all particles in the system
void setRandomNumberSeed ( int  seed)
inline

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.

void setTemperature ( double  temp)
inline

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

Parameters
tempthe temperature of the heat bath, measured in Kelvin
void setVelocities ( int  copy,
const std::vector< Vec3 > &  velocities 
)

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

Parameters
copythe index of the copy for which to set velocities
velocitiesthe velocities of all particles in the system
void stateChanged ( State::DataType  changed)
protectedvirtual

When the user modifies the state, we need to mark that the forces need to be recalculated.

Reimplemented from Integrator.

void step ( int  steps)
virtual

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

Parameters
stepsthe number of time steps to take

Implements Integrator.


The documentation for this class was generated from the following file: