22 #ifndef __PLUMED_core_ActionWithValue_h
23 #define __PLUMED_core_ActionWithValue_h
27 #include "tools/Exception.h"
86 void setPeriodic(
const std::string& min,
const std::string& max );
169 plumed_massert(j<
values.size(),
"index requested is out of bounds");
176 for(
unsigned i=0;i<
values.size();++i){
184 plumed_massert(
values.size()==1,
"cannot use setValue in multi-component actions");
185 plumed_massert(
values[0]->
name==
getLabel(),
"The value you are trying to set is not the default");
206 plumed_assert( !
values.empty() );
207 return values[0]->getNumberOfDerivatives();
static void registerKeywords(Keywords &keys)
Register all the relevant keywords for the action.
void setNotPeriodic()
Set your default value to have no periodicity.
void componentIsNotPeriodic(const std::string &name)
Set your value component to have no periodicity.
virtual void checkFieldsAllowed()
int getComponent(const std::string &name) const
Return the index for the component named name.
A class for holding the value of a function together with its derivatives.
virtual unsigned getNumberOfDerivatives()
std::vector< Value * > values
An array containing the values for this action.
void error(const std::string &msg) const
Crash calculation and print documentation.
static void componentsAreNotOptional(Keywords &keys)
Puts a message into the manual that the components always output.
Value * getPntrToValue()
Get a pointer to the default value.
const std::string & getLabel() const
Returns the label.
void addValueWithDerivatives()
Add a value with the name label that has derivatives.
void addComponent(const std::string &name)
Add a value with a name like label.name.
void setGradientsIfNeeded()
Calculate the gradients and store them for all the values (need for projections)
Used to create a PLMD::Action that has some scalar or vectorial output that may or may not have some ...
This class holds the keywords and their documentation.
const std::string name
Name of the directive in the plumed.dat file.
std::string getComponentsList() const
get a string that contains all the available components
bool exists(const std::string &name) const
Check if a value with a particular name is present.
This class is used to bring the relevant information to the Action constructor.
void clearInputForces()
Clear the forces on the values.
ActionWithValue(const ActionOptions &ao)
void setPeriodic(const std::string &min, const std::string &max)
Set the value to be periodic with a particular domain.
static void useCustomisableComponents(Keywords &keys)
The components in the action will depend on the user.
Base class for all the input Actions.
Value * copyOutput(const std::string &name) const
Return a pointer to the value with name (this is used to retrieve values in other PLMD::Actions) You ...
void setValue(const double &d)
Set the default value (the one without name)
void componentIsPeriodic(const std::string &name, const std::string &min, const std::string &max)
Set the value to be periodic with a particular domain.
std::vector< std::string > getComponentsVector() const
get a vector that contains the label for all the components
bool checkNumericalDerivatives() const
Check if numerical derivatives should be used.
virtual void mergeFieldDerivatives(const std::vector< double > &derivatives, Value *val_out)
double getOutputQuantity(const unsigned j) const
Get the value of one of the components of the PLMD::Action.
void addComponentWithDerivatives(const std::string &name)
Add a value with a name like label.name that has derivatives.
virtual void clearDerivatives()
Clear the derivatives of values wrt parameters.
int getNumberOfComponents() const
Returns the number of values defined.
void useNumericalDerivatives()
This forces the class to use numerical derivatives.
void addValue()
Add a value with the name label.
Value * getPntrToComponent(int i)
Return a pointer to the component by index.
bool numericalDerivatives
Are we using numerical derivatives to differentiate.
static void noAnalyticalDerivatives(Keywords &keys)
Insist that numerical derivatives should always be used for an action and make this fact appear in th...