# ForceImpl Class Reference

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

`#include <ForceImpl.h>`

Inheritance diagram for ForceImpl:

List of all members.

## 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 Force & | getOwner () 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 | ( |  | ) | `[inline, virtual]`

## 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:

  | context | the context in which the system is being simulated
  | includeForces | true if forces should be calculated
  | includeEnergy | true if the energy should be calculated
  | groups | a 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 AndersenThermostatImpl, CMAPTorsionForceImpl, CMMotionRemoverImpl, CustomAngleForceImpl, CustomBondForceImpl, CustomCompoundBondForceImpl, CustomExternalForceImpl, CustomGBForceImpl, CustomHbondForceImpl, CustomManyParticleForceImpl, CustomNonbondedForceImpl, CustomTorsionForceImpl, GBSAOBCForceImpl, GBVIForceImpl, HarmonicAngleForceImpl, HarmonicBondForceImpl, MonteCarloAnisotropicBarostatImpl, MonteCarloBarostatImpl, MonteCarloMembraneBarostatImpl, NonbondedForceImpl, PeriodicTorsionForceImpl, RBTorsionForceImpl, DrudeForceImpl, AmoebaAngleForceImpl, AmoebaBondForceImpl, AmoebaGeneralizedKirkwoodForceImpl, AmoebaInPlaneAngleForceImpl, AmoebaMultipoleForceImpl, AmoebaOutOfPlaneBendForceImpl, AmoebaPiTorsionForceImpl, AmoebaStretchBendForceImpl, AmoebaTorsionTorsionForceImpl, AmoebaVdwForceImpl, and AmoebaWcaDispersionForceImpl.

virtual std::vector<std::pair<int, int> > getBondedParticles | ( |  | ) | const`[inline, virtual]`

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 CustomBondForceImpl, HarmonicBondForceImpl, DrudeForceImpl, and AmoebaBondForceImpl.

virtual std::map<std::string, double> getDefaultParameters | ( |  | ) | `[pure virtual]`

Get a map containing the default values for all adjustable parameters defined by this ForceImpl.

These parameters and their default values will automatically be added to the Context.

Implemented in AndersenThermostatImpl, CMAPTorsionForceImpl, CMMotionRemoverImpl, CustomAngleForceImpl, CustomBondForceImpl, CustomCompoundBondForceImpl, CustomExternalForceImpl, CustomGBForceImpl, CustomHbondForceImpl, CustomManyParticleForceImpl, CustomNonbondedForceImpl, CustomTorsionForceImpl, GBSAOBCForceImpl, GBVIForceImpl, HarmonicAngleForceImpl, HarmonicBondForceImpl, MonteCarloAnisotropicBarostatImpl, MonteCarloBarostatImpl, MonteCarloMembraneBarostatImpl, NonbondedForceImpl, PeriodicTorsionForceImpl, RBTorsionForceImpl, DrudeForceImpl, AmoebaAngleForceImpl, AmoebaBondForceImpl, AmoebaGeneralizedKirkwoodForceImpl, AmoebaInPlaneAngleForceImpl, AmoebaMultipoleForceImpl, AmoebaOutOfPlaneBendForceImpl, AmoebaPiTorsionForceImpl, AmoebaStretchBendForceImpl, AmoebaTorsionTorsionForceImpl, AmoebaVdwForceImpl, and AmoebaWcaDispersionForceImpl.

virtual std::vector<std::string> getKernelNames | ( |  | ) | `[pure virtual]`

Get the names of all Kernels used by this Force.

Implemented in AndersenThermostatImpl, CMAPTorsionForceImpl, CMMotionRemoverImpl, CustomAngleForceImpl, CustomBondForceImpl, CustomCompoundBondForceImpl, CustomExternalForceImpl, CustomGBForceImpl, CustomHbondForceImpl, CustomManyParticleForceImpl, CustomNonbondedForceImpl, CustomTorsionForceImpl, GBSAOBCForceImpl, GBVIForceImpl, HarmonicAngleForceImpl, HarmonicBondForceImpl, MonteCarloAnisotropicBarostatImpl, MonteCarloBarostatImpl, MonteCarloMembraneBarostatImpl, NonbondedForceImpl, PeriodicTorsionForceImpl, RBTorsionForceImpl, DrudeForceImpl, AmoebaAngleForceImpl, AmoebaBondForceImpl, AmoebaGeneralizedKirkwoodForceImpl, AmoebaInPlaneAngleForceImpl, AmoebaMultipoleForceImpl, AmoebaOutOfPlaneBendForceImpl, AmoebaPiTorsionForceImpl, AmoebaStretchBendForceImpl, AmoebaTorsionTorsionForceImpl, AmoebaVdwForceImpl, and AmoebaWcaDispersionForceImpl.

virtual const Force& getOwner | ( |  | ) | const`[pure virtual]`

Get the Force object from which this ForceImpl was created.

Implemented in AndersenThermostatImpl, CMAPTorsionForceImpl, CMMotionRemoverImpl, CustomAngleForceImpl, CustomBondForceImpl, CustomCompoundBondForceImpl, CustomExternalForceImpl, CustomGBForceImpl, CustomHbondForceImpl, CustomManyParticleForceImpl, CustomNonbondedForceImpl, CustomTorsionForceImpl, GBSAOBCForceImpl, GBVIForceImpl, HarmonicAngleForceImpl, HarmonicBondForceImpl, MonteCarloAnisotropicBarostatImpl, MonteCarloBarostatImpl, MonteCarloMembraneBarostatImpl, NonbondedForceImpl, PeriodicTorsionForceImpl, RBTorsionForceImpl, DrudeForceImpl, AmoebaAngleForceImpl, AmoebaBondForceImpl, AmoebaGeneralizedKirkwoodForceImpl, AmoebaInPlaneAngleForceImpl, AmoebaMultipoleForceImpl, AmoebaOutOfPlaneBendForceImpl, AmoebaPiTorsionForceImpl, AmoebaStretchBendForceImpl, AmoebaTorsionTorsionForceImpl, AmoebaVdwForceImpl, and AmoebaWcaDispersionForceImpl.

virtual void initialize | ( | ContextImpl & | context | ) | `[pure virtual]`

This is called after the ForceImpl is created and before updateContextState(), calcForces(), or calcEnergy() is called on it.

This allows it to do any necessary initialization.

Implemented in AndersenThermostatImpl, CMAPTorsionForceImpl, CMMotionRemoverImpl, CustomAngleForceImpl, CustomBondForceImpl, CustomCompoundBondForceImpl, CustomExternalForceImpl, CustomGBForceImpl, CustomHbondForceImpl, CustomManyParticleForceImpl, CustomNonbondedForceImpl, CustomTorsionForceImpl, GBSAOBCForceImpl, GBVIForceImpl, HarmonicAngleForceImpl, HarmonicBondForceImpl, MonteCarloAnisotropicBarostatImpl, MonteCarloBarostatImpl, MonteCarloMembraneBarostatImpl, NonbondedForceImpl, PeriodicTorsionForceImpl, RBTorsionForceImpl, DrudeForceImpl, AmoebaAngleForceImpl, AmoebaBondForceImpl, AmoebaGeneralizedKirkwoodForceImpl, AmoebaInPlaneAngleForceImpl, AmoebaMultipoleForceImpl, AmoebaOutOfPlaneBendForceImpl, AmoebaPiTorsionForceImpl, AmoebaStretchBendForceImpl, AmoebaTorsionTorsionForceImpl, AmoebaVdwForceImpl, and AmoebaWcaDispersionForceImpl.

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:

  | context | the context in which the system is being simulated

Implemented in AndersenThermostatImpl, CMAPTorsionForceImpl, CMMotionRemoverImpl, CustomAngleForceImpl, CustomBondForceImpl, CustomCompoundBondForceImpl, CustomExternalForceImpl, CustomGBForceImpl, CustomHbondForceImpl, CustomManyParticleForceImpl, CustomNonbondedForceImpl, CustomTorsionForceImpl, GBSAOBCForceImpl, GBVIForceImpl, HarmonicAngleForceImpl, HarmonicBondForceImpl, MonteCarloAnisotropicBarostatImpl, MonteCarloBarostatImpl, MonteCarloMembraneBarostatImpl, NonbondedForceImpl, PeriodicTorsionForceImpl, RBTorsionForceImpl, DrudeForceImpl, AmoebaAngleForceImpl, AmoebaBondForceImpl, AmoebaGeneralizedKirkwoodForceImpl, AmoebaInPlaneAngleForceImpl, AmoebaMultipoleForceImpl, AmoebaOutOfPlaneBendForceImpl, AmoebaPiTorsionForceImpl, AmoebaStretchBendForceImpl, AmoebaTorsionTorsionForceImpl, AmoebaVdwForceImpl, and AmoebaWcaDispersionForceImpl.

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

- ForceImpl.h