RDKit
Open-source cheminformatics and machine learning.
MMFF/TorsionAngle.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2013 Paolo Tosco
3 //
4 // Copyright (C) 2004-2006 Rational Discovery LLC
5 //
6 // @@ All Rights Reserved @@
7 // This file is part of the RDKit.
8 // The contents are covered by the terms of the BSD license
9 // which is included in the file license.txt, found at the root
10 // of the RDKit source tree.
11 //
12 #ifndef __RD_MMFFTORSIONANGLE_H__
13 #define __RD_MMFFTORSIONANGLE_H__
14 
15 #include <ForceField/Contrib.h>
16 #include <boost/tuple/tuple.hpp>
17 
18 namespace RDGeom {
19 class Point3D;
20 }
21 
22 namespace ForceFields {
23 namespace MMFF {
24 class MMFFTor;
25 
26 //! the torsion term for MMFF
28  public:
30  : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1), d_at4Idx(-1){};
31  //! Constructor
32  /*!
33  The torsion is between atom1 - atom2 - atom3 - atom4
34  (i.e the angle between bond atom1-atom2 and bond atom3-atom4
35  while looking down bond atom2-atom3)
36 
37  \param owner pointer to the owning ForceField
38  \param idx1 index of atom1 in the ForceField's positions
39  \param idx2 index of atom2 in the ForceField's positions
40  \param idx3 index of atom3 in the ForceField's positions
41  \param idx4 index of atom4 in the ForceField's positions
42  \param torsionType MMFF type of the torsional bond between atoms 2 and 3
43  */
44  TorsionAngleContrib(ForceField *owner, unsigned int idx1, unsigned int idx2,
45  unsigned int idx3, unsigned int idx4,
46  const MMFFTor *mmffTorParams);
47  double getEnergy(double *pos) const;
48  void getGrad(double *pos, double *grad) const;
49  virtual TorsionAngleContrib *copy() const {
50  return new TorsionAngleContrib(*this);
51  };
52 
53  private:
54  int d_at1Idx, d_at2Idx, d_at3Idx, d_at4Idx;
55  double d_V1, d_V2, d_V3;
56 };
57 
58 namespace Utils {
59 //! calculates and returns the cosine of a torsion angle
60 double calcTorsionCosPhi(const RDGeom::Point3D &iPoint,
61  const RDGeom::Point3D &jPoint,
62  const RDGeom::Point3D &kPoint,
63  const RDGeom::Point3D &lPoint);
64 //! returns the 3-tuple of a torsion angle force constants
65 boost::tuple<double, double, double> calcTorsionForceConstant(
66  const MMFFTor *mmffTorParams);
67 //! calculates and returns the torsional MMFF energy
68 double calcTorsionEnergy(const double V1, const double V2, const double V3,
69  const double cosPhi);
70 void calcTorsionGrad(RDGeom::Point3D *r, RDGeom::Point3D *t, double *d,
71  double **g, double &sinTerm, double &cosPhi);
72 }
73 }
74 }
75 #endif
double calcTorsionEnergy(const double V1, const double V2, const double V3, const double cosPhi)
calculates and returns the torsional MMFF energy
double calcTorsionCosPhi(const RDGeom::Point3D &iPoint, const RDGeom::Point3D &jPoint, const RDGeom::Point3D &kPoint, const RDGeom::Point3D &lPoint)
calculates and returns the cosine of a torsion angle
boost::tuple< double, double, double > calcTorsionForceConstant(const MMFFTor *mmffTorParams)
returns the 3-tuple of a torsion angle force constants
abstract base class for contributions to ForceFields
Definition: Contrib.h:17
void calcTorsionGrad(RDGeom::Point3D *r, RDGeom::Point3D *t, double *d, double **g, double &sinTerm, double &cosPhi)
virtual TorsionAngleContrib * copy() const
return a copy
class to store MMFF parameters for torsions
Definition: MMFF/Params.h:130
A class to store forcefields and handle minimization.
Definition: ForceField.h:57