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

Splitting performCalc into pieces

In particular, I would like to be able to just do the
"forward" loop (calculate()) and not the "backward" loop
(apply()). In this manner, when computing foreign biases
for acceptance in replica exchange, I will only call the
forward loop, which computes colvars and biases. Clearly,
we should move printing/analysis/hills-adding stuff
outside the "calculate" method, so as to avoid doing these
things in the acceptance calculation. I wait for this further
cleaning since, until replica exchange is not actually there,
there is no practical difference. Also, we may decide to change
a bit the name of methods (calculate/apply are becoming a bit
misleading?)
parent cdce8cb6
No related branches found
No related tags found
No related merge requests found
......@@ -401,11 +401,19 @@ void PlumedMain::shareData(){
atoms.share();
}
void PlumedMain::performCalc(){
waitData();
justCalculate();
justApply();
}
void PlumedMain::waitData(){
if(!active)return;
atoms.wait();
}
void PlumedMain::justCalculate(){
// calculate the active actions in order (assuming *backward* dependence)
for(ActionSet::iterator p=actionSet.begin();p!=actionSet.end();++p){
......@@ -424,6 +432,9 @@ void PlumedMain::performCalc(){
else (*p)->calculate();
}
}
}
void PlumedMain::justApply(){
// apply them in reverse order
for(ActionSet::reverse_iterator p=actionSet.rbegin();p!=actionSet.rend();++p){
......
......@@ -107,6 +107,10 @@ public:
void performCalc();
/// Shortcut for prepareCalc() + performCalc()
void calc();
void waitData();
void justCalculate();
void justApply();
/// Reference to atoms object
Atoms& getAtoms();
/// Reference to the list of Action's
......
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