RDKit
Open-source cheminformatics and machine learning.
Toggle main menu visibility
Loading...
Searching...
No Matches
AngleConstraints.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2024-2026 Niels Maeder 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
11
#include <
RDGeneral/export.h
>
12
#ifndef RD_ANGLECONSTRAINTS_H
13
#define RD_ANGLECONSTRAINTS_H
14
#include <vector>
15
#include "
ForceField.h
"
16
#include "
Contrib.h
"
17
18
namespace
ForceFields
{
19
20
struct
AngleConstraintContribsParams
{
21
unsigned
int
idx1
{0};
//!< index of atom1 of the angle constraint
22
unsigned
int
idx2
{0};
//!< index of atom2 of the angle constraint
23
unsigned
int
idx3
{0};
//!< index of atom3 of the angle constraint
24
double
minAngle
{0.0};
//!< lower bound of the flat bottom potential
25
double
maxAngle
{0.0};
//!< upper bound of the flat bottom potential
26
double
forceConstant
{1.0};
//!< force constant for angle constraint
27
AngleConstraintContribsParams
(
unsigned
int
idx1
,
unsigned
int
idx2
,
28
unsigned
int
idx3
,
double
minAngle
,
29
double
maxAngle
,
double
forceConstant
= 1.0)
30
:
idx1
(
idx1
),
31
idx2
(
idx2
),
32
idx3
(
idx3
),
33
minAngle
(
minAngle
),
34
maxAngle
(
maxAngle
),
35
forceConstant
(
forceConstant
){};
36
};
37
38
//! A term to capture all flat bottom angle constraint potentials.
39
class
RDKIT_FORCEFIELD_EXPORT
AngleConstraintContribs
40
:
public
ForceFieldContrib
{
41
public
:
42
AngleConstraintContribs
() =
default
;
43
44
//! Constructor
45
/*!
46
\param owner pointer to the owning ForceField
47
*/
48
AngleConstraintContribs
(
ForceField
*owner);
49
~AngleConstraintContribs
()
override
=
default
;
50
//! Add a contribution to this contrib collection
51
/*!
52
\param idx1 index of atom1 in the ForceField's positions
53
\param idx2 index of atom2 in the ForceField's positions
54
\param idx3 index of atom3 in the ForceField's positions
55
\param minAngle minimum angle
56
\param maxAngle maximum angle
57
\param forceConst force Constant
58
59
*/
60
void
addContrib
(
unsigned
int
idx1,
unsigned
int
idx2,
unsigned
int
idx3,
61
double
minAngleDeg,
double
maxAngleDeg,
double
forceConst);
62
//! Add a contribution to this contrib collection
63
/*!
64
\param idx1 index of atom1 in the ForceField's positions
65
\param idx2 index of atom2 in the ForceField's positions
66
\param idx3 index of atom3 in the ForceField's positions
67
\param relative whether to add the provided angle to the current angle
68
\param minAngle minimum angle
69
\param maxAngle maximum angle
70
\param forceConst force Constant
71
72
*/
73
void
addContrib
(
unsigned
int
idx1,
unsigned
int
idx2,
unsigned
int
idx3,
74
bool
relative,
double
minAngleDeg,
double
maxAngleDeg,
75
double
forceConst);
76
//! return the contribution of this contrib to the energy of a given state
77
/*!
78
\param pos positions of the atoms in the current state
79
*/
80
double
getEnergy
(
double
*pos)
const override
;
81
//! return the contribution of this contrib to the energy of a given state
82
/*!
83
\param positions positions of the atoms in the current state
84
\param energies Will resize and write the energies of every single contrib
85
of this contribs object to the energies vector
86
*/
87
double
getEnergy
(
const
RDGeom::Point3DPtrVect
&positions,
88
std::vector<double> &energies)
const
;
89
//! calculate the contribution of this contrib to the gradient at a given
90
/// state
91
/*!
92
\param pos positions of the atoms in the current state
93
\param grad gradients to be adapted
94
*/
95
void
getGrad
(
double
*pos,
double
*grad)
const override
;
96
//! Copy constructor
97
98
AngleConstraintContribs
*
copy
()
const override
{
99
return
new
AngleConstraintContribs
(*
this
);
100
}
101
102
//! Return true if there are no contributions in this contrib
103
bool
empty
()
const
{
return
d_contribs.empty(); }
104
105
//! Get number of contributions in this contrib
106
unsigned
int
size
()
const
{
return
d_contribs.size(); }
107
108
private
:
109
std::vector<AngleConstraintContribsParams> d_contribs;
110
};
111
}
// namespace ForceFields
112
#endif
Contrib.h
ForceField.h
ForceFields::AngleConstraintContribs::getEnergy
double getEnergy(double *pos) const override
return the contribution of this contrib to the energy of a given state
ForceFields::AngleConstraintContribs::getGrad
void getGrad(double *pos, double *grad) const override
ForceFields::AngleConstraintContribs::AngleConstraintContribs
AngleConstraintContribs()=default
ForceFields::AngleConstraintContribs::AngleConstraintContribs
AngleConstraintContribs(ForceField *owner)
Constructor.
ForceFields::AngleConstraintContribs::empty
bool empty() const
Return true if there are no contributions in this contrib.
Definition
AngleConstraints.h:103
ForceFields::AngleConstraintContribs::~AngleConstraintContribs
~AngleConstraintContribs() override=default
ForceFields::AngleConstraintContribs::getEnergy
double getEnergy(const RDGeom::Point3DPtrVect &positions, std::vector< double > &energies) const
return the contribution of this contrib to the energy of a given state
ForceFields::AngleConstraintContribs::addContrib
void addContrib(unsigned int idx1, unsigned int idx2, unsigned int idx3, bool relative, double minAngleDeg, double maxAngleDeg, double forceConst)
Add a contribution to this contrib collection.
ForceFields::AngleConstraintContribs::copy
AngleConstraintContribs * copy() const override
Copy constructor.
Definition
AngleConstraints.h:98
ForceFields::AngleConstraintContribs::size
unsigned int size() const
Get number of contributions in this contrib.
Definition
AngleConstraints.h:106
ForceFields::AngleConstraintContribs::addContrib
void addContrib(unsigned int idx1, unsigned int idx2, unsigned int idx3, double minAngleDeg, double maxAngleDeg, double forceConst)
Add a contribution to this contrib collection.
ForceFields::ForceFieldContrib::ForceField
friend class ForceField
Definition
Contrib.h:20
ForceFields::ForceFieldContrib::ForceFieldContrib
ForceFieldContrib()
Definition
Contrib.h:22
export.h
RDKIT_FORCEFIELD_EXPORT
#define RDKIT_FORCEFIELD_EXPORT
Definition
export.h:251
ForceFields
Definition
GaussianTorsionAngleContribs.h:22
RDGeom::Point3DPtrVect
std::vector< RDGeom::Point3D * > Point3DPtrVect
Definition
point.h:551
ForceFields::AngleConstraintContribsParams::maxAngle
double maxAngle
upper bound of the flat bottom potential
Definition
AngleConstraints.h:25
ForceFields::AngleConstraintContribsParams::minAngle
double minAngle
lower bound of the flat bottom potential
Definition
AngleConstraints.h:24
ForceFields::AngleConstraintContribsParams::idx3
unsigned int idx3
index of atom3 of the angle constraint
Definition
AngleConstraints.h:23
ForceFields::AngleConstraintContribsParams::AngleConstraintContribsParams
AngleConstraintContribsParams(unsigned int idx1, unsigned int idx2, unsigned int idx3, double minAngle, double maxAngle, double forceConstant=1.0)
Definition
AngleConstraints.h:27
ForceFields::AngleConstraintContribsParams::idx1
unsigned int idx1
index of atom1 of the angle constraint
Definition
AngleConstraints.h:21
ForceFields::AngleConstraintContribsParams::idx2
unsigned int idx2
index of atom2 of the angle constraint
Definition
AngleConstraints.h:22
ForceFields::AngleConstraintContribsParams::forceConstant
double forceConstant
force constant for angle constraint
Definition
AngleConstraints.h:26
ForceField
AngleConstraints.h
Generated on
for RDKit by
1.17.0