RDKit
Open-source cheminformatics and machine learning.
Toggle main menu visibility
Loading...
Searching...
No Matches
PlanarityContribs.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 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
#include <
RDGeneral/export.h
>
11
#ifndef RD_CRYSTALFF_OOP_H
12
#define RD_CRYSTALFF_OOP_H
13
#include <
ForceField/Contrib.h
>
14
#include <
ForceField/ForceField.h
>
15
#include <vector>
16
#include <cstddef>
17
18
namespace
ForceFields
{
19
namespace
CrystalFF
{
20
21
struct
RDKIT_FORCEFIELDHELPERS_EXPORT
PlanarityContribsParams
{
22
std::size_t
idx1
{0};
23
std::size_t
idx2
{0};
24
std::size_t
idx3
{0};
25
std::size_t
idx4
{0};
26
double
forceConstant
{1.0};
27
PlanarityContribsParams
(std::size_t
idx1
, std::size_t
idx2
, std::size_t
idx3
,
28
std::size_t
idx4
,
double
forceConstant
= 1.0)
29
:
idx1
(
idx1
),
30
idx2
(
idx2
),
31
idx3
(
idx3
),
32
idx4
(
idx4
),
33
forceConstant
(
forceConstant
){};
34
};
35
//! A term to capture all Inversion Contributionss.
36
class
RDKIT_FORCEFIELDHELPERS_EXPORT
PlanarityContribs
37
:
public
ForceFieldContrib
{
38
public
:
39
PlanarityContribs
() =
default
;
40
//! Constructor
41
/*!
42
\param owner pointer to the owning ForceField
43
*/
44
PlanarityContribs
(
ForceField
*owner);
45
46
~PlanarityContribs
()
override
=
default
;
47
//! Add contribution to this contrib.
48
/*!
49
\param idx1
50
\param idx2
51
\param idx3
52
\param idx4
53
\param forceConst
54
55
*/
56
void
addContrib
(std::size_t idx1, std::size_t idx2, std::size_t idx3,
57
std::size_t idx4,
double
forceConstant = 1.0);
58
//! return the contribution of this contrib to the energy of a given state
59
/*!
60
\param pos positions of the atoms in the current state
61
*/
62
double
getEnergy
(
double
*pos)
const override
;
63
//! calculate the contribution of this contrib to the gradient at a given
64
/// state
65
/*!
66
\param pos positions of the atoms in the current state
67
\param grad gradients to be adapted
68
*/
69
void
getGrad
(
double
*pos,
double
*grad)
const override
;
70
71
//! Copy constructor
72
PlanarityContribs
*
copy
()
const override
{
73
return
new
PlanarityContribs
(*
this
);
74
}
75
76
//! Return true if there are no contributions in this contrib
77
bool
empty
()
const
{
return
d_contribs.empty(); }
78
79
//! Get number of contributions in this contrib
80
unsigned
int
size
()
const
{
return
d_contribs.size(); }
81
82
private
:
83
std::vector<PlanarityContribsParams> d_contribs;
84
};
85
86
}
// namespace CrystalFF
87
}
// namespace ForceFields
88
89
#endif
Contrib.h
ForceField.h
ForceFields::CrystalFF::PlanarityContribs::size
unsigned int size() const
Get number of contributions in this contrib.
Definition
PlanarityContribs.h:80
ForceFields::CrystalFF::PlanarityContribs::empty
bool empty() const
Return true if there are no contributions in this contrib.
Definition
PlanarityContribs.h:77
ForceFields::CrystalFF::PlanarityContribs::getGrad
void getGrad(double *pos, double *grad) const override
ForceFields::CrystalFF::PlanarityContribs::PlanarityContribs
PlanarityContribs()=default
ForceFields::CrystalFF::PlanarityContribs::copy
PlanarityContribs * copy() const override
Copy constructor.
Definition
PlanarityContribs.h:72
ForceFields::CrystalFF::PlanarityContribs::~PlanarityContribs
~PlanarityContribs() override=default
ForceFields::CrystalFF::PlanarityContribs::getEnergy
double getEnergy(double *pos) const override
return the contribution of this contrib to the energy of a given state
ForceFields::CrystalFF::PlanarityContribs::PlanarityContribs
PlanarityContribs(ForceField *owner)
Constructor.
ForceFields::CrystalFF::PlanarityContribs::addContrib
void addContrib(std::size_t idx1, std::size_t idx2, std::size_t idx3, std::size_t idx4, double forceConstant=1.0)
Add contribution to this contrib.
ForceFields::ForceFieldContrib::ForceField
friend class ForceField
Definition
Contrib.h:20
ForceFields::ForceFieldContrib::ForceFieldContrib
ForceFieldContrib()
Definition
Contrib.h:22
export.h
RDKIT_FORCEFIELDHELPERS_EXPORT
#define RDKIT_FORCEFIELDHELPERS_EXPORT
Definition
export.h:261
ForceFields::CrystalFF
Definition
GaussianTorsionAngleContribs.h:28
ForceFields
Definition
GaussianTorsionAngleContribs.h:22
ForceFields::CrystalFF::PlanarityContribsParams::forceConstant
double forceConstant
Definition
PlanarityContribs.h:26
ForceFields::CrystalFF::PlanarityContribsParams::idx4
std::size_t idx4
Definition
PlanarityContribs.h:25
ForceFields::CrystalFF::PlanarityContribsParams::idx2
std::size_t idx2
Definition
PlanarityContribs.h:23
ForceFields::CrystalFF::PlanarityContribsParams::idx3
std::size_t idx3
Definition
PlanarityContribs.h:24
ForceFields::CrystalFF::PlanarityContribsParams::idx1
std::size_t idx1
Definition
PlanarityContribs.h:22
ForceFields::CrystalFF::PlanarityContribsParams::PlanarityContribsParams
PlanarityContribsParams(std::size_t idx1, std::size_t idx2, std::size_t idx3, std::size_t idx4, double forceConstant=1.0)
Definition
PlanarityContribs.h:27
GraphMol
ForceFieldHelpers
CrystalFF
PlanarityContribs.h
Generated on
for RDKit by
1.17.0