• Docs »
  • OEForceField



This API is currently available in C++ and Python.

class OEForceField : public OEMolFunc1

The OEForceField is an abstract base class. This class defines an interface for the collection of force field components. The OEForceField extends the OEMolFunc1 class to allow this being a collection of multiple components. The collection of components into a force field needs to be done concomitant with one or more OEFFParams derived classes.

The following methods are publicly inherited from OEFunc0:
The following methods are publicly inherited from OEFunc1:
The following methods are publicly inherited from OEMolFunc:
The OEForceField class defines the following public methods:
The following classes derive from this class:


bool Add(OEMolPotential::OEMolFunc1 &f, bool own=false)

This method defines the interface for adding externally declared functions to an OEForceField derived instance. The second argument denotes whether the OEForceField derived instance is to take ownership of the memory occupied by the external function. If ownership is passed, then it would be deleted during destruction of the OEForceField derived class. Any object derived from the OEMolFunc1 may be added using this method. The method returns true if the object of OEMolFunc1 is successfully added. Only one copy of a OEMolFunc1 may be added to an OEForceField instance. Subsequent attempts to add the same function object to already contained in a OEForceField derived class will fail with a return value of false.


bool PrepMol(OEChem::OEMolBase &mol, bool sweep=true, bool warnOK=true) const

Defines interface to prepare a molecule to be used for force field setup (OEMolFunc.Setup). This method internally calls for all contained OEFFParams instances in the OEForceField derived class to perform necessary preparation to enable using those parameters.

The second argument to the method specifies whether a call to OEMolBase.Sweep is allowed during the preparation. By default, sweeping a molecule is allowed by the method. Methods that override OEFFParams.PrepMol may alter the contents of the passed molecule.

Method returns true if preparation is successful, and false otherwise.


bool Remove(OEMolPotential::OEMolFunc1&)

Defines an interface to remove a function previously added to an OEForceField instance. If the function is not contained in the OEForceField instance then the method will return false. If the function is found and removed successfully, then the method will return true.


bool Set(const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &pred,
         unsigned int functype)
bool Set(const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &pred,
         unsigned int functype)
bool Set(const OESystem::OEBinaryPredicate<OEChem::OEAtomBase,
         OEChem::OEAtomBase> &pred, unsigned int functype)
bool Set(const OESystem::OEBinaryPredicate<OEChem::OEBondBase,
         OEChem::OEBondBase> &pred, unsigned int functype)

These methods assigns interaction-control predicates. The first argument is the predicate type to be passed to the interaction component. The second argument is a value or a set of binary OR’ed values taken from the OEFuncType namespace which specifies the intended target for the predicate assignment.

The set method passed on the interaction-control predicates to the appropriate force field components contained. Method returns false if prediate was not set to any of the components contianed by the Force Field.

Set must be called before the Setup for it to be effective.