Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

Gradient Class Reference
[General Force Field Classes.]

Gradient class. More...

#include <gradient.h>

List of all members.

Public Types

typedef std::vector< Vector3
>::iterator 
Iterator
 Iterator type.
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
Gradientoperator= (const Gradient &rhs)
 Assignment operator.
Gradientoperator= (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 Vector3operator[] (int i) const
Vector3operator[] (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_


Detailed Description

Gradient class.

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.


Member Function Documentation

Iterator Gradient::end  ) 
 

Return a past-the-end vector.

void Gradient::invalidate  ) 
 

Invalidate the gradient.

bool Gradient::isValid  )  const
 

Return the validity flag.

void Gradient::negate  ) 
 

Negate the gradient.

Iterate over all force vectors of the gradient and invert the signs.

void Gradient::normalize  ) 
 

Normalize the gradient.

Rescale to unity length

double Gradient::operator * const Gradient gradient  )  const
 

Dot product operator.

Exceptions:
InvalidRange if the two gradients have different sizes

Gradient& Gradient::operator= const AtomVector rhs  ) 
 

Assign from an array of atom pointers.

ReverseIterator Gradient::rend  ) 
 

Return a reverse past-the-end vector.

void Gradient::set const AtomVector atoms  ) 
 

Assign from an array of atom pointers.


Member Data Documentation

double Gradient::inv_norm
 

The inverse of the gradient norm.

double Gradient::norm
 

The gradient norm.

double Gradient::rms
 

The root mean square of the gradient.