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
30 public:
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,
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,
94 const AtomicParams *at2Params,
95 const AtomicParams *at3Params, bool endAtomIsSP2);
96};
97
98namespace Utils {
99//! calculates and returns the cosine of a torsion angle
101 const RDGeom::Point3D &p2,
102 const RDGeom::Point3D &p3,
103 const RDGeom::Point3D &p4);
105 RDGeom::Point3D *t, double *d,
106 double **g, double &sinTerm,
107 double &cosPhi);
108RDKIT_FORCEFIELD_EXPORT double equation17(double bondOrder23,
109 const AtomicParams *at2Params,
110 const AtomicParams *at3Params);
112} // namespace Utils
113} // namespace UFF
114} // namespace ForceFields
115#endif
Defines the Atom class and associated typedefs.
abstract base class for contributions to ForceFields
Definition Contrib.h:18
A class to store forcefields and handle minimization.
Definition ForceField.h:79
class to store atomic parameters for the Universal Force Field
Definition UFF/Params.h:73
the torsion term for the Universal Force Field
TorsionAngleContrib * copy() const override
return a copy
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
void scaleForceConstant(unsigned int count)
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.
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
HybridizationType
store hybridization
Definition Atom.h:86
#define RDKIT_FORCEFIELD_EXPORT
Definition export.h:185
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
RDKIT_FORCEFIELD_EXPORT bool isInGroup6(int num)
RDKIT_FORCEFIELD_EXPORT double equation17(double bondOrder23, const AtomicParams *at2Params, const AtomicParams *at3Params)
RDKIT_FORCEFIELD_EXPORT void calcTorsionGrad(RDGeom::Point3D *r, RDGeom::Point3D *t, double *d, double **g, double &sinTerm, double &cosPhi)