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

A ForceImpl provides the internal implementation of a Force. More...

#include <ForceImpl.h>

+ Inheritance diagram for ForceImpl:

Public Member Functions

virtual ~ForceImpl ()
 
virtual void initialize (ContextImpl &context)=0
 This is called after the ForceImpl is created and before updateContextState(), calcForces(), or calcEnergy() is called on it.
 
virtual const ForcegetOwner () const =0
 Get the Force object from which this ForceImpl was created.
 
virtual void updateContextState (ContextImpl &context)=0
 This method is called at the beginning of each time step.
 
virtual double calcForcesAndEnergy (ContextImpl &context, bool includeForces, bool includeEnergy, int groups)=0
 Calculate the force on each particle generated by this ForceImpl and/or this ForceImpl's contribution to the potential energy of the system.
 
virtual std::map< std::string,
double > 
getDefaultParameters ()=0
 Get a map containing the default values for all adjustable parameters defined by this ForceImpl.
 
virtual std::vector< std::string > getKernelNames ()=0
 Get the names of all Kernels used by this Force.
 
virtual std::vector< std::pair
< int, int > > 
getBondedParticles () const
 Get pairs of particles connected by bonds by this force.
 

Detailed Description

A ForceImpl provides the internal implementation of a Force.

When a Context is created for a System, it creates a ForceImpl for each Force in the System. The ForceImpl is permitted to cache information from the Force or System which is needed to apply the force efficiently. If the user calls reinitialize() on the Context, all ForceImpl objects it had previously created are deleted and recreated from scratch.

This is an abstract class. Each Force subclass is responsible for defining its own ForceImpl subclass.

Constructor & Destructor Documentation

virtual ~ForceImpl ( )
inlinevirtual

Member Function Documentation

virtual double calcForcesAndEnergy ( ContextImpl context,
bool  includeForces,
bool  includeEnergy,
int  groups 
)
pure virtual

Calculate the force on each particle generated by this ForceImpl and/or this ForceImpl's contribution to the potential energy of the system.

Parameters
contextthe context in which the system is being simulated
includeForcestrue if forces should be calculated
includeEnergytrue if the energy should be calculated
groupsa set of bit flags for which force groups to include. Group i should be included if (groups&(1<<i)) != 0.
Returns
this force's contribution to the potential energy of the system, or 0 if this force does not contribute to potential energy (or if includeEnergy is false)

Implemented in GBVIForceImpl, CustomCompoundBondForceImpl, CustomHbondForceImpl, NonbondedForceImpl, CustomNonbondedForceImpl, CustomAngleForceImpl, CustomBondForceImpl, CustomExternalForceImpl, CustomGBForceImpl, CustomTorsionForceImpl, HarmonicAngleForceImpl, HarmonicBondForceImpl, PeriodicTorsionForceImpl, RBTorsionForceImpl, CMAPTorsionForceImpl, AndersenThermostatImpl, GBSAOBCForceImpl, MonteCarloAnisotropicBarostatImpl, MonteCarloBarostatImpl, and CMMotionRemoverImpl.

virtual std::vector<std::pair<int, int> > getBondedParticles ( ) const
inlinevirtual

Get pairs of particles connected by bonds by this force.

This is used to determine which particles are part of the same molecule.

Reimplemented in HarmonicBondForceImpl, and CustomBondForceImpl.

virtual std::map<std::string, double> getDefaultParameters ( )
pure virtual
virtual void updateContextState ( ContextImpl context)
pure virtual

This method is called at the beginning of each time step.

It give the ForceImpl a chance to modify the state variables (positions, velocities, and parameters) stored in the Context in arbitrary ways before integration is performed.

Parameters
contextthe context in which the system is being simulated

Implemented in GBVIForceImpl, CustomCompoundBondForceImpl, CustomHbondForceImpl, NonbondedForceImpl, CustomNonbondedForceImpl, CustomAngleForceImpl, CustomBondForceImpl, CustomExternalForceImpl, CustomGBForceImpl, CustomTorsionForceImpl, HarmonicAngleForceImpl, HarmonicBondForceImpl, PeriodicTorsionForceImpl, RBTorsionForceImpl, AndersenThermostatImpl, CMAPTorsionForceImpl, MonteCarloAnisotropicBarostatImpl, MonteCarloBarostatImpl, GBSAOBCForceImpl, and CMMotionRemoverImpl.


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