Force
¶
-
class Force¶
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.
Subclassed by OpenMM::ATMForce, OpenMM::AmoebaGeneralizedKirkwoodForce, OpenMM::AmoebaMultipoleForce, OpenMM::AmoebaTorsionTorsionForce, OpenMM::AmoebaVdwForce, OpenMM::AmoebaWcaDispersionForce, OpenMM::AndersenThermostat, OpenMM::CMAPTorsionForce, OpenMM::CMMotionRemover, OpenMM::CustomAngleForce, OpenMM::CustomBondForce, OpenMM::CustomCVForce, OpenMM::CustomCentroidBondForce, OpenMM::CustomCompoundBondForce, OpenMM::CustomExternalForce, OpenMM::CustomGBForce, OpenMM::CustomHbondForce, OpenMM::CustomManyParticleForce, OpenMM::CustomNonbondedForce, OpenMM::CustomTorsionForce, OpenMM::DrudeForce, OpenMM::GBSAOBCForce, OpenMM::GayBerneForce, OpenMM::HarmonicAngleForce, OpenMM::HarmonicBondForce, OpenMM::HippoNonbondedForce, OpenMM::MonteCarloAnisotropicBarostat, OpenMM::MonteCarloBarostat, OpenMM::MonteCarloFlexibleBarostat, OpenMM::MonteCarloMembraneBarostat, OpenMM::NonbondedForce, OpenMM::PeriodicTorsionForce, OpenMM::RBTorsionForce, OpenMM::RMSDForce, OpenMM::RPMDMonteCarloBarostat
Public Functions
-
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).
-
const std::string &getName() const¶
Get the name of this Force. This is an arbitrary, user modifiable identifier. By default it equals the class name, but you can change it to anything useful.
-
void setName(const std::string &name)¶
Set the name of this Force. This is an arbitrary, user modifiable identifier. By default it equals the class name, but you can change it to anything useful.
-
virtual bool usesPeriodicBoundaryConditions() const¶
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