OpenMM
CompoundIntegrator Class Reference

This class allows you to use multiple integration algorithms within a single simulation, switching back and forth between them. More...

+ Inheritance diagram for CompoundIntegrator:

List of all members.

Public Member Functions

def getNumIntegrators
 getNumIntegrators(self) -> int
def addIntegrator
 addIntegrator(self, integrator) -> int
def getIntegrator
 getIntegrator(self, index) -> Integrator getIntegrator(self, index) -> Integrator
def getCurrentIntegrator
 getCurrentIntegrator(self) -> int
def setCurrentIntegrator
 Set the current Integrator.
def getStepSize
 getStepSize(self) -> double
def setStepSize
 Set the size of each time step, in picoseconds.
def getConstraintTolerance
 getConstraintTolerance(self) -> double
def setConstraintTolerance
 Set the distance tolerance within which constraints are maintained, as a fraction of the constrained distance.
def step
 Advance a simulation through time by taking a series of time steps.
def __init__
 __init__(self) -> CompoundIntegrator __init__(self, other) -> CompoundIntegrator

Public Attributes

 this

Detailed Description

This class allows you to use multiple integration algorithms within a single simulation, switching back and forth between them.

To use it, create whatever other Integrators you need, then add all of them to a CustomIntegrator:

 CompoundIntegrator compoundIntegrator;
 compoundIntegrator.addIntegrator(new VerletIntegrator(0.001));
 compoundIntegrator.addIntegrator(new LangevinIntegrator(300.0, 1.0, 0.001));
 

Next create a Context, specifying the CompoundIntegrator as the Integrator to use for the Context:

 Context context(system, compoundIntegrator);
 

Finally, call setCurrentIntegrator() to set which Integrator is active. That one will be used for all calls to step() until the next time you change it.

 compoundIntegrator.setCurrentIntegrator(0);
 compoundIntegrator.step(1000); // Take 1000 steps of Verlet dynamics
 compoundIntegrator.setCurrentIntegrator(1);
 compoundIntegrator.step(1000); // Take 1000 steps of Langevin dynamics
 

When switching between integrators, it is important to make sure they are compatible with each other, and that they will interpret the positions and velocities in the same way. Remember that leapfrog style integrators assume the positions and velocities are offset from each other by half a time step. When switching between a leapfrog and non-leapfrog integrator, you must first adjust the velocities to avoid introducing error. This is also true when switching between two leapfrog integrators that use different step sizes, since they will interpret the velocities as corresponding to different times.


Constructor & Destructor Documentation

def __init__ (   self,
  args 
)

__init__(self) -> CompoundIntegrator __init__(self, other) -> CompoundIntegrator

Create a CompoundIntegrator.


Member Function Documentation

def addIntegrator (   self,
  integrator 
)

addIntegrator(self, integrator) -> int

Add an Integrator to this CompoundIntegrator. The Integrator object should have been created on the heap with the "new" operator. The CompoundIntegrator takes over ownership of it, and deletes it when the CompoundIntegrator itself is deleted. All Integrators must be added before the Context is created.

Parameters:
integrator(Integrator *) the Integrator to add
Returns:
(int) the index of the Integrator that was added
def getConstraintTolerance (   self)

getConstraintTolerance(self) -> double

Get the distance tolerance within which constraints are maintained, as a fraction of the constrained distance. This method calls getConstraintTolerance() on whichever Integrator has been set as current.

Reimplemented from Integrator.

def getCurrentIntegrator (   self)

getCurrentIntegrator(self) -> int

Get the index of the current Integrator.

def getIntegrator (   self,
  args 
)

getIntegrator(self, index) -> Integrator getIntegrator(self, index) -> Integrator

Get a const reference to one of the Integrators that have been added to this CompoundIntegrator.

Parameters:
index(int) the index of the Integrator to get
def getNumIntegrators (   self)

getNumIntegrators(self) -> int

Get the number of Integrators that have been added to this CompoundIntegrator.

def getStepSize (   self)

getStepSize(self) -> double

Get the size of each time step, in picoseconds. This method calls getStepSize() on whichever Integrator has been set as current.

Returns:
(double) the step size, measured in ps

Reimplemented from Integrator.

def setConstraintTolerance (   self,
  tol 
)

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

This method calls setConstraintTolerance() on whichever Integrator has been set as current.

Reimplemented from Integrator.

def setCurrentIntegrator (   self,
  index 
)

Set the current Integrator.

Parameters:
index(int) the index of the Integrator to use
def setStepSize (   self,
  size 
)

Set the size of each time step, in picoseconds.

This method calls setStepSize() on whichever Integrator has been set as current.

Parameters:
size(double) the step size, measured in ps

Reimplemented from Integrator.

def step (   self,
  steps 
)

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

This method calls step() on whichever Integrator has been set as current.

Parameters:
steps(int) the number of time steps to take

Reimplemented from Integrator.


Member Data Documentation

Reimplemented from Integrator.


The documentation for this class was generated from the following file:
 All Classes Functions Variables