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