diff --git a/src/Action.h b/src/Action.h index b1f23d4bb0fa90c80c09103f2d853e57f8ccc568..499e9a2555b0708cee3dde3876fa61090b482e7b 100644 --- a/src/Action.h +++ b/src/Action.h @@ -13,7 +13,8 @@ namespace PLMD{ class PlumedMain; /// This class is used to bring the relevant information to the Action constructor. -/// Its content is kept private to other classes, and may change in the future +/// Only Action and ActionRegister class can access to its content, which is +/// kept private to other classes, and may change in the future. class ActionOptions{ friend class Action; friend class ActionRegister; diff --git a/src/ActionPilot.h b/src/ActionPilot.h index a0e69cc7561e00aff9c8fa685d77eab7eba24368..cbeea4b16c05c7b7bf0b622694f1755664042021 100644 --- a/src/ActionPilot.h +++ b/src/ActionPilot.h @@ -16,6 +16,7 @@ protected: int getStride()const; public: ActionPilot(const ActionOptions&); +/// Check if the action is active on this step bool onStep()const; }; diff --git a/src/ActionWithArguments.h b/src/ActionWithArguments.h index c344601bbdc33693cb5af264dab11ac4837491b0..9aadde1ea849d015ec8e08630ba6cffd0f35c692 100644 --- a/src/ActionWithArguments.h +++ b/src/ActionWithArguments.h @@ -21,8 +21,11 @@ class ActionWithArguments: protected: ActionWithArguments(const ActionOptions&); virtual ~ActionWithArguments(){}; +/// Returns an array of pointers to the arguments std::vector<Value*> & getArguments(); +/// Returns the value of an argument double getArgument(int)const; +/// Returns the number of arguments unsigned getNumberOfArguments()const; public: }; diff --git a/src/ActionWithValue.h b/src/ActionWithValue.h index 4b4dcd65445c1c2cae60450f20aae749b3c5a514..8bbadfcc019d31a8a4049d5128c591d6e97582e3 100644 --- a/src/ActionWithValue.h +++ b/src/ActionWithValue.h @@ -11,6 +11,8 @@ namespace PLMD{ /// Action which can take one or more values. /// This object contains an array of PLMD::Value, one for each component. +/// It also stores all the derivatives of these values wrt the parameters +/// Parameters are other values (from other Action s) or atomic positions. class ActionWithValue: public virtual Action { @@ -21,20 +23,44 @@ class ActionWithValue: public: ActionWithValue(const ActionOptions&ao); ~ActionWithValue(); +/// Add a new value without derivatives. +/// This should be used for values which are only evaluated (e.g. for printing) +/// but for which we do not make derivatives available so that forces cannot +/// be applied void addValue(const std::string&name); +/// Add a new value with derivatives. +/// This should be used for values for which we make derivatives available +/// so that forces can be applied void addValueWithDerivatives(const std::string&name); +/// Check if a value with a given name is already used bool hasNamedValue(const std::string&name)const; +/// Return a pointer to the value by name Value* getValue(const std::string&name)const; +/// Return a pointer to the value by index +/// This should be an indexes growing for new inserted values. +/// E.g., the default value (no name) is number 0, ... Value* getValue(int i)const; +/// Returns an array of strings with the names of the values std::vector<std::string> getValueNames()const; +/// Returns the number of values defined int getNumberOfValues(); +/// Set the number of parameters on which this Action depends. +/// Example: for a Bias, this is the number of arguments, for a Colvar +/// is 3*Natoms+cell variables void setNumberOfParameters(int n); +/// Returns the number of parameters on which this Action depends. int getNumberOfParameters()const; +/// Returns the total force applied on i-th value double getForce(int n); +/// Add a force to the i-th value void addInputForces(int i,double f); +/// Clear the forces on the values void clearInputForces(); +/// Clear the derivatives of values wrt parameters void clearDerivatives(); +/// Set the value void setValue(Value*,double); +/// Set the default value (the one without name) void setValue(double); };