RDKit
Open-source cheminformatics and machine learning.
Inversion.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_UFFINVERSION_H__
13 #define __RD_UFFINVERSION_H__
14 #include <ForceField/Contrib.h>
15 #include <boost/tuple/tuple.hpp>
16 #include <Geometry/point.h>
17 
18 namespace ForceFields {
19 namespace UFF {
20 class AtomicParams;
21 
22 //! The inversion term for the Universal Force Field
24  public:
25  InversionContrib() : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1), d_at4Idx(-1){};
26  //! Constructor
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 idx4 index of atom4 in the ForceField's positions
33  \param at2AtomicNum atomic number for atom 2
34  \param isCBoundToO boolean flag; true if atom 2 is sp2 carbon bound to
35  sp2 oxygen
36 
37  */
38  InversionContrib(ForceField *owner, unsigned int idx1, unsigned int idx2,
39  unsigned int idx3, unsigned int idx4, int at2AtomicNum,
40  bool isCBoundToO, double oobForceScalingFactor = 1.0);
41 
42  double getEnergy(double *pos) const;
43 
44  void getGrad(double *pos, double *grad) const;
45  virtual InversionContrib *copy() const {
46  return new InversionContrib(*this);
47  };
48 
49  private:
50  int d_at1Idx, d_at2Idx, d_at3Idx, d_at4Idx;
51  double d_forceConstant, d_C0, d_C1, d_C2;
52 };
53 
54 namespace Utils {
55 //! calculates and returns the cosine of the Y angle in an improper torsion
56 //! (see UFF paper, equation 19)
57 double calculateCosY(const RDGeom::Point3D &iPoint,
58  const RDGeom::Point3D &jPoint,
59  const RDGeom::Point3D &kPoint,
60  const RDGeom::Point3D &lPoint);
61 
62 //! calculates and returns the UFF force constant for an improper torsion
63 /*!
64 
65  \param at2AtomicNum atomic number for atom 2
66  \param isCBoundToO boolean flag; true if atom 2 is sp2 carbon bound to sp2
67  oxygen
68 
69  \return the force constant
70 
71 */
72 boost::tuple<double, double, double, double>
73 calcInversionCoefficientsAndForceConstant(int at2AtomicNum, bool isCBoundToO);
74 }
75 }
76 }
77 #endif
boost::tuple< double, double, double, double > calcInversionCoefficientsAndForceConstant(int at2AtomicNum, bool isCBoundToO)
calculates and returns the UFF force constant for an improper torsion
The inversion term for the Universal Force Field.
Definition: Inversion.h:23
abstract base class for contributions to ForceFields
Definition: Contrib.h:17
void getGrad(double *pos, double *grad) const
calculates our contribution to the gradients of a position
double calculateCosY(const RDGeom::Point3D &iPoint, const RDGeom::Point3D &jPoint, const RDGeom::Point3D &kPoint, const RDGeom::Point3D &lPoint)
double getEnergy(double *pos) const
returns our contribution to the energy of a position
virtual InversionContrib * copy() const
return a copy
Definition: Inversion.h:45
A class to store forcefields and handle minimization.
Definition: ForceField.h:57