RDKit
Open-source cheminformatics and machine learning.
UFF/TorsionAngle.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 #include <RDGeneral/export.h>
11 #ifndef __RD_TORSIONANGLE_H__
12 #define __RD_TORSIONANGLE_H__
13 
14 #include <ForceField/Contrib.h>
15 #include <Geometry/point.h>
16 
17 // we need this so that we get the hybridizations:
18 #include <GraphMol/Atom.h>
19 
20 namespace RDGeom {
21 class Point3D;
22 }
23 
24 namespace ForceFields {
25 namespace UFF {
26 class AtomicParams;
27 
28 //! the torsion term for the Universal Force Field
30  public:
32  : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1), d_at4Idx(-1), d_order(0){};
33  //! Constructor
34  /*!
35  The torsion is between atom1 - atom2 - atom3 - atom4
36  (i.e the angle between bond atom1-atom2 and bond atom3-atom4
37  while looking down bond atom2-atom3)
38 
39  \param owner pointer to the owning ForceField
40  \param idx1 index of atom1 in the ForceField's positions
41  \param idx2 index of atom2 in the ForceField's positions
42  \param idx3 index of atom3 in the ForceField's positions
43  \param idx4 index of atom4 in the ForceField's positions
44  \param bondOrder23 order of the torsional bond between atoms 2 and 3 (as a
45  double)
46  \param atNum2 atomic number of atom2
47  \param atNum3 atomic number of atom3
48  \param hyb2 hybridization of atom2
49  \param hyb3 hybridization of atom3
50  \param at2Params pointer to the parameters for atom 2
51  \param at3Params pointer to the parameters for atom 3
52  \param endAtomIsSP2 (optional)
53  This boolean is used to signal whether either atom1 or atom4 are
54  RDKit::Atom::SP2 hybridized.
55  This triggers a special case when either of these cases holds:
56  - atom1 is RDKit::Atom::SP2, atom2 is RDKit::Atom::SP2
57  and atom3 is RDKit::Atom::SP3
58  - atom4 is RDKit::Atom::SP2, atom3 is RDKit::Atom::SP2
59  and atom2 is RDKit::Atom::SP3
60  */
61  TorsionAngleContrib(ForceField *owner, unsigned int idx1, unsigned int idx2,
62  unsigned int idx3, unsigned int idx4, double bondOrder23,
63  int atNum2, int atNum3,
66  const AtomicParams *at2Params,
67  const AtomicParams *at3Params, bool endAtomIsSP2 = false);
68  double getEnergy(double *pos) const;
69  void getGrad(double *pos, double *grad) const;
70  void scaleForceConstant(unsigned int count) {
71  this->d_forceConstant /= static_cast<double>(count);
72  };
73  virtual TorsionAngleContrib *copy() const {
74  return new TorsionAngleContrib(*this);
75  };
76 
77  private:
78  int d_at1Idx, d_at2Idx, d_at3Idx, d_at4Idx;
79  unsigned int d_order;
80  double d_forceConstant, d_cosTerm;
81 
82  //! returns dE/dTheta
83  double getThetaDeriv(double cosTheta, double sinTheta) const;
84 
85  //! calculate default values of the torsion parameters.
86  /*!
87  see the constructor for an explanation of the arguments
88  */
89  void calcTorsionParams(double bondOrder23, int atNum2, int atNum3,
92  const AtomicParams *at2Params,
93  const AtomicParams *at3Params, bool endAtomIsSP2);
94 };
95 
96 namespace Utils {
97 //! calculates and returns the cosine of a torsion angle
99  const RDGeom::Point3D &p2,
100  const RDGeom::Point3D &p3,
101  const RDGeom::Point3D &p4);
103  RDGeom::Point3D *t, double *d,
104  double **g, double &sinTerm,
105  double &cosPhi);
106 RDKIT_FORCEFIELD_EXPORT double equation17(double bondOrder23,
107  const AtomicParams *at2Params,
108  const AtomicParams *at3Params);
109 RDKIT_FORCEFIELD_EXPORT bool isInGroup6(int num);
110 } // namespace Utils
111 } // namespace UFF
112 } // namespace ForceFields
113 #endif
point.h
RDKit::Atom::HybridizationType
HybridizationType
store hybridization
Definition: Atom.h:79
RDGeom
Definition: TorsionAngleM6.h:20
RDGeom::Point3D
Definition: point.h:46
ForceFields::UFF::TorsionAngleContrib::TorsionAngleContrib
TorsionAngleContrib()
Definition: UFF/TorsionAngle.h:31
ForceFields::UFF::Utils::calcTorsionGrad
RDKIT_FORCEFIELD_EXPORT void calcTorsionGrad(RDGeom::Point3D *r, RDGeom::Point3D *t, double *d, double **g, double &sinTerm, double &cosPhi)
ForceFields::ForceField
A class to store forcefields and handle minimization.
Definition: ForceField.h:79
Atom.h
Defines the Atom class and associated typedefs.
ForceFields::UFF::TorsionAngleContrib
the torsion term for the Universal Force Field
Definition: UFF/TorsionAngle.h:29
ForceFields::UFF::Utils::isInGroup6
RDKIT_FORCEFIELD_EXPORT bool isInGroup6(int num)
ForceFields::UFF::Utils::calculateCosTorsion
RDKIT_FORCEFIELD_EXPORT double calculateCosTorsion(const RDGeom::Point3D &p1, const RDGeom::Point3D &p2, const RDGeom::Point3D &p3, const RDGeom::Point3D &p4)
calculates and returns the cosine of a torsion angle
ForceFields::ForceFieldContrib
abstract base class for contributions to ForceFields
Definition: Contrib.h:18
RDKIT_FORCEFIELD_EXPORT
#define RDKIT_FORCEFIELD_EXPORT
Definition: export.h:255
ForceFields
Definition: TorsionAngleM6.h:24
ForceFields::UFF::Utils::equation17
RDKIT_FORCEFIELD_EXPORT double equation17(double bondOrder23, const AtomicParams *at2Params, const AtomicParams *at3Params)
Contrib.h
ForceFields::UFF::TorsionAngleContrib::scaleForceConstant
void scaleForceConstant(unsigned int count)
Definition: UFF/TorsionAngle.h:70
ForceFields::UFF::TorsionAngleContrib::copy
virtual TorsionAngleContrib * copy() const
return a copy
Definition: UFF/TorsionAngle.h:73
ForceFields::UFF::AtomicParams
class to store atomic parameters for the Universal Force Field
Definition: UFF/Params.h:73
export.h