#include <ForceField.h>
Public Member Functions | |
| ForceField (unsigned int dimension=3) | |
| construct with a dimension | |
| ~ForceField () | |
| void | initialize () |
| does initialization | |
| double | calcEnergy () const |
| calculates and returns the energy based on existing positions in the forcefield | |
| double | calcEnergy (double *pos) |
| calculates and returns the energy of the position passed in | |
| void | calcGrad (double *forces) const |
| calculates the gradient of the energy at the current position | |
| void | calcGrad (double *pos, double *forces) |
| calculates the gradient of the energy at the provided position | |
| int | minimize (unsigned int maxIts=200, double forceTol=1e-4, double energyTol=1e-6) |
| minimizes the energy of the system by following gradients | |
| RDGeom::PointPtrVect & | positions () |
| returns a reference to our points (a PointPtrVect) | |
| const RDGeom::PointPtrVect & | positions () const |
| ContribPtrVect & | contribs () |
| returns a reference to our contribs (a ContribPtrVect) | |
| const ContribPtrVect & | contribs () const |
| double | distance (unsigned int i, unsigned int j, double *pos=0) |
| returns the distance between two points | |
| double | distance (unsigned int i, unsigned int j, double *pos=0) const |
| returns the distance between two points | |
| unsigned int | dimension () const |
| returns the dimension of the forcefield | |
| unsigned int | numPoints () const |
| returns the number of points the ForceField is handling | |
| INT_VECT & | fixedPoints () |
| const INT_VECT & | fixedPoints () const |
Protected Member Functions | |
| void | scatter (double *pos) const |
| scatter our positions into an array | |
| void | gather (double *pos) |
| update our positions from an array | |
| void | initDistanceMatrix () |
| initializes our internal distance matrix | |
Protected Attributes | |
| unsigned int | d_dimension |
| bool | df_init |
| whether or not we've been initialized | |
| unsigned int | d_numPoints |
| the number of active points | |
| double * | dp_distMat |
| our internal distance matrix | |
| RDGeom::PointPtrVect | d_positions |
| pointers to the points we're using | |
| ContribPtrVect | d_contribs |
| contributions to the energy | |
| INT_VECT | d_fixedPoints |
| unsigned int | d_matSize |
A force field is used like this (schematically):
ForceField ff;
// add contributions:
for contrib in contribs:
ff.contribs().push_back(contrib);
// set up the points:
for positionPtr in positions:
ff.positions().push_back(point);
// initialize:
ff.initialize()
// and minimize:
needsMore = ff.minimize();
Notes:
Definition at line 51 of file ForceField.h.
| ForceFields::ForceField::ForceField | ( | unsigned int | dimension = 3 |
) | [inline] |
| ForceFields::ForceField::~ForceField | ( | ) |
| void ForceFields::ForceField::initialize | ( | ) |
does initialization
| double ForceFields::ForceField::calcEnergy | ( | ) | const |
calculates and returns the energy based on existing positions in the forcefield
| double ForceFields::ForceField::calcEnergy | ( | double * | pos | ) |
calculates and returns the energy of the position passed in
| pos | an array of doubles. Should be 3*this->numPoints() long. |
| void ForceFields::ForceField::calcGrad | ( | double * | forces | ) | const |
calculates the gradient of the energy at the current position
| forces | an array of doubles. Should be 3*this->numPoints() long. |
| void ForceFields::ForceField::calcGrad | ( | double * | pos, | |
| double * | forces | |||
| ) |
calculates the gradient of the energy at the provided position
| pos | an array of doubles. Should be 3*this->numPoints() long. | |
| forces | an array of doubles. Should be 3*this->numPoints() long. |
| int ForceFields::ForceField::minimize | ( | unsigned int | maxIts = 200, |
|
| double | forceTol = 1e-4, |
|||
| double | energyTol = 1e-6 | |||
| ) |
minimizes the energy of the system by following gradients
| maxIts | the maximum number of iterations to try | |
| forceTol | the convergence criterion for forces | |
| energyTol | the convergence criterion for energies |
maxIts iterations. | RDGeom::PointPtrVect& ForceFields::ForceField::positions | ( | ) | [inline] |
returns a reference to our points (a PointPtrVect)
Definition at line 128 of file ForceField.h.
References d_positions.
| const RDGeom::PointPtrVect& ForceFields::ForceField::positions | ( | ) | const [inline] |
| ContribPtrVect& ForceFields::ForceField::contribs | ( | ) | [inline] |
returns a reference to our contribs (a ContribPtrVect)
Definition at line 132 of file ForceField.h.
References d_contribs.
| const ContribPtrVect& ForceFields::ForceField::contribs | ( | ) | const [inline] |
| double ForceFields::ForceField::distance | ( | unsigned int | i, | |
| unsigned int | j, | |||
| double * | pos = 0 | |||
| ) |
returns the distance between two points
| i | point index | |
| j | point index | |
| pos | (optional) If this argument is provided, it will be used to provide the positions of points. pos should be 3*this->numPoints() long. |
| double ForceFields::ForceField::distance | ( | unsigned int | i, | |
| unsigned int | j, | |||
| double * | pos = 0 | |||
| ) | const |
returns the distance between two points
| i | point index | |
| j | point index | |
| pos | (optional) If this argument is provided, it will be used to provide the positions of points. pos should be 3*this->numPoints() long. |
| unsigned int ForceFields::ForceField::dimension | ( | ) | const [inline] |
returns the dimension of the forcefield
Definition at line 167 of file ForceField.h.
References d_dimension.
Referenced by DistGeom::FourthDimContrib::FourthDimContrib().
| unsigned int ForceFields::ForceField::numPoints | ( | ) | const [inline] |
returns the number of points the ForceField is handling
Definition at line 172 of file ForceField.h.
References d_numPoints.
| INT_VECT& ForceFields::ForceField::fixedPoints | ( | ) | [inline] |
| const INT_VECT& ForceFields::ForceField::fixedPoints | ( | ) | const [inline] |
| void ForceFields::ForceField::scatter | ( | double * | pos | ) | const [protected] |
| void ForceFields::ForceField::gather | ( | double * | pos | ) | [protected] |
| void ForceFields::ForceField::initDistanceMatrix | ( | ) | [protected] |
initializes our internal distance matrix
unsigned int ForceFields::ForceField::d_dimension [protected] |
bool ForceFields::ForceField::df_init [protected] |
unsigned int ForceFields::ForceField::d_numPoints [protected] |
double* ForceFields::ForceField::dp_distMat [protected] |
pointers to the points we're using
Definition at line 182 of file ForceField.h.
Referenced by positions().
ContribPtrVect ForceFields::ForceField::d_contribs [protected] |
INT_VECT ForceFields::ForceField::d_fixedPoints [protected] |
unsigned int ForceFields::ForceField::d_matSize [protected] |
Definition at line 185 of file ForceField.h.
1.5.6