diff --git a/src/Action.h b/src/Action.h index 288b5b634bea6af4d006f191f085c7b115eddd40..d24a4ccc5fd49fb77e22189c185261956960d4bb 100644 --- a/src/Action.h +++ b/src/Action.h @@ -128,6 +128,11 @@ public: /// The set of all Actions is applied in backward order. virtual void apply()=0; +/// Update. +/// This method is called one time per step. +/// The set of all Actions is updated in forward order. + virtual void update(){}; + /// Tell to the Action to flush open files void fflush(); diff --git a/src/GenericDumpAtoms.cpp b/src/GenericDumpAtoms.cpp index e10a56a49b340d2817705fd481297fe3dc4bc776..a622dca2e2edaf1a645ff302a462d86f94521236 100644 --- a/src/GenericDumpAtoms.cpp +++ b/src/GenericDumpAtoms.cpp @@ -34,7 +34,8 @@ public: GenericDumpAtoms(const ActionOptions&); ~GenericDumpAtoms(); void calculate(){}; - void apply(); + void apply(){}; + void update(); }; PLUMED_REGISTER_ACTION(GenericDumpAtoms,"DUMPATOMS") @@ -54,7 +55,7 @@ GenericDumpAtoms::GenericDumpAtoms(const ActionOptions&ao): requestAtoms(atoms); } -void GenericDumpAtoms::apply(){ +void GenericDumpAtoms::update(){ fprintf(fp,"%d\n",getNatoms()); const Tensor & t(getPbc().getBox()); if(getPbc().isOrthorombic()){ diff --git a/src/GenericDumpDerivatives.cpp b/src/GenericDumpDerivatives.cpp index ee140a421ca9ce901a0ba4722ca1b6d303f0a4f6..99ba016601e00494e3415730c5557729fa316235 100644 --- a/src/GenericDumpDerivatives.cpp +++ b/src/GenericDumpDerivatives.cpp @@ -47,7 +47,8 @@ public ActionWithArguments public: void calculate(){}; GenericDumpDerivatives(const ActionOptions&); - void apply(); + void apply(){}; + void update(); ~GenericDumpDerivatives(); }; @@ -81,7 +82,7 @@ fp(NULL) } -void GenericDumpDerivatives::apply(){ +void GenericDumpDerivatives::update(){ if(comm.Get_rank()!=0)return; const std::vector<Value*>& arguments(getArguments()); unsigned npar=arguments[0]->getDerivatives().size(); diff --git a/src/GenericPrint.cpp b/src/GenericPrint.cpp index 5f47bc2ffc7136a5883f5ce63942c4bc518127b7..8dab95392eed7e35b223065db85dab3ea0a6c88e 100644 --- a/src/GenericPrint.cpp +++ b/src/GenericPrint.cpp @@ -58,7 +58,8 @@ public: void calculate(){}; void prepare(); GenericPrint(const ActionOptions&); - void apply(); + void apply(){}; + void update(); ~GenericPrint(); }; @@ -123,7 +124,7 @@ void GenericPrint::prepare(){ ///////////////////////////////////////// } -void GenericPrint::apply(){ +void GenericPrint::update(){ if(comm.Get_rank()!=0)return; if(!fp){ log.printf("PRINT:"); diff --git a/src/PlumedMain.cpp b/src/PlumedMain.cpp index b368b912ca9f278d268f6fdb59756c411f211cab..c4936347c57d2384e40a5f0a313a0a2e6f53aca3 100644 --- a/src/PlumedMain.cpp +++ b/src/PlumedMain.cpp @@ -471,6 +471,10 @@ void PlumedMain::justApply(){ // this is updating the MD copy of the forces atoms.updateForces(); +// update step (for statistics, etc) + for(ActionSet::iterator p=actionSet.begin();p!=actionSet.end();++p){ + if((*p)->isActive()) (*p)->update(); + } } void PlumedMain::load(std::vector<std::string> & words){