RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
MMFF/TorsionAngle.h
Go to the documentation of this file.
1//
2// Copyright (C) 2013-2022 Paolo Tosco and other RDKit contributors
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_MMFFTORSIONANGLE_H
12#define RD_MMFFTORSIONANGLE_H
13
14#include <ForceField/Contrib.h>
15#include <tuple>
16
17namespace RDGeom {
18class Point3D;
19}
20
21namespace ForceFields {
22namespace MMFF {
23class MMFFTor;
24
25//! the torsion term for MMFF
27 public:
29 //! Constructor
30 /*!
31 The torsion is between atom1 - atom2 - atom3 - atom4
32 (i.e the angle between bond atom1-atom2 and bond atom3-atom4
33 while looking down bond atom2-atom3)
34
35 \param owner pointer to the owning ForceField
36 \param idx1 index of atom1 in the ForceField's positions
37 \param idx2 index of atom2 in the ForceField's positions
38 \param idx3 index of atom3 in the ForceField's positions
39 \param idx4 index of atom4 in the ForceField's positions
40 \param torsionType MMFF type of the torsional bond between atoms 2 and 3
41 */
42 TorsionAngleContrib(ForceField *owner, unsigned int idx1, unsigned int idx2,
43 unsigned int idx3, unsigned int idx4,
44 const MMFFTor *mmffTorParams);
45 double getEnergy(double *pos) const override;
46 void getGrad(double *pos, double *grad) const override;
47 TorsionAngleContrib *copy() const override {
48 return new TorsionAngleContrib(*this);
49 }
50
51 private:
52 int d_at1Idx{-1}, d_at2Idx{-1}, d_at3Idx{-1}, d_at4Idx{-1};
53 double d_V1, d_V2, d_V3;
54};
55
56namespace Utils {
57//! calculates and returns the cosine of a torsion angle
58RDKIT_FORCEFIELD_EXPORT double calcTorsionCosPhi(const RDGeom::Point3D &iPoint,
59 const RDGeom::Point3D &jPoint,
60 const RDGeom::Point3D &kPoint,
61 const RDGeom::Point3D &lPoint);
62//! returns the 3-tuple of a torsion angle force constants
63RDKIT_FORCEFIELD_EXPORT std::tuple<double, double, double>
64calcTorsionForceConstant(const MMFFTor *mmffTorParams);
65//! calculates and returns the torsional MMFF energy
66RDKIT_FORCEFIELD_EXPORT double calcTorsionEnergy(const double V1,
67 const double V2,
68 const double V3,
69 const double cosPhi);
70RDKIT_FORCEFIELD_EXPORT void calcTorsionGrad(RDGeom::Point3D *r,
71 RDGeom::Point3D *t, double *d,
72 double **g, double &sinTerm,
73 double &cosPhi);
74} // namespace Utils
75} // namespace MMFF
76} // namespace ForceFields
77#endif
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 MMFF parameters for torsions
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
TorsionAngleContrib * copy() const override
return a copy
TorsionAngleContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, unsigned int idx3, unsigned int idx4, const MMFFTor *mmffTorParams)
Constructor.
#define RDKIT_FORCEFIELD_EXPORT
Definition export.h:185
RDKIT_FORCEFIELDHELPERS_EXPORT double calcTorsionEnergy(const std::vector< double > &forceConstants, const std::vector< int > &signs, const double cosPhi)