28 void Function::registerKeywords(
Keywords& keys){
29 Action::registerKeywords(keys);
30 ActionWithValue::registerKeywords(keys);
31 ActionWithArguments::registerKeywords(keys);
32 keys.
reserve(
"compulsory",
"PERIODIC",
"if the output of your function is periodic then you should specify the periodicity of the function. If the output is not periodic you must state this using PERIODIC=NO");
43 plumed_massert(
getNumberOfArguments()!=0,
"for functions you must requestArguments before adding values");
48 std::vector<std::string> period;
50 if(period.size()==1 && period[0]==
"NO"){
52 }
else if(period.size()==2){
54 }
else error(
"missing PERIODIC keyword");
59 plumed_massert(
getNumberOfArguments()!=0,
"for functions you must requestArguments before adding values");
67 bool at_least_one_forced=
false;
72 at_least_one_forced=
true;
73 for(
unsigned j=0;j<forces.size();j++){ f[j]+=forces[j]; }
void addForce(double f)
Add some force on this value.
void setNotPeriodic()
Set your default value to have no periodicity.
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...
void error(const std::string &msg) const
Crash calculation and print documentation.
Value * getPntrToValue()
Get a pointer to the default value.
Value * getPntrToArgument(const unsigned n)
Return a pointer to specific argument.
void addValueWithDerivatives()
Add a value with the name label that has derivatives.
This is used to create PLMD::Action objects that take the output from some other Action as input...
Used to create a PLMD::Action that has some scalar or vectorial output that may or may not have some ...
void addComponentWithDerivatives(const std::string &name)
This class holds the keywords and their documentation.
This class is used to bring the relevant information to the Action constructor.
void setPeriodic(const std::string &min, const std::string &max)
Set the value to be periodic with a particular domain.
Base class for all the input Actions.
void parseVector(const std::string &key, std::vector< T > &t)
Parse one keyword as std::vector.
void resizeDerivatives(int n)
Set the number of derivatives.
void reserve(const std::string &t, const std::string &k, const std::string &d, const bool isvessel=false)
Reserve a keyword.
void apply()
Apply an Action.
void addValueWithDerivatives()
bool exists(const std::string &k) const
Check if there is a keyword with name k.
void addComponentWithDerivatives(const std::string &name)
Add a value with a name like label.name that has derivatives.
int getNumberOfComponents() const
Returns the number of values defined.
Value * getPntrToComponent(int i)
Return a pointer to the component by index.
unsigned getNumberOfArguments() const
Returns the number of arguments.
const Keywords & keywords