#include <gradient.h>
Inherits std::vector<Vector3>.
Public Types |
||||
typedef std::vector< Vector3 > ::iterator |
Iterator | |||
Type definitions. |
||||
typedef std::vector< Vector3 > ::const_iterator |
ConstIterator | |||
Const iterator type. |
||||
typedef std::vector< Vector3 > ::reverse_iterator |
ReverseIterator | |||
Iterator type. |
||||
typedef std::vector< Vector3 > ::const_reverse_iterator |
ConstReverseIterator | |||
Const iterator type. |
||||
Public Member Functions |
||||
Constructors and Destructors
|
||||
Gradient () | ||||
Default constructor. |
||||
Gradient (const AtomVector &atoms) | ||||
Construct from atom
forces. |
||||
Gradient (const Gradient &gradient, bool deep=true) | ||||
Copy constructor. |
||||
virtual | ~Gradient () | |||
Destructor. |
||||
Assignments
|
||||
Gradient & | operator= (const Gradient &rhs) | |||
Assignment operator. |
||||
Gradient & | operator= (const AtomVector &rhs) | |||
Assign from an array of atom
pointers. |
||||
void | set (const Gradient &gradient) | |||
Assign from another
gradient. |
||||
void | set (const AtomVector &atoms) | |||
Assign from an array of atom
pointers. |
||||
void | negate () | |||
Negate the gradient. |
||||
void | normalize () | |||
Normalize the gradient. |
||||
double | operator* (const Gradient &gradient) const | |||
Dot product operator
|
||||
Accessors
|
||||
const Vector3 & | operator[] (int i) const | |||
Vector3 & | operator[] (int i) | |||
void | invalidate () | |||
Invalidate the gradient. |
||||
bool | isValid () const | |||
Return the validity flag. |
||||
Iteration
|
||||
Iterator | begin () | |||
Return an iterator to the begining
of the vector. |
||||
ConstIterator | begin () const | |||
Iterator | end () | |||
Return a past-the-end
vector. |
||||
ConstIterator | end () const | |||
ReverseIterator | rbegin () | |||
Return an iterator to the reverse
begining of the vector. |
||||
ConstReverseIterator | rbegin () const | |||
ReverseIterator | rend () | |||
Return a reverse past-the-end
vector. |
||||
ConstReverseIterator | rend () const | |||
Public Attributes |
||||
Public Attributes
|
||||
double | norm | |||
The gradient norm. |
||||
double | inv_norm | |||
The inverse of the gradient
norm. |
||||
double | rms | |||
The root mean square of the
gradient. |
||||
Protected Attributes |
||||
bool | valid_ |
This class is used in the Minimizers to represent gradients and directions. These gradients are extracted from a vector of atom pointers, if the forces of the atoms are correctly set (e.g. using ForceField::updateForces()). The gradient contains the negative forces from each atom. Forces are converted from Newton (N) to units of f$kJ/(mol )f$. A gradient may be invalidated by calling invalidate . This method only flags the gradient as invalid, the data is untouched. This may be used to initiate automatic recalculations of the gradient. This class is used by all minimizer classes.
typedef std::vector<Vector3>::iterator BALL::Gradient::Iterator |
Type definitions.
Iterator type
void BALL::Gradient::negate | ( | ) |
Negate the gradient.
Iterate over all force vectors of the gradient and invert the signs.
void BALL::Gradient::normalize | ( | ) |
Normalize the gradient.
Rescale to unity length