diff --git a/regtest/multicolvar/rt20-mpi/colvar.reference b/regtest/multicolvar/rt20-mpi/colvar.reference index 514344336bce3dd579e826b43f641e36d5468a67..93677d871beaa56b2ceaffb4a048e74741c07257 100644 --- a/regtest/multicolvar/rt20-mpi/colvar.reference +++ b/regtest/multicolvar/rt20-mpi/colvar.reference @@ -1,6 +1,6 @@ #! FIELDS time d1.less_than d2.less_than c1 - 0.000000 3.71160 3.70528 3.71160 - 0.050000 3.65204 3.64568 3.65204 + 0.000000 3.71160 3.70528 3.63725 + 0.050000 3.65204 3.64568 3.57396 0.100000 3.68479 3.67845 3.61408 0.150000 3.74173 3.73336 3.66938 0.200000 3.80672 3.79754 3.73794 diff --git a/regtest/multicolvar/rt20/colvar.reference b/regtest/multicolvar/rt20/colvar.reference index 514344336bce3dd579e826b43f641e36d5468a67..93677d871beaa56b2ceaffb4a048e74741c07257 100644 --- a/regtest/multicolvar/rt20/colvar.reference +++ b/regtest/multicolvar/rt20/colvar.reference @@ -1,6 +1,6 @@ #! FIELDS time d1.less_than d2.less_than c1 - 0.000000 3.71160 3.70528 3.71160 - 0.050000 3.65204 3.64568 3.65204 + 0.000000 3.71160 3.70528 3.63725 + 0.050000 3.65204 3.64568 3.57396 0.100000 3.68479 3.67845 3.61408 0.150000 3.74173 3.73336 3.66938 0.200000 3.80672 3.79754 3.73794 diff --git a/src/colvar/CoordinationBase.cpp b/src/colvar/CoordinationBase.cpp index 5806073c2c7d4b726280183df72122195d50c620..dbef34b52af150cc905552e6ea59fd908c4a94b4 100644 --- a/src/colvar/CoordinationBase.cpp +++ b/src/colvar/CoordinationBase.cpp @@ -45,7 +45,8 @@ CoordinationBase::CoordinationBase(const ActionOptions&ao): PLUMED_COLVAR_INIT(ao), pbc(true), serial(false), -reduceListAtNextStep(false) +invalidateList(true), +firsttime(true) { parseFlag("SERIAL",serial); @@ -106,12 +107,14 @@ CoordinationBase::~CoordinationBase(){ } void CoordinationBase::prepare(){ - if(reduceListAtNextStep){ + if(nl->getStride()>0) + if(firsttime || (getStep()%nl->getStride()==0)){ + requestAtoms(nl->getFullAtomList()); + invalidateList=true; + firsttime=false; + }else{ requestAtoms(nl->getReducedAtomList()); - reduceListAtNextStep=false; - } - if(nl->getStride()>0 && (getStep()-nl->getLastUpdate())>=nl->getStride()){ - requestAtoms(nl->getFullAtomList()); + invalidateList=false; } } @@ -124,7 +127,7 @@ void CoordinationBase::calculate() vector<Vector> deriv(getNumberOfAtoms()); // deriv.resize(getPositions().size()); - if(nl->getStride()>0 && (getStep()-nl->getLastUpdate())>=nl->getStride()){ + if(nl->getStride()>0 && invalidateList){ nl->update(getPositions()); } @@ -167,11 +170,6 @@ void CoordinationBase::calculate() setValue (ncoord); setBoxDerivatives (virial); - if(nl->getStride()>0 && (getStep()-nl->getLastUpdate())>=nl->getStride()){ - reduceListAtNextStep=true; - nl->setLastUpdate(getStep()); - } - } } } diff --git a/src/colvar/CoordinationBase.h b/src/colvar/CoordinationBase.h index 6bf546f359cd0a87f27aa2dc5cf4315cee673a65..bc32f934a9b1b793cb3d62980cd71315d2ac167b 100644 --- a/src/colvar/CoordinationBase.h +++ b/src/colvar/CoordinationBase.h @@ -33,7 +33,8 @@ class CoordinationBase : public Colvar { bool pbc; bool serial; NeighborList *nl; - bool reduceListAtNextStep; + bool invalidateList; + bool firsttime; public: CoordinationBase(const ActionOptions&);