#include <Value.h>
Public Member Functions | |
Value () | |
A constructor that can be used to make Vectors of values. More... | |
Value (ActionWithValue *av, const std::string &name, const bool withderiv, const std::vector< unsigned > &ss=std::vector< unsigned >()) | |
A constructor that is used throughout the code to setup the value poiters. More... | |
Value (const std::string &name) | |
A constructor that can be used to make Vectors of named values. More... | |
void | add (const std::size_t &n, const double &v) |
Add something to the ith element of the data array. More... | |
void | add (double) |
Add something to the value of the function. More... | |
void | addDerivative (unsigned i, double d) |
Add some derivative to the ith component of the derivatives array. More... | |
void | addForce (const std::size_t &ival, double f, const bool trueind=true) |
Add some force on the ival th component of this value. More... | |
void | addForce (double f) |
Add some force on this value. More... | |
void | addGridDerivatives (const unsigned &n, const unsigned &j, const double &val) |
Add the derivatives of the grid to the corner. More... | |
bool | applyForce (std::vector< double > &forces) const |
Apply the forces to the derivatives using the chain rule (if there are no forces this routine returns false) More... | |
double | bringBackInPbc (double d1) const |
Bring back one value into the correct pbc if needed, else give back the value. More... | |
void | buildDataStore (const bool forprint=false) |
This turns on storing of vectors/matrices. More... | |
void | clearDerivatives (const bool force=false) |
Set all the derivatives to zero. More... | |
void | clearInputForce () |
Clear the input force on the variable. More... | |
void | clearInputForce (const std::vector< AtomNumber > &index) |
Special method for clearing forces on variables used by DataPassingObject. More... | |
void | convertIndexToindices (const std::size_t &index, std::vector< unsigned > &indices) const |
Convert the input index to its corresponding indices. More... | |
double | difference (double d1, double d2) const |
Calculate the difference between two values of this function: d2 -d1. More... | |
double | difference (double) const |
Calculate the difference between the instantaneous value of the function and some other point: other_point-inst_val. More... | |
bool | forcesWereAdded () const |
Check if forces have been added on this value. More... | |
double | get (const std::size_t &ival=0, const bool trueind=true) const |
Get the value of the function. More... | |
double | getDerivative (const unsigned n) const |
Get the derivative with respect to component n. More... | |
void | getDomain (double &, double &) const |
Get the domain of the quantity. More... | |
void | getDomain (std::string &, std::string &) const |
Get the domain of the quantity. More... | |
double | getForce (const std::size_t &ival=0) const |
Get the value of the force on this colvar. More... | |
unsigned | getGoodNumThreads (const unsigned &j, const unsigned &k) const |
Get the number of threads to use when assigning this value. More... | |
double | getGridDerivative (const unsigned &n, const unsigned &j) const |
get the derivative of a grid at a point n with resepct to argument j More... | |
std::size_t | getIndexInStore (const std::size_t &ival) const |
Get the location of this element of in the store. More... | |
unsigned | getMatrixBookeepingStart () const |
double | getMaxMinusMin () const |
Get the difference between max and minimum of domain. More... | |
const std::string & | getName () const |
Get the name of the quantity. More... | |
unsigned | getNumberOfColumns () const |
unsigned | getNumberOfDerivatives () const |
Get the number of derivatives that this particular value has. More... | |
unsigned | getNumberOfGridDerivatives () const |
Get the number of derivatives that the grid has. More... | |
unsigned | getNumberOfStoredValues () const |
Get the number of values that are actually stored here once sparse matrices are taken into account. More... | |
unsigned | getNumberOfValues () const |
Get the total number of scalars that are stored here. More... | |
ActionWithValue * | getPntrToAction () |
This returns the pointer to the action where this value is calculated. More... | |
unsigned | getPositionInMatrixStash () const |
unsigned | getPositionInStream () const |
unsigned | getRank () const |
Get the rank of the object that is contained in this value. More... | |
unsigned | getRowIndex (const unsigned &irow, const unsigned &jind) const |
unsigned | getRowLength (const unsigned &irow) const |
const std::vector< unsigned > & | getShape () const |
Get the shape of the object that is contained in this value. More... | |
std::string | getValueType () const |
Get the type of value that is stored here. More... | |
bool | hasDerivatives () const |
Check whether or not this particular quantity has derivatives. More... | |
bool | ignoreStoredValue (const std::string &n) const |
Are we to ignore the stored value. More... | |
bool | isConstant () const |
These are used for making constant values. More... | |
bool | isDerivativeZeroWhenValueIsZero () const |
Return a bool that tells us if the derivative is zero when the value is zero. More... | |
bool | isPeriodic () const |
Check if the value is periodic. More... | |
bool | isSymmetric () const |
void | passGradients (const double &der, std::map< AtomNumber, Vector > &g) const |
This passes gradients from one action to another. More... | |
void | print (OFile &ofile) const |
Print out all the values in this Value. More... | |
void | push_back (const double &val) |
Add another value to the end of the data vector held by this value. This is used in COLLECT. More... | |
void | readBinary (std::istream &i) |
void | reshapeMatrixStore (const unsigned &n) |
Reshape the storage for sparse matrices. More... | |
void | resizeDerivatives (int n) |
Set the number of derivatives. More... | |
void | retrieveEdgeList (unsigned &nedge, std::vector< std::pair< unsigned, unsigned > > &active, std::vector< double > &elems) |
Retrieve the non-zero edges in a matrix. More... | |
void | set (const std::size_t &n, const double &v) |
Set the value of the stored data. More... | |
void | set (double) |
Set the value of the function. More... | |
void | setConstant () |
void | setDerivative (unsigned i, double d) |
Set the value of the ith component of the derivatives array. More... | |
void | setDerivativeIsZeroWhenValueIsZero () |
Set a bool that tells us if the derivative is zero when the value is zero true. More... | |
void | setDomain (const std::string &, const std::string &) |
Set the domain of the function. More... | |
void | setGradients (ActionAtomistic *aa, unsigned &start) |
This sets up the gradients. More... | |
void | setGridDerivatives (const unsigned &n, const unsigned &j, const double &val) |
void | setMatrixBookeepingElement (const unsigned &i, const unsigned &n) |
Set a matrix element to be non zero. More... | |
void | setMatrixBookeepingStart (const unsigned &b) |
This stuff handles where to keep the bookeeping stuff for storing the sparse matrix. More... | |
void | setNotPeriodic () |
Set the function not periodic. More... | |
void | setPositionInMatrixStash (const unsigned &p) |
This stuff handles where to look for the start of the row that contains the row of the matrix. More... | |
void | setShape (const std::vector< unsigned > &ss) |
Set the shape of the Value. More... | |
void | setSymmetric (const bool &sym) |
Set the symmetric flag equal true for this matrix. More... | |
bool | valueHasBeenSet () const |
Find out if the value has been set. More... | |
bool | valueIsStored () const |
Are we storing this value. More... | |
void | writeBinary (std::ostream &o) const |
These are used for passing around the data in this value when we are doing replica exchange. More... | |
Static Public Member Functions | |
static double | projection (const Value &, const Value &) |
Private Types | |
enum | { normal, constant, average, calcFromAverage } |
The way this value is used in the code normal = regular value that is determined during calculate constant = constnt value that is determined during startup and that doesn't change during simulation average = value that is averaged/collected over multiple steps of trajectory calcFromAverage = value that is calculated from an average value. More... | |
enum | { unset, periodic, notperiodic } |
Is this quantity periodic. More... | |
Private Member Functions | |
void | applyPeriodicity (const unsigned &ival) |
bool | calculateOnUpdate () const |
This is used by ActionWithValue to determine if we need to calculate on update. More... | |
void | setupPeriodicity () |
Complete the setup of the periodicity. More... | |
void | setValType (const std::string &vtype) |
This is used by ActionWithValue to set the valtype. More... | |
Private Attributes | |
ActionWithValue * | action |
The action in which this quantity is calculated. More... | |
unsigned | book_start |
unsigned | bufstart |
Variables for storing data. More... | |
std::vector< double > | data |
The value of the quantity. More... | |
bool | derivativeIsZeroWhenValueIsZero |
Is the derivative of this quantity zero when the value is zero. More... | |
std::map< AtomNumber, Vector > | gradients |
The derivatives of the quantity stored in value. More... | |
bool | hasDeriv |
Does this quanity have derivatives. More... | |
bool | hasForce |
A flag telling us we have a force acting on this quantity. More... | |
std::vector< double > | inputForce |
The force acting on this quantity. More... | |
double | inv_max_minus_min |
unsigned | matpos |
std::vector< unsigned > | matrix_bookeeping |
This is a bookeeping array that holds the non-zero elements of the "sparse" matrix. More... | |
double | max |
double | max_minus_min |
double | min |
std::string | name |
The name of this quantiy. More... | |
unsigned | ncols |
unsigned | ngrid_der |
enum PLMD::Value:: { ... } | periodicity |
Is this quantity periodic. More... | |
std::vector< unsigned > | shape |
What is the shape of the value (0 dimensional=scalar, n dimensional with derivatives=grid, 1 dimensional no derivatives=vector, 2 dimensional no derivatives=matrix) More... | |
bool | storedata |
Are we storing the data for this value if it is vector or matrix. More... | |
std::string | str_max |
std::string | str_min |
Various quantities that describe the domain of this value. More... | |
unsigned | streampos |
bool | symmetric |
If we are storing a matrix is it symmetric? More... | |
enum PLMD::Value:: { ... } | valtype =normal |
The way this value is used in the code normal = regular value that is determined during calculate constant = constnt value that is determined during startup and that doesn't change during simulation average = value that is averaged/collected over multiple steps of trajectory calcFromAverage = value that is calculated from an average value. More... | |
bool | value_set |
Had the value been set. More... | |
Friends | |
class | ActionAtomistic |
class | ActionWithArguments |
class | ActionWithValue |
class | ActionWithVector |
class | ActionWithVirtualAtom |
template<typename T > | |
class | DataPassingObjectTyped |
class | DomainDecomposition |
A class for holding the value of a function together with its derivatives. Typically, an object of type PLMD::ActionWithValue will contain one object of type PLUMD::Value that will be named after the label. If the PLMD::ActionWithValue is part of a class that calculates multiple components then the class will contain multiple that will be called label.component-name This class is used to pass information between different PLMD::Action objects. However, if you find a use for a tempory PLMD::Value in some method you are implementing please feel free to use it.
|
private |
The way this value is used in the code normal = regular value that is determined during calculate constant = constnt value that is determined during startup and that doesn't change during simulation average = value that is averaged/collected over multiple steps of trajectory calcFromAverage = value that is calculated from an average value.
Enumerator | |
---|---|
normal | |
constant | |
average | |
calcFromAverage |
PLMD::Value::Value | ( | ) |
A constructor that can be used to make Vectors of values.
|
explicit |
A constructor that can be used to make Vectors of named values.
PLMD::Value::Value | ( | ActionWithValue * | av, |
const std::string & | name, | ||
const bool | withderiv, | ||
const std::vector< unsigned > & | ss = std::vector<unsigned>() |
||
) |
A constructor that is used throughout the code to setup the value poiters.
|
inline |
Add something to the ith element of the data array.
|
inline |
Add something to the value of the function.
|
inline |
Add some derivative to the ith component of the derivatives array.
void PLMD::Value::addForce | ( | const std::size_t & | ival, |
double | f, | ||
const bool | trueind = true |
||
) |
Add some force on the ival th component of this value.
|
inline |
Add some force on this value.
|
inline |
Add the derivatives of the grid to the corner.
bool PLMD::Value::applyForce | ( | std::vector< double > & | forces | ) | const |
Apply the forces to the derivatives using the chain rule (if there are no forces this routine returns false)
|
inlineprivate |
|
inline |
Bring back one value into the correct pbc if needed, else give back the value.
void PLMD::Value::buildDataStore | ( | const bool | forprint = false | ) |
This turns on storing of vectors/matrices.
|
private |
This is used by ActionWithValue to determine if we need to calculate on update.
|
inline |
Set all the derivatives to zero.
|
inline |
Clear the input force on the variable.
|
inline |
Special method for clearing forces on variables used by DataPassingObject.
void PLMD::Value::convertIndexToindices | ( | const std::size_t & | index, |
std::vector< unsigned > & | indices | ||
) | const |
Convert the input index to its corresponding indices.
|
inline |
Calculate the difference between two values of this function: d2 -d1.
d2-d1
|
inline |
Calculate the difference between the instantaneous value of the function and some other point: other_point-inst_val.
|
inline |
Check if forces have been added on this value.
double PLMD::Value::get | ( | const std::size_t & | ival = 0 , |
const bool | trueind = true |
||
) | const |
Get the value of the function.
|
inline |
Get the derivative with respect to component n.
void PLMD::Value::getDomain | ( | double & | minout, |
double & | maxout | ||
) | const |
Get the domain of the quantity.
void PLMD::Value::getDomain | ( | std::string & | minout, |
std::string & | maxout | ||
) | const |
Get the domain of the quantity.
|
inline |
Get the value of the force on this colvar.
unsigned PLMD::Value::getGoodNumThreads | ( | const unsigned & | j, |
const unsigned & | k | ||
) | const |
Get the number of threads to use when assigning this value.
|
inline |
get the derivative of a grid at a point n with resepct to argument j
std::size_t PLMD::Value::getIndexInStore | ( | const std::size_t & | ival | ) | const |
Get the location of this element of in the store.
|
inline |
|
inline |
Get the difference between max and minimum of domain.
|
inline |
Get the name of the quantity.
|
inline |
|
inline |
Get the number of derivatives that this particular value has.
|
inline |
Get the number of derivatives that the grid has.
|
inline |
Get the number of values that are actually stored here once sparse matrices are taken into account.
|
inline |
Get the total number of scalars that are stored here.
ActionWithValue * PLMD::Value::getPntrToAction | ( | ) |
This returns the pointer to the action where this value is calculated.
|
inline |
|
inline |
|
inline |
Get the rank of the object that is contained in this value.
|
inline |
|
inline |
|
inline |
Get the shape of the object that is contained in this value.
std::string PLMD::Value::getValueType | ( | ) | const |
Get the type of value that is stored here.
|
inline |
Check whether or not this particular quantity has derivatives.
bool PLMD::Value::ignoreStoredValue | ( | const std::string & | n | ) | const |
Are we to ignore the stored value.
|
inline |
These are used for making constant values.
|
inline |
Return a bool that tells us if the derivative is zero when the value is zero.
bool PLMD::Value::isPeriodic | ( | ) | const |
Check if the value is periodic.
|
inline |
void PLMD::Value::passGradients | ( | const double & | der, |
std::map< AtomNumber, Vector > & | g | ||
) | const |
This passes gradients from one action to another.
void PLMD::Value::push_back | ( | const double & | val | ) |
Add another value to the end of the data vector held by this value. This is used in COLLECT.
void PLMD::Value::readBinary | ( | std::istream & | i | ) |
void PLMD::Value::reshapeMatrixStore | ( | const unsigned & | n | ) |
Reshape the storage for sparse matrices.
|
inline |
Set the number of derivatives.
void PLMD::Value::retrieveEdgeList | ( | unsigned & | nedge, |
std::vector< std::pair< unsigned, unsigned > > & | active, | ||
std::vector< double > & | elems | ||
) |
Retrieve the non-zero edges in a matrix.
void PLMD::Value::set | ( | const std::size_t & | n, |
const double & | v | ||
) |
Set the value of the stored data.
|
inline |
Set the value of the function.
void PLMD::Value::setConstant | ( | ) |
|
inline |
Set the value of the ith component of the derivatives array.
|
inline |
Set a bool that tells us if the derivative is zero when the value is zero true.
void PLMD::Value::setDomain | ( | const std::string & | pmin, |
const std::string & | pmax | ||
) |
Set the domain of the function.
void PLMD::Value::setGradients | ( | ActionAtomistic * | aa, |
unsigned & | start | ||
) |
This sets up the gradients.
|
inline |
|
inline |
Set a matrix element to be non zero.
|
inline |
This stuff handles where to keep the bookeeping stuff for storing the sparse matrix.
void PLMD::Value::setNotPeriodic | ( | ) |
Set the function not periodic.
void PLMD::Value::setPositionInMatrixStash | ( | const unsigned & | p | ) |
This stuff handles where to look for the start of the row that contains the row of the matrix.
void PLMD::Value::setShape | ( | const std::vector< unsigned > & | ss | ) |
Set the shape of the Value.
void PLMD::Value::setSymmetric | ( | const bool & | sym | ) |
Set the symmetric flag equal true for this matrix.
|
private |
Complete the setup of the periodicity.
|
private |
This is used by ActionWithValue to set the valtype.
|
inline |
Find out if the value has been set.
|
inline |
Are we storing this value.
void PLMD::Value::writeBinary | ( | std::ostream & | o | ) | const |
These are used for passing around the data in this value when we are doing replica exchange.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
The action in which this quantity is calculated.
|
private |
|
private |
Variables for storing data.
|
private |
The value of the quantity.
|
private |
Is the derivative of this quantity zero when the value is zero.
|
private |
The derivatives of the quantity stored in value.
|
private |
Does this quanity have derivatives.
|
private |
A flag telling us we have a force acting on this quantity.
|
private |
The force acting on this quantity.
|
private |
|
private |
|
private |
This is a bookeeping array that holds the non-zero elements of the "sparse" matrix.
|
private |
|
private |
|
private |
|
private |
The name of this quantiy.
|
private |
|
private |
enum { ... } PLMD::Value::periodicity |
Is this quantity periodic.
|
private |
What is the shape of the value (0 dimensional=scalar, n dimensional with derivatives=grid, 1 dimensional no derivatives=vector, 2 dimensional no derivatives=matrix)
|
private |
Are we storing the data for this value if it is vector or matrix.
|
private |
|
private |
Various quantities that describe the domain of this value.
|
private |
|
private |
If we are storing a matrix is it symmetric?
enum { ... } PLMD::Value::valtype |
The way this value is used in the code normal = regular value that is determined during calculate constant = constnt value that is determined during startup and that doesn't change during simulation average = value that is averaged/collected over multiple steps of trajectory calcFromAverage = value that is calculated from an average value.
|
private |
Had the value been set.
Hosted by GitHub | 1.8.17 |