RDKit
Open-source cheminformatics and machine learning.
UFF/AngleBend.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #ifndef __RD_ANGLEBEND_H__
11 #define __RD_ANGLEBEND_H__
12 
13 #include <ForceField/Contrib.h>
14 #include <Geometry/point.h>
15 
16 namespace ForceFields {
17 namespace UFF {
18 class AtomicParams;
19 
20 //! The angle-bend term for the Universal Force Field
22  public:
23  AngleBendContrib() : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1), d_order(0){};
24  //! Constructor
25  /*!
26  The angle is between atom1 - atom2 - atom3
27 
28  \param owner pointer to the owning ForceField
29  \param idx1 index of atom1 in the ForceField's positions
30  \param idx2 index of atom2 in the ForceField's positions
31  \param idx3 index of atom3 in the ForceField's positions
32  \param bondOrder12 order of the bond between atoms 1 and 2 (as a double)
33  \param bondOrder23 order of the bond between atoms 2 and 3 (as a double)
34  \param at1Params pointer to the parameters for atom 1
35  \param at2Params pointer to the parameters for atom 2
36  \param at3Params pointer to the parameters for atom 3
37  \param order (optional) the order of the angle term, this is for
38  special cases and should adopt values:
39  - 0: not a special case, use the \c theta0 value from \c at2Params
40  - 2: linear coordination
41  - 3: trigonal planar coordination
42  - 4: square planar or tetrahedral coordination
43 
44  */
45  AngleBendContrib(ForceField *owner, unsigned int idx1, unsigned int idx2,
46  unsigned int idx3, double bondOrder12, double bondOrder23,
47  const AtomicParams *at1Params, const AtomicParams *at2Params,
48  const AtomicParams *at3Params, unsigned int order = 0);
49  double getEnergy(double *pos) const;
50  void getGrad(double *pos, double *grad) const;
51 
52  virtual AngleBendContrib *copy() const {
53  return new AngleBendContrib(*this);
54  };
55 
56  private:
57  int d_at1Idx, d_at2Idx, d_at3Idx;
58  unsigned int d_order;
59  double d_forceConstant, d_C0, d_C1, d_C2;
60 
61  double getEnergyTerm(double cosTheta, double sinThetaSq) const;
62  double getThetaDeriv(double cosTheta, double sinTheta) const;
63 };
64 
65 namespace Utils {
66 //! Calculate the force constant for an angle bend
67 /*!
68  The angle is between atom1 - atom2 - atom3
69 
70  \param theta0 the preferred value of the angle (in radians)
71  \param bondOrder12 order of the bond between atoms 1 and 2 (as a double)
72  \param bondOrder23 order of the bond between atoms 2 and 3 (as a double)
73  \param at1Params pointer to the parameters for atom 1
74  \param at2Params pointer to the parameters for atom 2
75  \param at3Params pointer to the parameters for atom 3
76 
77 */
78 double calcAngleForceConstant(double theta0, double bondOrder12,
79  double bondOrder23, const AtomicParams *at1Params,
80  const AtomicParams *at2Params,
81  const AtomicParams *at3Params);
82 void calcAngleBendGrad(RDGeom::Point3D *r, double *dist, double **g,
83  double &dE_dTheta, double &cosTheta, double &sinTheta);
84 }
85 }
86 }
87 #endif
class to store atomic parameters for the Universal Force Field
Definition: UFF/Params.h:71
void calcAngleBendGrad(RDGeom::Point3D *r, double *dist, double **g, double &dE_dTheta, double &cosTheta, double &sinTheta)
void getGrad(double *pos, double *grad) const
calculates our contribution to the gradients of a position
abstract base class for contributions to ForceFields
Definition: Contrib.h:17
The angle-bend term for the Universal Force Field.
Definition: UFF/AngleBend.h:21
virtual AngleBendContrib * copy() const
return a copy
Definition: UFF/AngleBend.h:52
double calcAngleForceConstant(double theta0, double bondOrder12, double bondOrder23, const AtomicParams *at1Params, const AtomicParams *at2Params, const AtomicParams *at3Params)
Calculate the force constant for an angle bend.
A class to store forcefields and handle minimization.
Definition: ForceField.h:57
double getEnergy(double *pos) const
returns our contribution to the energy of a position