From f67139dcfae8b450b5220ba8f5f8eac4afff54c0 Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Thu, 14 Jul 2011 07:03:14 +0200
Subject: [PATCH] Temporary fix to allow atom requests to be update in
 "prepare()"

Nasty bug there. Actual requests of lists of atoms were forwarded to Atoms
object *during* dependence preparation, so that any change made immediately
after that was not taken into account. I temporarily solved this by
re-preparing dependencies again after calls to prepare(), but probably the
workflow has to be adjusted to be more robust.
---
 src/PlumedMain.cpp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/PlumedMain.cpp b/src/PlumedMain.cpp
index 30c5e6835..365d5f8ab 100644
--- a/src/PlumedMain.cpp
+++ b/src/PlumedMain.cpp
@@ -392,7 +392,23 @@ void PlumedMain::prepareDependencies(){
 // allow actions to update their request list before atoms are shared
   for(ActionSet::iterator p=actionSet.begin();p!=actionSet.end();p++)
     if((*p)->isActive()) (*p)->prepare();
-  }
+
+/*
+Temporary fix to allow atom requests to be update in "prepare()"
+
+Nasty bug there. Actual requests of lists of atoms were forwarded to Atoms
+object *during* dependence preparation, so that any change made immediately
+after that was not taken into account. I temporarily solved this by
+re-preparing dependencies again after calls to prepare(), but probably the
+workflow has to be adjusted to be more robust.
+*/
+  for(unsigned i=0;i<pilots.size();++i){
+    if(pilots[i]->onStep()){
+      pilots[i]->activate();
+      active=true;
+     }
+  };
+}
 
 void PlumedMain::shareData(){
   if(active)atoms.share();
-- 
GitLab