A class for holding the value of a function together with its derivatives. More...
#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) | |
A constructor that is used throughout the code to setup the value poiters. More... | |
void | set (double) |
Set the value of the function. More... | |
void | add (double) |
Add something to the value of the function. More... | |
double | get () const |
Get the value of the function. More... | |
bool | valueHasBeenSet () const |
Find out if the value has been set. More... | |
bool | isPeriodic () const |
Check if the value is periodic. More... | |
void | setNotPeriodic () |
Set the function not periodic. More... | |
void | setDomain (const std::string &, const std::string &) |
Set the domain of the function. More... | |
void | getDomain (std::string &, std::string &) const |
Get the domain of the quantity. More... | |
void | getDomain (double &, double &) const |
Get the domain of the quantity. More... | |
const std::string & | getName () const |
Get the name of the quantity. More... | |
bool | hasDerivatives () const |
Check whether or not this particular quantity has derivatives. More... | |
unsigned | getNumberOfDerivatives () const |
Get the number of derivatives that this particular value has. More... | |
void | resizeDerivatives (int n) |
Set the number of derivatives. More... | |
void | clearDerivatives () |
Set all the derivatives to zero. More... | |
void | addDerivative (unsigned i, double d) |
Add some derivative to the ith component of the derivatives array. More... | |
void | setDerivative (unsigned i, double d) |
Set the value of the ith component of the derivatives array. More... | |
void | chainRule (double df) |
Apply the chain rule to the derivatives. More... | |
double | getDerivative (const unsigned n) const |
Get the derivative with respect to component n. More... | |
void | clearInputForce () |
Clear the input force on the variable. More... | |
void | addForce (double f) |
Add some force on this value. More... | |
double | getForce () const |
Get the value of the force on this colvar. 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 | difference (double) const |
Calculate the difference between the instantaneous value of the function and some other point: other_point-inst_val. More... | |
double | difference (double d1, double d2) const |
Calculate the difference between two values of this function: d2 -d1. More... | |
ActionWithValue * | getPntrToAction () |
This returns the pointer to the action where this value is calculated. More... | |
double | bringBackInPbc (double d1) const |
Bring back one value into the correct pbc if needed, else give back the value. More... | |
void | setGradients () |
This sets up the gradients. More... | |
Static Public Member Functions | |
static double | projection (const Value &, const Value &) |
Private Types | |
enum | { unset, periodic, notperiodic } |
Is this quantity periodic. More... | |
Private Member Functions | |
void | setupPeriodicity () |
Complete the setup of the periodicity. More... | |
void | applyPeriodicity () |
Private Attributes | |
ActionWithValue * | action |
The action in which this quantity is calculated. More... | |
bool | value_set |
Had the value been set. More... | |
double | value |
The value of the quantity. More... | |
double | inputForce |
The force acting on this quantity. More... | |
bool | hasForce |
A flag telling us we have a force acting on this quantity. More... | |
std::vector< double > | derivatives |
The derivatives of the quantity stored in value. More... | |
std::map< AtomNumber, Vector > | gradients |
std::string | name |
The name of this quantiy. More... | |
bool | hasDeriv |
Does this quanity have derivatives. More... | |
enum PLMD::Value:: { ... } | periodicity |
Is this quantity periodic. More... | |
std::string | str_min |
Various quantities that describe the domain of this value. More... | |
std::string | str_max |
double | min |
double | max |
double | max_minus_min |
double | inv_max_minus_min |
Friends | |
class | ActionWithValue |
void | copy (const Value &val1, Value &val2) |
This copies the contents of a value into a second value (just the derivatives and value) More... | |
void | copy (const Value &val, Value *val2) |
This copies the contents of a value into a second value (but second value is a pointer) More... | |
void | add (const Value &val1, Value *valout) |
This adds some derivatives onto the value. More... | |
void | product (const Value &val1, const Value &val2, Value &valout) |
This calculates val1*val2 and sorts out the derivatives. More... | |
void | quotient (const Value &val1, const Value &val2, Value *valout) |
This calculates va1/val2 and sorts out the derivatives. More... | |
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.
PLMD::Value::Value | ( | ) |
A constructor that can be used to make Vectors of values.
PLMD::Value::Value | ( | ActionWithValue * | av, |
const std::string & | name, | ||
const bool | withderiv | ||
) |
A constructor that is used throughout the code to setup the value poiters.
|
inline |
Add something to the value of the function.
|
inline |
Add some derivative to the ith component of the derivatives array.
|
inline |
Add some force on this value.
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.
|
inline |
Apply the chain rule to the derivatives.
|
inline |
Set all the derivatives to zero.
|
inline |
Clear the input force on the variable.
|
inline |
Calculate the difference between the instantaneous value of the function and some other point: other_point-inst_val.
|
inline |
Calculate the difference between two values of this function: d2 -d1.
d2-d1
|
inline |
Get the value of the function.
|
inline |
Get the derivative with respect to component n.
void PLMD::Value::getDomain | ( | std::string & | minout, |
std::string & | maxout | ||
) | const |
Get the domain of the quantity.
void PLMD::Value::getDomain | ( | double & | minout, |
double & | maxout | ||
) | const |
Get the domain of the quantity.
|
inline |
Get the value of the force on this colvar.
|
inline |
Get the name of the quantity.
|
inline |
Get the number of derivatives that this particular value has.
ActionWithValue * PLMD::Value::getPntrToAction | ( | ) |
This returns the pointer to the action where this value is calculated.
|
inline |
Check whether or not this particular quantity has derivatives.
bool PLMD::Value::isPeriodic | ( | ) | const |
Check if the value is periodic.
|
inline |
Set the number of derivatives.
|
inline |
Set the value of the function.
|
inline |
Set the value of the ith component of the derivatives array.
void PLMD::Value::setDomain | ( | const std::string & | pmin, |
const std::string & | pmax | ||
) |
Set the domain of the function.
void PLMD::Value::setGradients | ( | ) |
This sets up the gradients.
void PLMD::Value::setNotPeriodic | ( | ) |
Set the function not periodic.
|
private |
Complete the setup of the periodicity.
|
inline |
Find out if the value has been set.
|
friend |
This copies the contents of a value into a second value (just the derivatives and value)
This copies the contents of a value into a second value (but second value is a pointer)
This calculates val1*val2 and sorts out the derivatives.
This calculates va1/val2 and sorts out the derivatives.
|
private |
The action in which this quantity is calculated.
|
private |
The derivatives of the quantity stored in value.
|
private |
|
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 |
|
private |
|
private |
The name of this quantiy.
enum { ... } PLMD::Value::periodicity |
Is this quantity periodic.
|
private |
|
private |
Various quantities that describe the domain of this value.
|
private |
The value of the quantity.
|
private |
Had the value been set.
Hosted by GitHub | 1.8.14 |