Loading...
Searching...
No Matches
ChiralViolationContribs.h
Go to the documentation of this file.
//
// Copyright (C) 2024 Greg Landrum and other RDKit contributors
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
#include <RDGeneral/export.h>
#ifndef RD_CHIRALVIOLATIONCONTRIBS_H
#define RD_CHIRALVIOLATIONCONTRIBS_H
#include <vector>
#include <ForceField/Contrib.h>
#include <Geometry/point.h>
namespace DistGeom {
class ChiralSet;
struct ChiralViolationContribsParams {
unsigned int idx1{0}, idx2{0}, idx3{0}, idx4{0};
double volUpper{0.0};
double volLower{0.0};
double weight{1.0};
ChiralViolationContribsParams(unsigned int i1, unsigned int i2,
unsigned int i3, unsigned int i4, double u,
double l, double w = 1.0)
: idx1(i1),
idx2(i2),
idx3(i3),
idx4(i4),
volUpper(u),
volLower(l),
weight(w) {};
};
//! A term to capture the violation of chirality at atom centers
//!
class RDKIT_DISTGEOMETRY_EXPORT ChiralViolationContribs
: public ForceFields::ForceFieldContrib {
public:
ChiralViolationContribs() = default;
//! Constructor
/*!
\param owner pointer to the owning forcefield
\param cset a chiral set containing the four chiral atom ids (in
sequence)
and the upper and lower limits on the signed chiral
volume \param weight (optional) the weight to be used for this contrib
*/
ChiralViolationContribs(ForceFields::ForceField *owner);
//! adds a new chiral constraint
/*!
\param cset a chiral set containing the four chiral atom ids (in
sequence)
and the upper and lower limits on the signed chiral
volume \param weight (optional) the weight to be used for this contrib
*/
void addContrib(const ChiralSet *cset, double weight = 1.0);
//! return the contribution of this contrib to the energy of a given state
double getEnergy(double *pos) const override;
//! calculate the contribution of this contrib to the gradient at a given
/// state
void getGrad(double *pos, double *grad) const override;
ChiralViolationContribs *copy() const override {
return new ChiralViolationContribs(*this);
}
bool empty() const { return d_contribs.empty(); }
unsigned int size() const { return d_contribs.size(); }
private:
std::vector<ChiralViolationContribsParams> d_contribs;
};
} // namespace DistGeom
#endif
Contrib.h
DistGeom::ChiralSet
Class used to store a quartet of points and chiral volume bounds on them.
Definition ChiralSet.h:29
DistGeom::ChiralViolationContribs
Definition ChiralViolationContribs.h:40
DistGeom::ChiralViolationContribs::copy
ChiralViolationContribs * copy() const override
return a copy
Definition ChiralViolationContribs.h:71
DistGeom::ChiralViolationContribs::empty
bool empty() const
Definition ChiralViolationContribs.h:74
DistGeom::ChiralViolationContribs::ChiralViolationContribs
ChiralViolationContribs()=default
DistGeom::ChiralViolationContribs::size
unsigned int size() const
Definition ChiralViolationContribs.h:75
DistGeom::ChiralViolationContribs::ChiralViolationContribs
ChiralViolationContribs(ForceFields::ForceField *owner)
Constructor.
DistGeom::ChiralViolationContribs::getGrad
void getGrad(double *pos, double *grad) const override
DistGeom::ChiralViolationContribs::getEnergy
double getEnergy(double *pos) const override
return the contribution of this contrib to the energy of a given state
DistGeom::ChiralViolationContribs::addContrib
void addContrib(const ChiralSet *cset, double weight=1.0)
adds a new chiral constraint
ForceFields::ForceFieldContrib
abstract base class for contributions to ForceFields
Definition Contrib.h:18
ForceFields::ForceField
A class to store forcefields and handle minimization.
Definition ForceField.h:79
export.h
RDKIT_DISTGEOMETRY_EXPORT
#define RDKIT_DISTGEOMETRY_EXPORT
Definition export.h:129
DistGeom
Definition BoundsMatrix.h:20
point.h
DistGeom::ChiralViolationContribsParams
Definition ChiralViolationContribs.h:21
DistGeom::ChiralViolationContribsParams::weight
double weight
Definition ChiralViolationContribs.h:25
DistGeom::ChiralViolationContribsParams::volUpper
double volUpper
Definition ChiralViolationContribs.h:23
DistGeom::ChiralViolationContribsParams::idx1
unsigned int idx1
Definition ChiralViolationContribs.h:22
DistGeom::ChiralViolationContribsParams::ChiralViolationContribsParams
ChiralViolationContribsParams(unsigned int i1, unsigned int i2, unsigned int i3, unsigned int i4, double u, double l, double w=1.0)
Definition ChiralViolationContribs.h:26
DistGeom::ChiralViolationContribsParams::idx4
unsigned int idx4
Definition ChiralViolationContribs.h:22
DistGeom::ChiralViolationContribsParams::idx2
unsigned int idx2
Definition ChiralViolationContribs.h:22
DistGeom::ChiralViolationContribsParams::volLower
double volLower
Definition ChiralViolationContribs.h:24
DistGeom::ChiralViolationContribsParams::idx3
unsigned int idx3
Definition ChiralViolationContribs.h:22