Loading...
Searching...
No Matches
BALL::Gradient Class Reference
Molecular Modeling » Molecular Mechanics » General Force Field Classes.

`#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
Gradient & | operator= (const Gradient &rhs)
Gradient & | operator= (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 Vector3 & | operator[] (int i) const
Vector3 & | operator[] (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

double | norm
double | inv_norm
double | rms
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 \AA)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

## ConstIterator

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

Const iterator type

Definition at line 60 of file gradient.h.

## ConstReverseIterator

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

Const iterator type

Definition at line 68 of file gradient.h.

## Iterator

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

Type definitions Iterator type

Definition at line 56 of file gradient.h.

## ReverseIterator

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

Iterator type

Definition at line 64 of file gradient.h.

## Constructor & Destructor Documentation

## Gradient() [1/3]

BALL::Gradient::Gradient | ( |  | ) |

Default constructor.

## Gradient() [2/3]

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

Construct from atom forces

## Gradient() [3/3]

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

Copy constructor

## ~Gradient()

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

virtual

Destructor.

## Member Function Documentation

## begin() [1/2]

Iterator BALL::Gradient::begin | ( |  | ) |

inline

Return an iterator to the begining of the vector

Definition at line 161 of file gradient.h.

## begin() [2/2]

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

inline

Definition at line 162 of file gradient.h.

## end() [1/2]

Iterator BALL::Gradient::end | ( |  | ) |

inline

Return a past-the-end vector.

Definition at line 167 of file gradient.h.

## end() [2/2]

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

inline

Definition at line 168 of file gradient.h.

## invalidate()

void BALL::Gradient::invalidate | ( |  | ) |

Invalidate the gradient.

## isValid()

bool BALL::Gradient::isValid | ( |  | ) | const

Return the validity flag.

## negate()

void BALL::Gradient::negate | ( |  | ) |

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

## normalize()

void BALL::Gradient::normalize | ( |  | ) |

Normalize the gradient. Rescale to unity length

## operator*()

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

Dot product operator

Exceptions

  InvalidRange | if the two gradients have different sizes

## operator=() [1/2]

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

Assign from an array of atom pointers.

## operator=() [2/2]

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

Assignment operator

## operator[]() [1/2]

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

inline

Definition at line 142 of file gradient.h.

## operator[]() [2/2]

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

inline

Definition at line 141 of file gradient.h.

## rbegin() [1/2]

ReverseIterator BALL::Gradient::rbegin | ( |  | ) |

inline

Return an iterator to the reverse begining of the vector

Definition at line 173 of file gradient.h.

## rbegin() [2/2]

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

inline

Definition at line 174 of file gradient.h.

## rend() [1/2]

ReverseIterator BALL::Gradient::rend | ( |  | ) |

inline

Return a reverse past-the-end vector.

Definition at line 179 of file gradient.h.

## rend() [2/2]

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

inline

Definition at line 180 of file gradient.h.

## set() [1/2]

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

Assign from an array of atom pointers.

## set() [2/2]

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

Assign from another gradient

## Member Data Documentation

## inv_norm

double BALL::Gradient::inv_norm

The inverse of the gradient norm.

Definition at line 193 of file gradient.h.

## norm

double BALL::Gradient::norm

The gradient norm.

Definition at line 189 of file gradient.h.

## rms

double BALL::Gradient::rms

The root mean square of the gradient.

Definition at line 197 of file gradient.h.

## valid_

bool BALL::Gradient::valid_

protected

Definition at line 205 of file gradient.h.