class OEMolPotential::OEGenericFF : public OEMolPotential::OEForceField
The OEGenericFF class is designed to be a generic force field
collection object. Force fields can be implemented as a collection of
interaction components (i.e. bond-stretch, Van der Waals). If
components are implemented correctly, a force field itself need only
be a simple collection object which ties together components and
possibly a parameter (OEFFParams) class instance. The
OEGenericFF class provides a general mechanism for defining
force fields from interaction components.
OEGenericFF()
Default constructor.
double operator()(const double *coord) double operator()(const double *coord, double *grad)
These methods perform an energy evaluation given a set of Cartesian coordinates for a molecule or conformer. In addition, the second of the two methods populates an array of gradients given a set of coordinates. The gradient array must be initialized before the call to the method, although this is normally performed by an optimizer (Section 3.18). The first three elements of the gradient array are the X, Y, and Z gradients for the first atom in the molecule, followed by the X, Y, and Z gradients of the second atom and so on up to the last atom.
bool Add(OEMolPotential::OEMolFunc1 &f,bool own=false)
This method adds an externally declared function to an
OEGenericFF instance. This method will never replace an
existing molecule function. The second argument denotes whether the
OEGenericFF instance is to take ownership of the memory
occupied by the external function. If ownership is passed to the
OEGenericFF instance then the C++ delete operator will be
called for the function inside the destructor of the
OEGenericFF instance. Any object derived from the OEMolFunc1
(Section 3.15) abstract class may be added using this
method. The method returns true if the OEMolFunc1 is
successfully added. Only one copy of a OEMolFunc1 may be added
to an OEGenericFF instance. Subsequent attempts to add the
OEMolFunc1 to an OEGenericFF instance that already
contains the OEMolFunc1 will fail with a return value of false.
bool Add(const OEFFParams &ffp)
This method adds a copy of externally declared OEFFParams
derived class to an internally stored list. The
OEGenericFF::PrepMol method will call
OEFFParams::PrepMol for each internally stored
OEFFParams instance.
OESystem::OEIterBase<OEOpt::OEFComponent> *GetFComponents(const double *coord)
This method takes a pointer to a set of Cartesian coordinates, and returns an iterator over the names and component energies (Section 3.4) calculated for the coordinates.
unsigned int NumVar() const
This method returns the number of variables for which an
OEGenericFF instance has been initialized using the
OEGenericFF::Setup method. The value is normally equivalent to
three times OEMolBase::GetMaxAtomIdx().
bool Remove(OEMolPotential::OEMolFunc1 &f)
The Remove method provides the ablity to remove a function
previously added to an OEGenericFF instance. If the function
is not contained in the OEGenericFF instance then the method
will return false. If the OEMolFunc1 found and removed
successfully, then the method will return true. If an
OEMolFunc1 is owned by the OEGenericFF instance for
which the method was called, then the OEMolFunc1's delete
operator will be called.
bool Set(const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &pred,
unsigned int functype)
bool Set(const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &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 assign interaction-control predicates to the components
contained in the OEGenericFF instance. 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.
bool Setup(const OEChem::OEMolBase &mol)
This method prepares an OEGenericFF instance for perfoming
energy and gradient calculations for conformers of a molecule. The
OEMolFunc1::Setup methods are called for all functions
contained within the OEGenericFF instance. This method should
only be called after the molecule has been prepared by the
OEGenericFF::PrepMol method. If the method returns true then
all interactions and parameters were perceived properly and the
OEGenericFF instance is ready for energy calculations. If the
method returns false then a failure was detected. Setup failures
normally occur when at least one interaction requires parameters which
are not defined for the force field. The return value for this method
should always be verified prior to calling either
OEGenericFF::operator() method.
bool PrepMol(OEChem::OEMolBase &mol,bool sweep = true) const
The PrepMol method calls the OEFFParams::PrepMol methods
for all contained OEFFParams instances. The
OEFFParams::PrepMol method applied changes to the molecule
passed as the function argument that are necessary preparation for
force field setup (OEMolFunc1::Setup). The PrepMol
method may alter the contents of the passed molecule. 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. If all
OEFFParams::PrepMol methods return true then
OEGenericFF::PrepMol will return true. If any
OEFFParams::PrepMol method returns false then
OEGenericFF::PrepMol will return false.