OpenMM
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends
Integrator Class Referenceabstract

An Integrator defines a method for simulating a System by integrating the equations of motion. More...

#include <Integrator.h>

+ Inheritance diagram for Integrator:

Public Member Functions

 Integrator ()
 
virtual ~Integrator ()
 
double getStepSize () const
 Get the size of each time step, in picoseconds.
 
void setStepSize (double size)
 Set the size of each time step, in picoseconds.
 
double getConstraintTolerance () const
 Get the distance tolerance within which constraints are maintained, as a fraction of the constrained distance.
 
void setConstraintTolerance (double tol)
 Set the distance tolerance within which constraints are maintained, as a fraction of the constrained distance.
 
virtual void step (int steps)=0
 Advance a simulation through time by taking a series of time steps.
 

Protected Member Functions

virtual void initialize (ContextImpl &context)=0
 This will be called by the Context when it is created.
 
virtual void cleanup ()
 This will be called by the Context when it is destroyed to let the Integrator do any necessary cleanup.
 
virtual std::vector< std::string > getKernelNames ()=0
 Get the names of all Kernels used by this Integrator.
 
virtual void stateChanged (State::DataType changed)
 This will be called by the Context when the user modifies aspects of the context state, such as positions, velocities, or parameters.
 
virtual double computeKineticEnergy ()=0
 Compute the kinetic energy of the system at the current time.
 

Protected Attributes

ContextImplcontext
 
Contextowner
 

Friends

class Context
 
class ContextImpl
 

Detailed Description

An Integrator defines a method for simulating a System by integrating the equations of motion.

This is an abstract class. Subclasses define particular integration methods.

Each Integrator object is bound to a particular Context which it integrates. This connection is specified by passing the Integrator as an argument to the constructor of the Context.

Constructor & Destructor Documentation

virtual ~Integrator ( )
virtual

Member Function Documentation

virtual void cleanup ( )
inlineprotectedvirtual

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 in CustomIntegrator, VariableLangevinIntegrator, BrownianIntegrator, LangevinIntegrator, VariableVerletIntegrator, and VerletIntegrator.

virtual double computeKineticEnergy ( )
protectedpure virtual

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

This may be different from simply mv2/2. For example, a leapfrog integrator will store velocities offset by half a step, but the kinetic energy should be computed at the current time, not delayed by half a step.

Implemented in CustomIntegrator, VariableLangevinIntegrator, BrownianIntegrator, LangevinIntegrator, VariableVerletIntegrator, and VerletIntegrator.

double getConstraintTolerance ( ) const
inline

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

virtual std::vector<std::string> getKernelNames ( )
protectedpure virtual
double getStepSize ( ) const
inline

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
virtual void initialize ( ContextImpl context)
protectedpure virtual

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.

Implemented in CustomIntegrator, VariableLangevinIntegrator, BrownianIntegrator, LangevinIntegrator, VariableVerletIntegrator, and VerletIntegrator.

void setConstraintTolerance ( double  tol)
inline

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

void setStepSize ( double  size)
inline

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
sizethe step size, measured in ps
virtual void stateChanged ( State::DataType  changed)
inlineprotectedvirtual

This will be called by the Context when the user modifies aspects of the context state, such as positions, velocities, or parameters.

This gives the Integrator a chance to discard cached information. This is only called when the user modifies information using methods of the Context object. It is not called when a ForceImpl object modifies state information in its updateContextState() method (unless the ForceImpl calls a Context method to perform the modification).

Parameters
changedthis specifies what aspect of the Context was changed

Reimplemented in CustomIntegrator.

virtual void step ( int  steps)
pure virtual

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

Parameters
stepsthe number of time steps to take

Implemented in CustomIntegrator, VariableLangevinIntegrator, BrownianIntegrator, LangevinIntegrator, VariableVerletIntegrator, and VerletIntegrator.

Friends And Related Function Documentation

friend class Context
friend
friend class ContextImpl
friend

Member Data Documentation

ContextImpl* context
protected
Context* owner
protected

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