27 #include "tools/Exception.h"
44 inv_max_minus_min(0.0)
60 inv_max_minus_min(0.0)
70 plumed_massert(
max_minus_min>0,
"your function has a very strange domain?");
81 plumed_massert(
derivatives.size()==forces.size(),
" forces array has wrong size" );
119 if(atoms.isVirtualAtom(an)){
132 for(std::map<AtomNumber,Vector>::const_iterator p=values[j]->
gradients.begin();p!=values[j]->gradients.end();++p){
137 }
else plumed_error();
142 const std::map<AtomNumber,Vector> & grad1(v1.
gradients);
143 const std::map<AtomNumber,Vector> & grad2(v2.
gradients);
144 for(std::map<AtomNumber,Vector>::const_iterator p1=grad1.begin();p1!=grad1.end();++p1){
146 std::map<AtomNumber,Vector>::const_iterator p2=grad2.find(a);
155 plumed_assert(
action!=NULL );
ActionWithValue * action
The action in which this quantity is calculated.
Simple class to store the index of an atom.
Value()
A constructor that can be used to make Vectors of values.
void add(const Value &val1, Value *val2)
void copy(const Value &val1, Value &val2)
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...
double get() const
Get the value of the function.
double inputForce
The force acting on this quantity.
TensorGeneric< n, l > matmul(const TensorGeneric< n, m > &a, const TensorGeneric< m, l > &b)
A class for holding the value of a function together with its derivatives.
AtomNumber getAbsoluteIndex(int i) const
Get the absolute index of an atom.
void error(const std::string &msg) const
Crash calculation and print documentation.
unsigned getNumberOfDerivatives() const
Get the number of derivatives that this particular value has.
void clearDerivatives()
Set all the derivatives to zero.
Class containing atom related quantities from the MD code.
This is used to create PLMD::Action objects that take the output from some other Action as input...
void setGradients()
This sets up the gradients.
bool hasForce
A flag telling us we have a force acting on this quantity.
const std::map< AtomNumber, Tensor > & getGradients() const
void set(double)
Set the value of the function.
Used to create a PLMD::Action that has some scalar or vectorial output that may or may not have some ...
void getDomain(std::string &, std::string &) const
Get the domain of the quantity.
void setNotPeriodic()
Set the function not periodic.
Action used to create objects that access the positions of the atoms from the MD code.
std::vector< Value * > & getArguments()
Returns an array of pointers to the arguments.
Inherit from here if you are calculating the position of a virtual atom (eg a center of mass) ...
T dotProduct(const std::vector< T > &A, const std::vector< T > &B)
Calculate the dot product between two vectors.
static double projection(const Value &, const Value &)
void resizeDerivatives(int n)
Set the number of derivatives.
PlumedMain & plumed
Reference to main plumed object.
ActionWithValue * getPntrToAction()
This returns the pointer to the action where this value is calculated.
std::vector< double > derivatives
The derivatives of the quantity stored in value.
enum PLMD::Value::@1 periodicity
Is this quantity periodic.
void setupPeriodicity()
Complete the setup of the periodicity.
bool isPeriodic() const
Check if the value is periodic.
unsigned getNumberOfAtoms() const
Get number of available atoms.
std::string str_min
Various quantities that describe the domain of this value.
std::map< AtomNumber, Vector > gradients
Vector3d Vector
Alias for three dimensional vectors.
void addDerivative(unsigned i, double d)
Add some derivative to the ith component of the derivatives array.
double getDerivative(const unsigned n) const
Get the derivative with respect to component n.
void setDomain(const std::string &, const std::string &)
Set the domain of the function.