All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Force Class Referenceabstract

Force objects apply forces to the particles in a System, or alter their behavior in other ways. More...

`#include <Force.h>`

Inheritance diagram for Force:

## Public Member Functions

| Force ()
virtual | ~Force ()
int | getForceGroup () const
| Get the force group this Force belongs to. More...
void | setForceGroup (int group)
| Set the force group this Force belongs to. More...
virtual bool | usesPeriodicBoundaryConditions () const
| Returns whether or not this force makes use of periodic boundary conditions. More...

## Protected Member Functions

virtual ForceImpl * | createImpl () const =0
| When a Context is created, it invokes this method on each Force in the System. More...
ForceImpl & | getImplInContext (Context &context)
| Get the ForceImpl corresponding to this Force in a Context. More...
ContextImpl & | getContextImpl (Context &context)
| Get the ContextImpl corresponding to a Context. More...

## Friends

class | ContextImpl

## Detailed Description

Force objects apply forces to the particles in a System, or alter their behavior in other ways.

This is an abstract class. Subclasses define particular forces.

More specifically, a Force object can do any or all of the following:

- Add a contribution to the force on each particle
- Add a contribution to the potential energy of the System
- Modify the positions and velocities of particles at the start of each time step
- Define parameters which are stored in the Context and can be modified by the user
- Change the values of parameters defined by other Force objects at the start of each time step

Forces may be organized into "force groups". This is used for multiple time step integration, and allows subsets of the Forces in a System to be evaluated at different times. By default, all Forces are in group 0. Call setForceGroup() to change this. Some Force subclasses may provide additional methods to further split their computations into multiple groups. Be aware that particular Platforms may place restrictions on the use of force groups, such as requiring all nonbonded forces to be in the same group.

## Constructor & Destructor Documentation

Force | ( |  | ) |

inline

virtual ~Force | ( |  | ) |

inlinevirtual

## Member Function Documentation

virtual ForceImpl* createImpl | ( |  | ) | const

protectedpure virtual

When a Context is created, it invokes this method on each Force in the System.

It should create a new ForceImpl object which can be used by the context for calculating forces. The ForceImpl will be deleted automatically when the Context is deleted.

Implemented in CustomGBForce, CustomNonbondedForce, CustomManyParticleForce, CustomHbondForce, NonbondedForce, AmoebaMultipoleForce, CustomCompoundBondForce, GBVIForce, MonteCarloMembraneBarostat, AmoebaVdwForce, CustomTorsionForce, CustomAngleForce, CustomBondForce, CustomExternalForce, GBSAOBCForce, MonteCarloAnisotropicBarostat, AmoebaInPlaneAngleForce, AmoebaAngleForce, AmoebaGeneralizedKirkwoodForce, AmoebaOutOfPlaneBendForce, DrudeForce, CMAPTorsionForce, AmoebaBondForce, AmoebaTorsionTorsionForce, MonteCarloBarostat, AndersenThermostat, AmoebaWcaDispersionForce, AmoebaStretchBendForce, RBTorsionForce, RPMDMonteCarloBarostat, AmoebaPiTorsionForce, PeriodicTorsionForce, HarmonicAngleForce, HarmonicBondForce, and CMMotionRemover.

ContextImpl& getContextImpl | ( | Context & | context | ) |

protected

Get the ContextImpl corresponding to a Context.

int getForceGroup | ( |  | ) | const

Get the force group this Force belongs to.

ForceImpl& getImplInContext | ( | Context & | context | ) |

protected

Get the ForceImpl corresponding to this Force in a Context.

void setForceGroup | ( | int | group | ) |

Set the force group this Force belongs to.

Parameters

  group | the group index. Legal values are between 0 and 31 (inclusive).

virtual bool usesPeriodicBoundaryConditions | ( |  | ) | const

virtual

Returns whether or not this force makes use of periodic boundary conditions.

This method should be overridden for all Force subclasses, or a OpenMM::OpenMMException will be thrown

Returns
  true if Force uses periodic boundaries or false if it does not

Reimplemented in CustomGBForce, CustomNonbondedForce, CustomManyParticleForce, CustomHbondForce, NonbondedForce, AmoebaMultipoleForce, CustomCompoundBondForce, GBVIForce, MonteCarloMembraneBarostat, AmoebaVdwForce, CustomTorsionForce, CustomAngleForce, CustomBondForce, CustomExternalForce, GBSAOBCForce, MonteCarloAnisotropicBarostat, AmoebaInPlaneAngleForce, AmoebaAngleForce, AmoebaGeneralizedKirkwoodForce, AmoebaOutOfPlaneBendForce, DrudeForce, CMAPTorsionForce, AmoebaBondForce, AmoebaTorsionTorsionForce, MonteCarloBarostat, AndersenThermostat, AmoebaWcaDispersionForce, AmoebaStretchBendForce, RBTorsionForce, RPMDMonteCarloBarostat, AmoebaPiTorsionForce, PeriodicTorsionForce, HarmonicAngleForce, HarmonicBondForce, and CMMotionRemover.

## Friends And Related Function Documentation

friend class ContextImpl

friend

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

- Force.h