Skip to content
Snippets Groups Projects
Commit b7fd4466 authored by Gareth Tribello's avatar Gareth Tribello
Browse files

Added functionality so that you can run actions after the final step

in an MD simulation
parent 541855b8
No related branches found
No related tags found
No related merge requests found
......@@ -186,6 +186,11 @@ public:
/// The set of all Actions is updated in forward order.
virtual void update(){};
/// RunFinalJobs
/// This method is called once at the very end of the calculation.
/// The set of all Actions in run for the final time in forward order.
virtual void runFinalJobs(){};
/// Tell to the Action to flush open files
void fflush();
......
......@@ -487,6 +487,7 @@ int CLToolDriver<real>::main(FILE* in,FILE*out,PlumedCommunicator& pc){
step+=stride;
}
p.cmd("runFinalJobs");
if(fp_forces) fclose(fp_forces);
fclose(fp);
......
......@@ -293,6 +293,9 @@ void PlumedMain::cmd(const std::string & word,void*val){
CHECK_INIT(initialized,word);
CHECK_NULL(val,word);
exchangePatterns.getList((static_cast<int*>(val)));
} else if(word=="runFinalJobs"){
CHECK_INIT(initialized,word);
runJobsAtEndOfCalculation();
} else {
// multi word commands
......@@ -614,6 +617,12 @@ void PlumedMain::eraseFile(PlumedFileBase&f){
void PlumedMain::stop(){
stopNow=true;
}
void PlumedMain::runJobsAtEndOfCalculation(){
for(ActionSet::iterator p=actionSet.begin();p!=actionSet.end();++p){
(*p)->runFinalJobs();
}
}
......
......@@ -209,6 +209,11 @@ public:
Needed to apply the forces back.
*/
void justApply();
/**
If there are calculations that need to be done at the very end of the calculations this
makes sures they are done
*/
void runJobsAtEndOfCalculation();
/// 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