RDKit
Open-source cheminformatics and machine learning.
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>
15#include <vector>
16#include <cstddef>
17
18namespace ForceFields {
19namespace CrystalFF {
20
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),
34};
35//! A term to capture all Inversion Contributionss.
37 : public ForceFieldContrib {
38 public:
39 PlanarityContribs() = default;
40 //! Constructor
41 /*!
42 \param owner pointer to the owning ForceField
43 */
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
unsigned int size() const
Get number of contributions in this contrib.
bool empty() const
Return true if there are no contributions in this contrib.
void getGrad(double *pos, double *grad) const override
PlanarityContribs * copy() const override
Copy constructor.
double getEnergy(double *pos) const override
return the contribution of this contrib to the energy of a given state
PlanarityContribs(ForceField *owner)
Constructor.
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.
#define RDKIT_FORCEFIELDHELPERS_EXPORT
Definition export.h:209
PlanarityContribsParams(std::size_t idx1, std::size_t idx2, std::size_t idx3, std::size_t idx4, double forceConstant=1.0)