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 unsigned int idx1{0}, idx2{0}, idx3{0}, idx4{0};
23 double volUpper{0.0};
24 double volLower{0.0};
25 double weight{1.0};
26 ChiralViolationContribsParams(unsigned int i1, unsigned int i2,
27 unsigned int i3, unsigned int i4, double u,
28 double l, double w = 1.0)
29 : idx1(i1),
30 idx2(i2),
31 idx3(i3),
32 idx4(i4),
33 volUpper(u),
34 volLower(l),
35 weight(w) {};
36};
37//! A term to capture the violation of chirality at atom centers
38//!
41 public:
43
44 //! Constructor
45 /*!
46 \param owner pointer to the owning forcefield
47 \param cset a chiral set containing the four chiral atom ids (in
48 sequence)
49 and the upper and lower limits on the signed chiral
50 volume \param weight (optional) the weight to be used for this contrib
51
52 */
54
55 //! adds a new chiral constraint
56 /*!
57 \param cset a chiral set containing the four chiral atom ids (in
58 sequence)
59 and the upper and lower limits on the signed chiral
60 volume \param weight (optional) the weight to be used for this contrib
61
62 */
63 void addContrib(const ChiralSet *cset, double weight = 1.0);
64
65 //! return the contribution of this contrib to the energy of a given state
66 double getEnergy(double *pos) const override;
67
68 //! calculate the contribution of this contrib to the gradient at a given
69 /// state
70 void getGrad(double *pos, double *grad) const override;
71 ChiralViolationContribs *copy() const override {
72 return new ChiralViolationContribs(*this);
73 }
74 bool empty() const { return d_contribs.empty(); }
75 unsigned int size() const { return d_contribs.size(); }
76
77 private:
78 std::vector<ChiralViolationContribsParams> d_contribs;
79};
80} // namespace DistGeom
81
82#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
ChiralViolationContribsParams(unsigned int i1, unsigned int i2, unsigned int i3, unsigned int i4, double u, double l, double w=1.0)