RDKit: TorsionAngle.h Source File

| RDKit Open-source cheminformatics and machine learning.

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