Loading...
Searching...
No Matches
ChiralViolationContrib.h
Go to the documentation of this file.
//
// Created by Santosh Putta, Nov 2006
//
#include <RDGeneral/export.h>
#ifndef __RD_CHIRALVIOLATIONCONTRIB_H__
#define __RD_CHIRALVIOLATIONCONTRIB_H__
#include <ForceField/Contrib.h>
#include <Geometry/point.h>
namespace DistGeom {
class ChiralSet;
//! DEPRECATED: use ChiralViolationContribs instead
//! A term to capture the violation of chirality at an atom center
//!
class RDKIT_DISTGEOMETRY_EXPORT ChiralViolationContrib
: public ForceFields::ForceFieldContrib {
public:
ChiralViolationContrib() {}
//! 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
*/
ChiralViolationContrib(ForceFields::ForceField *owner, 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;
ChiralViolationContrib *copy() const override {
return new ChiralViolationContrib(*this);
}
static double calcChiralVolume(unsigned int idx1, unsigned int idx2,
unsigned int idx3, unsigned int idx4,
const double *pos, unsigned int dim) {
// even if we are minimizing in higher dimension the chiral volume is
// calculated using only the first 3 dimensions
RDGeom::Point3D v1(pos[idx1 * dim] - pos[idx4 * dim],
pos[idx1 * dim + 1] - pos[idx4 * dim + 1],
pos[idx1 * dim + 2] - pos[idx4 * dim + 2]);
RDGeom::Point3D v2(pos[idx2 * dim] - pos[idx4 * dim],
pos[idx2 * dim + 1] - pos[idx4 * dim + 1],
pos[idx2 * dim + 2] - pos[idx4 * dim + 2]);
RDGeom::Point3D v3(pos[idx3 * dim] - pos[idx4 * dim],
pos[idx3 * dim + 1] - pos[idx4 * dim + 1],
pos[idx3 * dim + 2] - pos[idx4 * dim + 2]);
RDGeom::Point3D v2xv3 = v2.crossProduct(v3);
double vol = v1.dotProduct(v2xv3);
return vol;
}
static double calcChiralVolume(unsigned int idx1, unsigned int idx2,
unsigned int idx3, unsigned int idx4,
const RDGeom::PointPtrVect &pts) {
// even if we are minimizing in higher dimension the chiral volume is
// calculated using only the first 3 dimensions
RDGeom::Point3D v1((*pts[idx1])[0] - (*pts[idx4])[0],
(*pts[idx1])[1] - (*pts[idx4])[1],
(*pts[idx1])[2] - (*pts[idx4])[2]);
RDGeom::Point3D v2((*pts[idx2])[0] - (*pts[idx4])[0],
(*pts[idx2])[1] - (*pts[idx4])[1],
(*pts[idx2])[2] - (*pts[idx4])[2]);
RDGeom::Point3D v3((*pts[idx3])[0] - (*pts[idx4])[0],
(*pts[idx3])[1] - (*pts[idx4])[1],
(*pts[idx3])[2] - (*pts[idx4])[2]);
RDGeom::Point3D v2xv3 = v2.crossProduct(v3);
double vol = v1.dotProduct(v2xv3);
return vol;
}
private:
unsigned int d_idx1{0}, d_idx2{0}, d_idx3{0}, d_idx4{0};
double d_volLower{0.0};
double d_volUpper{0.0};
double d_weight{0.0};
};
} // 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::ChiralViolationContrib
Definition ChiralViolationContrib.h:18
DistGeom::ChiralViolationContrib::getEnergy
double getEnergy(double *pos) const override
return the contribution of this contrib to the energy of a given state
DistGeom::ChiralViolationContrib::calcChiralVolume
static double calcChiralVolume(unsigned int idx1, unsigned int idx2, unsigned int idx3, unsigned int idx4, const RDGeom::PointPtrVect &pts)
Definition ChiralViolationContrib.h:66
DistGeom::ChiralViolationContrib::ChiralViolationContrib
ChiralViolationContrib()
Definition ChiralViolationContrib.h:20
DistGeom::ChiralViolationContrib::copy
ChiralViolationContrib * copy() const override
return a copy
Definition ChiralViolationContrib.h:40
DistGeom::ChiralViolationContrib::calcChiralVolume
static double calcChiralVolume(unsigned int idx1, unsigned int idx2, unsigned int idx3, unsigned int idx4, const double *pos, unsigned int dim)
Definition ChiralViolationContrib.h:44
DistGeom::ChiralViolationContrib::ChiralViolationContrib
ChiralViolationContrib(ForceFields::ForceField *owner, const ChiralSet *cset, double weight=1.0)
Constructor.
DistGeom::ChiralViolationContrib::getGrad
void getGrad(double *pos, double *grad) const override
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
RDGeom::Point3D
Definition point.h:54
RDGeom::Point3D::dotProduct
double dotProduct(const Point3D &other) const
Definition point.h:168
RDGeom::Point3D::crossProduct
Point3D crossProduct(const Point3D &other) const
Cross product of this point with the another point.
Definition point.h:227
export.h
RDKIT_DISTGEOMETRY_EXPORT
#define RDKIT_DISTGEOMETRY_EXPORT
Definition export.h:129
DistGeom
Definition BoundsMatrix.h:20
RDGeom::PointPtrVect
std::vector< RDGeom::Point * > PointPtrVect
Definition point.h:534
point.h