Skip to content
Snippets Groups Projects
Commit 6f5e97fa authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Added some utility methods

To retrieve the timestep and to retrieve the periodicity
parent f2abb9a8
No related branches found
No related tags found
No related merge requests found
...@@ -95,6 +95,10 @@ double Action::getTime()const{ ...@@ -95,6 +95,10 @@ double Action::getTime()const{
return plumed.getAtoms().getTimeStep()*getStep(); return plumed.getAtoms().getTimeStep()*getStep();
} }
double Action::getTimeStep()const{
return plumed.getAtoms().getTimeStep();
}
void Action::exit(int c){ void Action::exit(int c){
......
...@@ -75,6 +75,9 @@ protected: ...@@ -75,6 +75,9 @@ protected:
/// Return the present time /// Return the present time
double getTime()const; double getTime()const;
/// Return the timestep
double getTimeStep()const;
/// Check if Action was properly read. /// Check if Action was properly read.
/// This checks if Action::line is empty. It must be called after /// This checks if Action::line is empty. It must be called after
/// a final Action has been initialized /// a final Action has been initialized
......
...@@ -13,6 +13,16 @@ Value::Value(ActionWithValue&action,const std::string& name): ...@@ -13,6 +13,16 @@ Value::Value(ActionWithValue&action,const std::string& name):
max(0.0) max(0.0)
{} {}
bool Value::isPeriodic()const{
assert(periodicity!=unset);
return periodicity==periodic;
}
void Value::getDomain(double&min,double&max)const{
min=this->min;
max=this->max;
}
void Value::setPeriodicity(bool p){ void Value::setPeriodicity(bool p){
if(p) periodicity=periodic; if(p) periodicity=periodic;
else periodicity=notperiodic; else periodicity=notperiodic;
......
...@@ -31,6 +31,8 @@ public: ...@@ -31,6 +31,8 @@ public:
double get()const; double get()const;
void setPeriodicity(bool); void setPeriodicity(bool);
void setDomain(double,double); void setDomain(double,double);
bool isPeriodic()const;
void getDomain(double&,double&)const;
const std::string& getName()const; const std::string& getName()const;
const std::string getFullName()const; const std::string getFullName()const;
void enableDerivatives(); void enableDerivatives();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment