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:
26  InversionContrib() : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1), d_at4Idx(-1){};
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;
44 
45  void getGrad(double *pos, double *grad) const;
46  virtual InversionContrib *copy() const {
47  return new InversionContrib(*this);
48  };
49 
50  private:
51  int d_at1Idx, d_at2Idx, d_at3Idx, d_at4Idx;
52  double d_forceConstant, d_C0, d_C1, d_C2;
53 };
54 
55 namespace Utils {
56 //! calculates and returns the cosine of the Y angle in an improper torsion
57 //! (see UFF paper, equation 19)
59  const RDGeom::Point3D &jPoint,
60  const RDGeom::Point3D &kPoint,
61  const RDGeom::Point3D &lPoint);
62 
63 //! calculates and returns the UFF force constant for an improper torsion
64 /*!
65 
66  \param at2AtomicNum atomic number for atom 2
67  \param isCBoundToO boolean flag; true if atom 2 is sp2 carbon bound to sp2
68  oxygen
69 
70  \return the force constant
71 
72 */
73 RDKIT_FORCEFIELD_EXPORT boost::tuple<double, double, double, double>
74 calcInversionCoefficientsAndForceConstant(int at2AtomicNum, bool isCBoundToO);
75 }
76 }
77 }
78 #endif
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
The inversion term for the Universal Force Field.
Definition: Inversion.h:24
abstract base class for contributions to ForceFields
Definition: Contrib.h:18
virtual InversionContrib * copy() const
return a copy
Definition: Inversion.h:46
#define RDKIT_FORCEFIELD_EXPORT
Definition: export.h:242
A class to store forcefields and handle minimization.
Definition: ForceField.h:58