11 #ifndef __RD_FORCEFIELD_H__
12 #define __RD_FORCEFIELD_H__
15 #include <boost/smart_ptr.hpp>
16 #include <boost/foreach.hpp>
21 namespace ForceFieldsHelper {
25 unsigned int idx3,
unsigned int idx4,
double *dihedral =
nullptr,
29 const double *pos,
unsigned int idx1,
unsigned int idx2,
unsigned int idx3,
30 unsigned int idx4,
double *dihedral =
nullptr,
double *cosPhi =
nullptr,
32 double d[2] =
nullptr);
36 double *dihedral =
nullptr,
double *cosPhi =
nullptr,
38 double d[2] =
nullptr);
43 class ForceFieldContrib;
45 typedef boost::shared_ptr<const ForceFieldContrib>
ContribPtr;
84 : d_dimension(dimension)
106 double calcEnergy(std::vector<double> *contribs =
nullptr)
const;
157 unsigned int maxIts = 200,
double forceTol = 1e-4,
158 double energyTol = 1e-6);
177 int minimize(
unsigned int maxIts = 200,
double forceTol = 1e-4,
178 double energyTol = 1e-6);
205 double distance(
unsigned int i,
unsigned int j,
double *pos =
nullptr);
220 double distance(
unsigned int i,
unsigned int j,
double *pos =
nullptr)
const;
234 unsigned int d_numPoints{0};
235 double *dp_distMat{
nullptr};
239 unsigned int d_matSize = 0;
A class to store forcefields and handle minimization.
ForceField(const ForceField &other)
copy ctor, copies contribs.
void initDistanceMatrix()
initializes our internal distance matrix
unsigned int dimension() const
returns the dimension of the forcefield
void scatter(double *pos) const
scatter our positions into an array
double calcEnergy(double *pos)
calculates and returns the energy of the position passed in
const RDGeom::PointPtrVect & positions() const
double calcEnergy(std::vector< double > *contribs=nullptr) const
calculates and returns the energy (in kcal/mol) based on existing
const INT_VECT & fixedPoints() const
void calcGrad(double *forces) const
calculates the gradient of the energy at the current position
ForceField(unsigned int dimension=3)
construct with a dimension
void calcGrad(double *pos, double *forces)
calculates the gradient of the energy at the provided position
ContribPtrVect d_contribs
contributions to the energy
double distance(unsigned int i, unsigned int j, double *pos=nullptr)
returns the distance between two points
int minimize(unsigned int maxIts=200, double forceTol=1e-4, double energyTol=1e-6)
minimizes the energy of the system by following gradients
void initialize()
does initialization
unsigned int numPoints() const
returns the number of points the ForceField is handling
RDGeom::PointPtrVect d_positions
pointers to the points we're using
RDGeom::PointPtrVect & positions()
returns a reference to our points (a PointPtrVect)
void gather(double *pos)
update our positions from an array
double distance(unsigned int i, unsigned int j, double *pos=nullptr) const
returns the distance between two points
const ContribPtrVect & contribs() const
ContribPtrVect & contribs()
returns a reference to our contribs (a ContribPtrVect)
int minimize(unsigned int snapshotFreq, RDKit::SnapshotVect *snapshotVect, unsigned int maxIts=200, double forceTol=1e-4, double energyTol=1e-6)
minimizes the energy of the system by following gradients
#define RDKIT_FORCEFIELD_EXPORT
std::vector< int > INT_VECT
boost::shared_ptr< const ForceFieldContrib > ContribPtr
std::vector< ContribPtr > ContribPtrVect
std::vector< RDGeom::Point * > PointPtrVect
void RDKIT_FORCEFIELD_EXPORT normalizeAngleDeg(double &angleDeg)
void RDKIT_FORCEFIELD_EXPORT computeDihedral(const RDGeom::PointPtrVect &pos, unsigned int idx1, unsigned int idx2, unsigned int idx3, unsigned int idx4, double *dihedral=nullptr, double *cosPhi=nullptr, RDGeom::Point3D r[4]=nullptr, RDGeom::Point3D t[2]=nullptr, double d[2]=nullptr)
std::vector< Snapshot > SnapshotVect