BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Protected Attributes | List of all members
BALL::Gradient Class Reference

#include <BALL/MOLMEC/COMMON/gradient.h>

Inheritance diagram for BALL::Gradient:

Public Types

typedef std::vector< Vector3 >
::iterator 
Iterator
 
typedef std::vector< Vector3 >
::const_iterator 
ConstIterator
 
typedef std::vector< Vector3 >
::reverse_iterator 
ReverseIterator
 
typedef std::vector< Vector3 >
::const_reverse_iterator 
ConstReverseIterator
 

Public Member Functions

Constructors and Destructors
 Gradient ()
 
 Gradient (const AtomVector &atoms)
 
 Gradient (const Gradient &gradient, bool deep=true)
 
virtual ~Gradient ()
 
Assignments
Gradientoperator= (const Gradient &rhs)
 
Gradientoperator= (const AtomVector &rhs)
 
void set (const Gradient &gradient)
 
void set (const AtomVector &atoms)
 
void negate ()
 
void normalize ()
 
double operator* (const Gradient &gradient) const
 
Accessors
const Vector3operator[] (int i) const
 
Vector3operator[] (int i)
 
void invalidate ()
 
bool isValid () const
 
Iteration
Iterator begin ()
 
ConstIterator begin () const
 
Iterator end ()
 
ConstIterator end () const
 
ReverseIterator rbegin ()
 
ConstReverseIterator rbegin () const
 
ReverseIterator rend ()
 
ConstReverseIterator rend () const
 

Public Attributes

Public Attributes
double norm
 
double inv_norm
 
double rms
 

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.

Definition at line 43 of file gradient.h.

Member Typedef Documentation

typedef std::vector<Vector3>::const_iterator BALL::Gradient::ConstIterator

Const iterator type

Definition at line 60 of file gradient.h.

typedef std::vector<Vector3>::const_reverse_iterator BALL::Gradient::ConstReverseIterator

Const iterator type

Definition at line 68 of file gradient.h.

typedef std::vector<Vector3>::iterator BALL::Gradient::Iterator

Type definitionsIterator type

Definition at line 56 of file gradient.h.

typedef std::vector<Vector3>::reverse_iterator BALL::Gradient::ReverseIterator

Iterator type

Definition at line 64 of file gradient.h.

Constructor & Destructor Documentation

BALL::Gradient::Gradient ( )

Default constructor.

BALL::Gradient::Gradient ( const AtomVector atoms)

Construct from atom forces

BALL::Gradient::Gradient ( const Gradient gradient,
bool  deep = true 
)

Copy constructor

virtual BALL::Gradient::~Gradient ( )
virtual

Destructor.

Member Function Documentation

Iterator BALL::Gradient::begin ( )
inline

Return an iterator to the begining of the vector

Definition at line 161 of file gradient.h.

ConstIterator BALL::Gradient::begin ( ) const
inline

Definition at line 162 of file gradient.h.

Iterator BALL::Gradient::end ( )
inline

Return a past-the-end vector.

Definition at line 167 of file gradient.h.

ConstIterator BALL::Gradient::end ( ) const
inline

Definition at line 168 of file gradient.h.

void BALL::Gradient::invalidate ( )

Invalidate the gradient.

bool BALL::Gradient::isValid ( ) const

Return the validity flag.

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

double BALL::Gradient::operator* ( const Gradient gradient) const

Dot product operator

Exceptions
InvalidRangeif the two gradients have different sizes
Gradient& BALL::Gradient::operator= ( const Gradient rhs)

Assignment operator

Gradient& BALL::Gradient::operator= ( const AtomVector rhs)

Assign from an array of atom pointers.

const Vector3& BALL::Gradient::operator[] ( int  i) const
inline

Definition at line 141 of file gradient.h.

Vector3& BALL::Gradient::operator[] ( int  i)
inline

Definition at line 142 of file gradient.h.

ReverseIterator BALL::Gradient::rbegin ( )
inline

Return an iterator to the reverse begining of the vector

Definition at line 173 of file gradient.h.

ConstReverseIterator BALL::Gradient::rbegin ( ) const
inline

Definition at line 174 of file gradient.h.

ReverseIterator BALL::Gradient::rend ( )
inline

Return a reverse past-the-end vector.

Definition at line 179 of file gradient.h.

ConstReverseIterator BALL::Gradient::rend ( ) const
inline

Definition at line 180 of file gradient.h.

void BALL::Gradient::set ( const Gradient gradient)

Assign from another gradient

void BALL::Gradient::set ( const AtomVector atoms)

Assign from an array of atom pointers.

Member Data Documentation

double BALL::Gradient::inv_norm

The inverse of the gradient norm.

Definition at line 193 of file gradient.h.

double BALL::Gradient::norm

The gradient norm.

Definition at line 189 of file gradient.h.

double BALL::Gradient::rms

The root mean square of the gradient.

Definition at line 197 of file gradient.h.

bool BALL::Gradient::valid_
protected

Definition at line 205 of file gradient.h.