29 #ifndef CDPL_FORCEFIELD_MMFF94GRADIENTCALCULATOR_HPP 
   30 #define CDPL_FORCEFIELD_MMFF94GRADIENTCALCULATOR_HPP 
   48         template <
typename ValueType>
 
   63             template <
typename CoordsArray>
 
   66             template <
typename CoordsArray, 
typename GradVector>
 
   67             const ValueType& 
operator()(
const CoordsArray& coords, GradVector& grad);
 
   94             ValueType                    totalEnergy;
 
   95             ValueType                    bondStretchingEnergy;
 
   96             ValueType                    angleBendingEnergy;
 
   97             ValueType                    stretchBendEnergy;
 
   98             ValueType                    outOfPlaneEnergy;
 
   99             ValueType                    torsionEnergy;
 
  100             ValueType                    electrostaticEnergy;
 
  101             ValueType                    vanDerWaalsEnergy;
 
  102             unsigned int                 interactionTypes;
 
  112 template <
typename ValueType>
 
  114     interactionData(0), numAtoms(0), totalEnergy(), bondStretchingEnergy(), angleBendingEnergy(),
 
  115     stretchBendEnergy(), outOfPlaneEnergy(), torsionEnergy(), electrostaticEnergy(),
 
  116     vanDerWaalsEnergy(), interactionTypes(InteractionType::
ALL)
 
  119 template <
typename ValueType>
 
  121     interactionData(&ia_data), numAtoms(num_atoms), totalEnergy(), bondStretchingEnergy(), angleBendingEnergy(),
 
  122     stretchBendEnergy(), outOfPlaneEnergy(), torsionEnergy(), electrostaticEnergy(),
 
  123     vanDerWaalsEnergy(), interactionTypes(InteractionType::
ALL)
 
  126 template <
typename ValueType>
 
  129     interactionTypes = types;
 
  132 template <
typename ValueType>
 
  135     return interactionTypes;
 
  138 template <
typename ValueType>
 
  141     interactionData = &ia_data;
 
  142     numAtoms        = num_atoms;
 
  145 template <
typename ValueType>
 
  146 template <
typename CoordsArray>
 
  149     if (!interactionData) {
 
  150         totalEnergy          = ValueType();
 
  151         bondStretchingEnergy = ValueType();
 
  152         angleBendingEnergy   = ValueType();
 
  153         stretchBendEnergy    = ValueType();
 
  154         outOfPlaneEnergy     = ValueType();
 
  155         torsionEnergy        = ValueType();
 
  156         electrostaticEnergy  = ValueType();
 
  157         vanDerWaalsEnergy    = ValueType();
 
  162     totalEnergy = ValueType();
 
  165         bondStretchingEnergy = calcMMFF94BondStretchingEnergy<ValueType>(interactionData->getBondStretchingInteractions().getElementsBegin(),
 
  166                                                                          interactionData->getBondStretchingInteractions().getElementsEnd(),
 
  168         totalEnergy += bondStretchingEnergy;
 
  171         bondStretchingEnergy = ValueType();
 
  175         angleBendingEnergy = calcMMFF94AngleBendingEnergy<ValueType>(interactionData->getAngleBendingInteractions().getElementsBegin(),
 
  176                                                                      interactionData->getAngleBendingInteractions().getElementsEnd(),
 
  178         totalEnergy += angleBendingEnergy;
 
  181         angleBendingEnergy = ValueType();
 
  184         stretchBendEnergy = calcMMFF94StretchBendEnergy<ValueType>(interactionData->getStretchBendInteractions().getElementsBegin(),
 
  185                                                                    interactionData->getStretchBendInteractions().getElementsEnd(),
 
  187         totalEnergy += stretchBendEnergy;
 
  190         stretchBendEnergy = ValueType();
 
  193         outOfPlaneEnergy = calcMMFF94OutOfPlaneBendingEnergy<ValueType>(interactionData->getOutOfPlaneBendingInteractions().getElementsBegin(),
 
  194                                                                         interactionData->getOutOfPlaneBendingInteractions().getElementsEnd(),
 
  196         totalEnergy += outOfPlaneEnergy;
 
  199         outOfPlaneEnergy = ValueType();
 
  202         torsionEnergy = calcMMFF94TorsionEnergy<ValueType>(interactionData->getTorsionInteractions().getElementsBegin(),
 
  203                                                            interactionData->getTorsionInteractions().getElementsEnd(),
 
  205         totalEnergy += torsionEnergy;
 
  208         torsionEnergy = ValueType();
 
  211         electrostaticEnergy = calcMMFF94ElectrostaticEnergy<ValueType>(interactionData->getElectrostaticInteractions().getElementsBegin(),
 
  212                                                                        interactionData->getElectrostaticInteractions().getElementsEnd(),
 
  214         totalEnergy += electrostaticEnergy;
 
  217         electrostaticEnergy = ValueType();
 
  220         vanDerWaalsEnergy = calcMMFF94VanDerWaalsEnergy<ValueType>(interactionData->getVanDerWaalsInteractions().getElementsBegin(),
 
  221                                                                    interactionData->getVanDerWaalsInteractions().getElementsEnd(),
 
  223         totalEnergy += vanDerWaalsEnergy;
 
  226         vanDerWaalsEnergy = ValueType();
 
  231 template <
typename ValueType>
 
  232 template <
typename CoordsArray, 
typename GradVector>
 
  237     if (!interactionData) {
 
  238         totalEnergy          = ValueType();
 
  239         bondStretchingEnergy = ValueType();
 
  240         angleBendingEnergy   = ValueType();
 
  241         stretchBendEnergy    = ValueType();
 
  242         outOfPlaneEnergy     = ValueType();
 
  243         torsionEnergy        = ValueType();
 
  244         electrostaticEnergy  = ValueType();
 
  245         vanDerWaalsEnergy    = ValueType();
 
  250     totalEnergy = ValueType();
 
  253         bondStretchingEnergy = calcMMFF94BondStretchingGradient<ValueType>(interactionData->getBondStretchingInteractions().getElementsBegin(),
 
  254                                                                            interactionData->getBondStretchingInteractions().getElementsEnd(),
 
  256         totalEnergy += bondStretchingEnergy;
 
  259         bondStretchingEnergy = ValueType();
 
  262         angleBendingEnergy = calcMMFF94AngleBendingGradient<ValueType>(interactionData->getAngleBendingInteractions().getElementsBegin(),
 
  263                                                                        interactionData->getAngleBendingInteractions().getElementsEnd(),
 
  265         totalEnergy += angleBendingEnergy;
 
  268         angleBendingEnergy = ValueType();
 
  271         stretchBendEnergy = calcMMFF94StretchBendGradient<ValueType>(interactionData->getStretchBendInteractions().getElementsBegin(),
 
  272                                                                      interactionData->getStretchBendInteractions().getElementsEnd(),
 
  274         totalEnergy += stretchBendEnergy;
 
  277         stretchBendEnergy = ValueType();
 
  280         outOfPlaneEnergy = calcMMFF94OutOfPlaneBendingGradient<ValueType>(interactionData->getOutOfPlaneBendingInteractions().getElementsBegin(),
 
  281                                                                           interactionData->getOutOfPlaneBendingInteractions().getElementsEnd(),
 
  283         totalEnergy += outOfPlaneEnergy;
 
  286         outOfPlaneEnergy = ValueType();
 
  289         torsionEnergy = calcMMFF94TorsionGradient<ValueType>(interactionData->getTorsionInteractions().getElementsBegin(),
 
  290                                                              interactionData->getTorsionInteractions().getElementsEnd(),
 
  292         totalEnergy += torsionEnergy;
 
  295         torsionEnergy = ValueType();
 
  298         electrostaticEnergy = calcMMFF94ElectrostaticGradient<ValueType>(interactionData->getElectrostaticInteractions().getElementsBegin(),
 
  299                                                                          interactionData->getElectrostaticInteractions().getElementsEnd(),
 
  301         totalEnergy += electrostaticEnergy;
 
  304         electrostaticEnergy = ValueType();
 
  307         vanDerWaalsEnergy = calcMMFF94VanDerWaalsGradient<ValueType>(interactionData->getVanDerWaalsInteractions().getElementsBegin(),
 
  308                                                                      interactionData->getVanDerWaalsInteractions().getElementsEnd(),
 
  310         totalEnergy += vanDerWaalsEnergy;
 
  313         vanDerWaalsEnergy = ValueType();
 
  315     if (!fixedAtomMask.empty())
 
  316         for (Util::BitSet::size_type i = fixedAtomMask.find_first(); i != Util::BitSet::npos; i = fixedAtomMask.find_next(i))
 
  317             grad[i].clear(ValueType());
 
  322 template <
typename ValueType>
 
  328 template <
typename ValueType>
 
  331     return bondStretchingEnergy;
 
  334 template <
typename ValueType>
 
  337     return angleBendingEnergy;
 
  340 template <
typename ValueType>
 
  343     return stretchBendEnergy;
 
  346 template <
typename ValueType>
 
  349     return outOfPlaneEnergy;
 
  352 template <
typename ValueType>
 
  355     return torsionEnergy;
 
  358 template <
typename ValueType>
 
  361     return electrostaticEnergy;
 
  364 template <
typename ValueType>
 
  367     return vanDerWaalsEnergy;
 
  370 template <
typename ValueType>
 
  373     return fixedAtomMask;
 
  376 template <
typename ValueType>
 
  379     fixedAtomMask = mask;
 
  382 template <
typename ValueType>
 
  385     fixedAtomMask.clear();
 
Definition of the type CDPL::Util::BitSet.
 
Definition of the class CDPL::ForceField::GradientVectorTraits.
 
Definition of constants in namespace CDPL::ForceField::InteractionType.
 
Functions for the calculation of MMFF94 interaction energies.
 
Functions for the calculation of MMFF94 interaction energy gradients.
 
Definition of the class CDPL::ForceField::MMFF94InteractionData.
 
Definition: MMFF94GradientCalculator.hpp:50
 
const ValueType & operator()(const CoordsArray &coords, GradVector &grad)
 
const ValueType & operator()(const CoordsArray &coords)
 
void setup(const MMFF94InteractionData &ia_data, std::size_t num_atoms)
 
void setFixedAtomMask(const Util::BitSet &mask)
 
unsigned int getEnabledInteractionTypes() const
 
void setEnabledInteractionTypes(unsigned int types)
 
const ValueType & getElectrostaticEnergy() const
 
void resetFixedAtomMask()
 
MMFF94GradientCalculator(const MMFF94InteractionData &ia_data, std::size_t num_atoms)
 
const ValueType & getStretchBendEnergy() const
 
const ValueType & getVanDerWaalsEnergy() const
 
const ValueType & getAngleBendingEnergy() const
 
MMFF94GradientCalculator()
 
const ValueType & getOutOfPlaneBendingEnergy() const
 
const ValueType & getTotalEnergy() const
 
const ValueType & getTorsionEnergy() const
 
const Util::BitSet & getFixedAtomMask() const
 
const ValueType & getBondStretchingEnergy() const
 
Definition: MMFF94InteractionData.hpp:51
 
constexpr unsigned int ALL
Specifies reactants, agents and products of a reaction.
Definition: ReactionRole.hpp:74
 
constexpr unsigned int STRETCH_BEND
Definition: InteractionType.hpp:48
 
constexpr unsigned int TORSION
Definition: InteractionType.hpp:50
 
constexpr unsigned int VAN_DER_WAALS
Definition: InteractionType.hpp:51
 
constexpr unsigned int BOND_STRETCHING
Definition: InteractionType.hpp:46
 
constexpr unsigned int ELECTROSTATIC
Definition: InteractionType.hpp:52
 
constexpr unsigned int OUT_OF_PLANE_BENDING
Definition: InteractionType.hpp:49
 
constexpr unsigned int ANGLE_BENDING
Definition: InteractionType.hpp:47
 
boost::dynamic_bitset BitSet
A dynamic bitset class.
Definition: BitSet.hpp:46
 
The namespace of the Chemical Data Processing Library.
 
static void clear(VectorType &g, std::size_t num_elem)
Definition: GradientVectorTraits.hpp:51