RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
ChiralViolationContribs.h
Go to the documentation of this file.
1//
2// Copyright (C) 2024 Greg Landrum 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_CHIRALVIOLATIONCONTRIBS_H
12#define RD_CHIRALVIOLATIONCONTRIBS_H
13
14#include <vector>
15#include <ForceField/Contrib.h>
16#include <Geometry/point.h>
17
18namespace DistGeom {
19class ChiralSet;
20
22 const unsigned int idx1, const unsigned int idx2, const unsigned int idx3,
23 const unsigned int idx4, const double *pos, const unsigned int dim);
25 const unsigned int idx1, const unsigned int idx2, const unsigned int idx3,
26 const unsigned int idx4, const RDGeom::PointPtrVect &pts);
27
29 unsigned int idx1{0}, idx2{0}, idx3{0}, idx4{0};
30 double volUpper{0.0};
31 double volLower{0.0};
32 double weight{1.0};
33 ChiralViolationContribsParams(unsigned int i1, unsigned int i2,
34 unsigned int i3, unsigned int i4, double u,
35 double l, double w = 1.0)
36 : idx1(i1),
37 idx2(i2),
38 idx3(i3),
39 idx4(i4),
40 volUpper(u),
41 volLower(l),
42 weight(w) {};
43};
44//! A term to capture the violation of chirality at atom centers
45//!
48 public:
50
51 //! Constructor
52 /*!
53 \param owner pointer to the owning forcefield
54 \param cset a chiral set containing the four chiral atom ids (in
55 sequence)
56 and the upper and lower limits on the signed chiral
57 volume \param weight (optional) the weight to be used for this contrib
58
59 */
61
62 //! adds a new chiral constraint
63 /*!
64 \param cset a chiral set containing the four chiral atom ids (in
65 sequence)
66 and the upper and lower limits on the signed chiral
67 volume \param weight (optional) the weight to be used for this contrib
68
69 */
70 void addContrib(const ChiralSet *cset, double weight = 1.0);
71
72 //! return the contribution of this contrib to the energy of a given state
73 double getEnergy(double *pos) const override;
74
75 //! calculate the contribution of this contrib to the gradient at a given
76 /// state
77 void getGrad(double *pos, double *grad) const override;
78 ChiralViolationContribs *copy() const override {
79 return new ChiralViolationContribs(*this);
80 }
81 bool empty() const { return d_contribs.empty(); }
82 unsigned int size() const { return d_contribs.size(); }
83
84 private:
85 std::vector<ChiralViolationContribsParams> d_contribs;
86};
87} // namespace DistGeom
88
89#endif
Class used to store a quartet of points and chiral volume bounds on them.
Definition ChiralSet.h:29
ChiralViolationContribs * copy() const override
return a copy
ChiralViolationContribs(ForceFields::ForceField *owner)
Constructor.
void getGrad(double *pos, double *grad) const override
double getEnergy(double *pos) const override
return the contribution of this contrib to the energy of a given state
void addContrib(const ChiralSet *cset, double weight=1.0)
adds a new chiral constraint
abstract base class for contributions to ForceFields
Definition Contrib.h:18
A class to store forcefields and handle minimization.
Definition ForceField.h:79
#define RDKIT_DISTGEOMETRY_EXPORT
Definition export.h:129
RDKIT_DISTGEOMETRY_EXPORT double calcChiralVolume(const unsigned int idx1, const unsigned int idx2, const unsigned int idx3, const unsigned int idx4, const double *pos, const unsigned int dim)
std::vector< RDGeom::Point * > PointPtrVect
Definition point.h:534
ChiralViolationContribsParams(unsigned int i1, unsigned int i2, unsigned int i3, unsigned int i4, double u, double l, double w=1.0)