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