Public Member Functions | Private Attributes | Friends | List of all members
PLMD::MultiValue Class Reference

#include <MultiValue.h>

Public Member Functions

 MultiValue (const std::size_t &nvals, const std::size_t &nder, const std::size_t &nmat=0, const std::size_t &maxcol=0, const std::size_t &nbook=0)
 
void addDerivative (const std::size_t &, const std::size_t &, const double &)
 Add derivative. More...
 
void addMatrixForce (const unsigned &imat, const unsigned &jind, const double &f)
 Stash the forces on the matrix. More...
 
void addTemporyDerivative (const unsigned &jder, const double &der)
 Add tempory derivatives - this is used for calculating quotients. More...
 
void addTemporyValue (const double &val)
 Add to the tempory value. More...
 
void addValue (const std::size_t &, const double &)
 Add value numbered. More...
 
void chainRule (const unsigned &, const unsigned &, const unsigned &, const unsigned &, const double &, const unsigned &, std::vector< double > &buffer)
 Transfer derivatives to buffer. More...
 
void clear (const unsigned &)
 Clear a value. More...
 
void clearActiveMembers (const std::size_t &ival)
 
void clearAll (const bool &newversion=false)
 Clear all values. More...
 
void clearDerivatives (const unsigned &)
 Clear the derivatives. More...
 
void clearTemporyDerivatives ()
 Clear the tempory derivatives. More...
 
void completeUpdate ()
 
void copyDerivatives (MultiValue &)
 
void copyValues (MultiValue &) const
 
void emptyActiveMembers ()
 
double get (const std::size_t &) const
 Return the ith value. More...
 
unsigned getActiveIndex (const std::size_t &, const std::size_t &) const
 
unsigned getActiveIndex (const unsigned &) const
 
std::vector< Vector > & getAtomVector ()
 
const std::vector< std::vector< Vector > > & getConstFirstAtomDerivativeVector () const
 
double getDerivative (const std::size_t &, const std::size_t &) const
 Return a derivative value. More...
 
std::vector< std::vector< Vector > > & getFirstAtomDerivativeVector ()
 
std::vector< Vector > & getFirstAtomVector ()
 Get references to some memory. More...
 
std::vector< Tensor > & getFirstAtomVirialVector ()
 
std::vector< unsigned > & getIndices ()
 
const std::vector< unsigned > & getMatrixBookeeping () const
 Get the matrix bookeeping array. More...
 
std::vector< unsigned > & getMatrixRowDerivativeIndices (const unsigned &nmat)
 
unsigned getNumberActive () const
 
unsigned getNumberActive (const std::size_t &) const
 
unsigned getNumberOfDerivatives () const
 Get the number of derivatives in the stash. More...
 
std::size_t getNumberOfIndices () const
 
unsigned getNumberOfMatrixRowDerivatives (const unsigned &nmat) const
 
unsigned getNumberOfValues () const
 Get the number of values in the stash. More...
 
std::size_t getSecondTaskIndex () const
 Get the task index. More...
 
std::vector< unsigned > & getSortIndices ()
 
std::size_t getSplitIndex () const
 
double getStashedMatrixElement (const unsigned &nmat, const unsigned &jcol) const
 
double getStashedMatrixForce (const unsigned &imat, const unsigned &jind) const
 
std::size_t getTaskIndex () const
 
double getTemporyDerivative (const unsigned &jder) const
 Get one of the tempory derivatives. More...
 
std::vector< double > & getTemporyVector (const unsigned &ind)
 
bool inVectorCall () const
 
bool isActive (const unsigned &ind) const
 
void putIndexInActiveArray (const unsigned &)
 
void quotientRule (const unsigned &nder, const unsigned &oder)
 
void resize (const std::size_t &nvals, const std::size_t &nder, const std::size_t &nmat=0, const std::size_t &maxcol=0, const std::size_t &nbook=0)
 
void resizeTemporyVector (const unsigned &n)
 
void setDerivative (const std::size_t &ival, const std::size_t &jder, const double &der)
 Set the value of the derivative. More...
 
void setNumberOfIndices (const std::size_t &nat)
 
void setNumberOfMatrixRowDerivatives (const unsigned &nmat, const unsigned &nind)
 Get the bookeeping stuff for the derivatives wrt to rows of matrix. More...
 
void setSecondTaskIndex (const std::size_t &tindex)
 
void setSplitIndex (const std::size_t &nat)
 
void setTaskIndex (const std::size_t &tindex)
 Set the task index prior to the loop. More...
 
void setValue (const std::size_t &, const double &)
 Set value numbered. More...
 
void sortActiveList ()
 
void stashMatrixElement (const unsigned &nmat, const unsigned &rowstart, const unsigned &jcol, const double &val)
 
bool updateComplete ()
 Functions for accessing active list. More...
 
void updateDynamicList ()
 
void updateIndex (const std::size_t &, const std::size_t &)
 
void updateIndex (const unsigned &)
 

Private Attributes

std::vector< unsigned > active_list
 
bool atLeastOneSet
 Logical to check if any derivatives were set. More...
 
std::vector< double > derivatives
 Derivatives. More...
 
std::vector< bool > hasderiv
 Matrix asserting which values have derivatives. More...
 
DynamicList< unsigned > hasDerivatives
 Used to ensure rapid accumulation of derivatives. More...
 
std::vector< unsigned > indices
 This is a fudge to save on vector resizing in MultiColvar. More...
 
std::vector< unsigned > matrix_bookeeping
 
std::vector< double > matrix_force_stash
 
std::vector< std::vector< unsigned > > matrix_row_derivative_indices
 
std::vector< unsigned > matrix_row_nderivatives
 These are used to store the indices that have derivatives wrt to at least one of the elements in a matrix. More...
 
std::vector< double > matrix_row_stash
 
std::vector< unsigned > nactive
 Lists of active variables. More...
 
unsigned nderivatives
 Number of derivatives per value. More...
 
unsigned nindices
 
unsigned nmatrix_cols
 This allows us to store matrix elements. More...
 
unsigned nsplit
 
std::vector< unsigned > sort_indices
 
std::size_t task2_index
 
std::size_t task_index
 The index of the task we are currently performing. More...
 
std::vector< std::vector< Vector > > tmp_atom_der
 
std::vector< Tensortmp_atom_virial
 
std::vector< Vectortmp_atoms
 
std::vector< std::vector< double > > tmp_vectors
 
std::vector< double > tmpder
 Tempory vector of derivatives (used for calculating quotients. More...
 
double tmpval
 Tempory value. More...
 
std::vector< double > values
 Values of quantities. More...
 
bool vector_call
 Are we in this for a call on vectors. More...
 

Friends

class ActionWithVector
 

Constructor & Destructor Documentation

◆ MultiValue()

PLMD::MultiValue::MultiValue ( const std::size_t &  nvals,
const std::size_t &  nder,
const std::size_t &  nmat = 0,
const std::size_t &  maxcol = 0,
const std::size_t &  nbook = 0 
)

Member Function Documentation

◆ addDerivative()

void PLMD::MultiValue::addDerivative ( const std::size_t &  ival,
const std::size_t &  jder,
const double &  der 
)
inline

Add derivative.

◆ addMatrixForce()

void PLMD::MultiValue::addMatrixForce ( const unsigned &  imat,
const unsigned &  jind,
const double &  f 
)
inline

Stash the forces on the matrix.

◆ addTemporyDerivative()

void PLMD::MultiValue::addTemporyDerivative ( const unsigned &  jder,
const double &  der 
)
inline

Add tempory derivatives - this is used for calculating quotients.

◆ addTemporyValue()

void PLMD::MultiValue::addTemporyValue ( const double &  val)
inline

Add to the tempory value.

◆ addValue()

void PLMD::MultiValue::addValue ( const std::size_t &  ival,
const double &  val 
)
inline

Add value numbered.

◆ chainRule()

void PLMD::MultiValue::chainRule ( const unsigned &  ival,
const unsigned &  iout,
const unsigned &  stride,
const unsigned &  off,
const double &  df,
const unsigned &  bufstart,
std::vector< double > &  buffer 
)

Transfer derivatives to buffer.

◆ clear()

void PLMD::MultiValue::clear ( const unsigned &  ival)

Clear a value.

◆ clearActiveMembers()

void PLMD::MultiValue::clearActiveMembers ( const std::size_t &  ival)
inline

◆ clearAll()

void PLMD::MultiValue::clearAll ( const bool &  newversion = false)

Clear all values.

◆ clearDerivatives()

void PLMD::MultiValue::clearDerivatives ( const unsigned &  ival)

Clear the derivatives.

◆ clearTemporyDerivatives()

void PLMD::MultiValue::clearTemporyDerivatives ( )

Clear the tempory derivatives.

◆ completeUpdate()

void PLMD::MultiValue::completeUpdate ( )
inline

◆ copyDerivatives()

void PLMD::MultiValue::copyDerivatives ( MultiValue outvals)

◆ copyValues()

void PLMD::MultiValue::copyValues ( MultiValue outvals) const

◆ emptyActiveMembers()

void PLMD::MultiValue::emptyActiveMembers ( )
inline

◆ get()

double PLMD::MultiValue::get ( const std::size_t &  ival) const
inline

Return the ith value.

◆ getActiveIndex() [1/2]

unsigned PLMD::MultiValue::getActiveIndex ( const std::size_t &  ival,
const std::size_t &  ind 
) const
inline

◆ getActiveIndex() [2/2]

unsigned PLMD::MultiValue::getActiveIndex ( const unsigned &  ind) const
inline

◆ getAtomVector()

std::vector< Vector > & PLMD::MultiValue::getAtomVector ( )
inline

◆ getConstFirstAtomDerivativeVector()

const std::vector< std::vector< Vector > > & PLMD::MultiValue::getConstFirstAtomDerivativeVector ( ) const
inline

◆ getDerivative()

double PLMD::MultiValue::getDerivative ( const std::size_t &  ival,
const std::size_t &  jder 
) const
inline

Return a derivative value.

◆ getFirstAtomDerivativeVector()

std::vector< std::vector< Vector > > & PLMD::MultiValue::getFirstAtomDerivativeVector ( )
inline

◆ getFirstAtomVector()

std::vector< Vector > & PLMD::MultiValue::getFirstAtomVector ( )
inline

Get references to some memory.

These vectors allow us to avoid doing lots of resizing of vectors in MultiColvarTemplate

◆ getFirstAtomVirialVector()

std::vector< Tensor > & PLMD::MultiValue::getFirstAtomVirialVector ( )
inline

◆ getIndices()

std::vector< unsigned > & PLMD::MultiValue::getIndices ( )
inline

◆ getMatrixBookeeping()

const std::vector< unsigned > & PLMD::MultiValue::getMatrixBookeeping ( ) const
inline

Get the matrix bookeeping array.

◆ getMatrixRowDerivativeIndices()

std::vector< unsigned > & PLMD::MultiValue::getMatrixRowDerivativeIndices ( const unsigned &  nmat)
inline

◆ getNumberActive() [1/2]

unsigned PLMD::MultiValue::getNumberActive ( ) const
inline

◆ getNumberActive() [2/2]

unsigned PLMD::MultiValue::getNumberActive ( const std::size_t &  ival) const
inline

◆ getNumberOfDerivatives()

unsigned PLMD::MultiValue::getNumberOfDerivatives ( ) const
inline

Get the number of derivatives in the stash.

◆ getNumberOfIndices()

std::size_t PLMD::MultiValue::getNumberOfIndices ( ) const
inline

◆ getNumberOfMatrixRowDerivatives()

unsigned PLMD::MultiValue::getNumberOfMatrixRowDerivatives ( const unsigned &  nmat) const
inline

◆ getNumberOfValues()

unsigned PLMD::MultiValue::getNumberOfValues ( ) const
inline

Get the number of values in the stash.

◆ getSecondTaskIndex()

std::size_t PLMD::MultiValue::getSecondTaskIndex ( ) const
inline

Get the task index.

◆ getSortIndices()

std::vector< unsigned > & PLMD::MultiValue::getSortIndices ( )
inline

◆ getSplitIndex()

std::size_t PLMD::MultiValue::getSplitIndex ( ) const
inline

◆ getStashedMatrixElement()

double PLMD::MultiValue::getStashedMatrixElement ( const unsigned &  nmat,
const unsigned &  jcol 
) const
inline

◆ getStashedMatrixForce()

double PLMD::MultiValue::getStashedMatrixForce ( const unsigned &  imat,
const unsigned &  jind 
) const
inline

◆ getTaskIndex()

std::size_t PLMD::MultiValue::getTaskIndex ( ) const
inline

◆ getTemporyDerivative()

double PLMD::MultiValue::getTemporyDerivative ( const unsigned &  jder) const
inline

Get one of the tempory derivatives.

◆ getTemporyVector()

std::vector< double > & PLMD::MultiValue::getTemporyVector ( const unsigned &  ind)
inline

◆ inVectorCall()

bool PLMD::MultiValue::inVectorCall ( ) const
inline

◆ isActive()

bool PLMD::MultiValue::isActive ( const unsigned &  ind) const
inline

◆ putIndexInActiveArray()

void PLMD::MultiValue::putIndexInActiveArray ( const unsigned &  ind)
inline

◆ quotientRule()

void PLMD::MultiValue::quotientRule ( const unsigned &  nder,
const unsigned &  oder 
)

◆ resize()

void PLMD::MultiValue::resize ( const std::size_t &  nvals,
const std::size_t &  nder,
const std::size_t &  nmat = 0,
const std::size_t &  maxcol = 0,
const std::size_t &  nbook = 0 
)

◆ resizeTemporyVector()

void PLMD::MultiValue::resizeTemporyVector ( const unsigned &  n)
inline

◆ setDerivative()

void PLMD::MultiValue::setDerivative ( const std::size_t &  ival,
const std::size_t &  jder,
const double &  der 
)
inline

Set the value of the derivative.

◆ setNumberOfIndices()

void PLMD::MultiValue::setNumberOfIndices ( const std::size_t &  nat)
inline

◆ setNumberOfMatrixRowDerivatives()

void PLMD::MultiValue::setNumberOfMatrixRowDerivatives ( const unsigned &  nmat,
const unsigned &  nind 
)
inline

Get the bookeeping stuff for the derivatives wrt to rows of matrix.

◆ setSecondTaskIndex()

void PLMD::MultiValue::setSecondTaskIndex ( const std::size_t &  tindex)
inline

◆ setSplitIndex()

void PLMD::MultiValue::setSplitIndex ( const std::size_t &  nat)
inline

◆ setTaskIndex()

void PLMD::MultiValue::setTaskIndex ( const std::size_t &  tindex)
inline

Set the task index prior to the loop.

◆ setValue()

void PLMD::MultiValue::setValue ( const std::size_t &  ival,
const double &  val 
)
inline

Set value numbered.

◆ sortActiveList()

void PLMD::MultiValue::sortActiveList ( )
inline

◆ stashMatrixElement()

void PLMD::MultiValue::stashMatrixElement ( const unsigned &  nmat,
const unsigned &  rowstart,
const unsigned &  jcol,
const double &  val 
)
inline

◆ updateComplete()

bool PLMD::MultiValue::updateComplete ( )
inline

Functions for accessing active list.

◆ updateDynamicList()

void PLMD::MultiValue::updateDynamicList ( )
inline

◆ updateIndex() [1/2]

void PLMD::MultiValue::updateIndex ( const std::size_t &  ival,
const std::size_t &  jder 
)
inline

◆ updateIndex() [2/2]

void PLMD::MultiValue::updateIndex ( const unsigned &  ind)
inline

Friends And Related Function Documentation

◆ ActionWithVector

friend class ActionWithVector
friend

Member Data Documentation

◆ active_list

std::vector<unsigned> PLMD::MultiValue::active_list
private

◆ atLeastOneSet

bool PLMD::MultiValue::atLeastOneSet
private

Logical to check if any derivatives were set.

◆ derivatives

std::vector<double> PLMD::MultiValue::derivatives
private

Derivatives.

◆ hasderiv

std::vector<bool> PLMD::MultiValue::hasderiv
private

Matrix asserting which values have derivatives.

◆ hasDerivatives

DynamicList<unsigned> PLMD::MultiValue::hasDerivatives
private

Used to ensure rapid accumulation of derivatives.

◆ indices

std::vector<unsigned> PLMD::MultiValue::indices
private

This is a fudge to save on vector resizing in MultiColvar.

◆ matrix_bookeeping

std::vector<unsigned> PLMD::MultiValue::matrix_bookeeping
private

◆ matrix_force_stash

std::vector<double> PLMD::MultiValue::matrix_force_stash
private

◆ matrix_row_derivative_indices

std::vector<std::vector<unsigned> > PLMD::MultiValue::matrix_row_derivative_indices
private

◆ matrix_row_nderivatives

std::vector<unsigned> PLMD::MultiValue::matrix_row_nderivatives
private

These are used to store the indices that have derivatives wrt to at least one of the elements in a matrix.

◆ matrix_row_stash

std::vector<double> PLMD::MultiValue::matrix_row_stash
private

◆ nactive

std::vector<unsigned> PLMD::MultiValue::nactive
private

Lists of active variables.

◆ nderivatives

unsigned PLMD::MultiValue::nderivatives
private

Number of derivatives per value.

◆ nindices

unsigned PLMD::MultiValue::nindices
private

◆ nmatrix_cols

unsigned PLMD::MultiValue::nmatrix_cols
private

This allows us to store matrix elements.

◆ nsplit

unsigned PLMD::MultiValue::nsplit
private

◆ sort_indices

std::vector<unsigned> PLMD::MultiValue::sort_indices
private

◆ task2_index

std::size_t PLMD::MultiValue::task2_index
private

◆ task_index

std::size_t PLMD::MultiValue::task_index
private

The index of the task we are currently performing.

◆ tmp_atom_der

std::vector<std::vector<Vector> > PLMD::MultiValue::tmp_atom_der
private

◆ tmp_atom_virial

std::vector<Tensor> PLMD::MultiValue::tmp_atom_virial
private

◆ tmp_atoms

std::vector<Vector> PLMD::MultiValue::tmp_atoms
private

◆ tmp_vectors

std::vector<std::vector<double> > PLMD::MultiValue::tmp_vectors
private

◆ tmpder

std::vector<double> PLMD::MultiValue::tmpder
private

Tempory vector of derivatives (used for calculating quotients.

◆ tmpval

double PLMD::MultiValue::tmpval
private

Tempory value.

◆ values

std::vector<double> PLMD::MultiValue::values
private

Values of quantities.

◆ vector_call

bool PLMD::MultiValue::vector_call
private

Are we in this for a call on vectors.


The documentation for this class was generated from the following files: