diff --git a/src/colvar/RMSDVector.cpp b/src/colvar/RMSDVector.cpp index f304c90a3a..021fa2574f 100644 --- a/src/colvar/RMSDVector.cpp +++ b/src/colvar/RMSDVector.cpp @@ -244,7 +244,7 @@ void RMSDVector::apply() { } wasforced=true; } - if( wasforced ) { unsigned ss=0; addForcesOnArguments( 0, forces, ss, getLabel() ); } + if( wasforced ) { unsigned ss=0; addForcesOnArguments( 0, forces, ss ); } } else ActionWithVector::apply(); } diff --git a/src/core/ActionWithArguments.cpp b/src/core/ActionWithArguments.cpp index da60269884..52ef2d1e21 100644 --- a/src/core/ActionWithArguments.cpp +++ b/src/core/ActionWithArguments.cpp @@ -301,12 +301,12 @@ double ActionWithArguments::getProjection(unsigned i,unsigned j)const { return Value::projection(*v1,*v2); } -void ActionWithArguments::addForcesOnArguments( const unsigned& argstart, const std::vector& forces, unsigned& ind, const std::string& c ) { +void ActionWithArguments::addForcesOnArguments( const unsigned& argstart, const std::vector& forces, unsigned& ind ) { unsigned nargs=arguments.size(); const ActionWithVector* av=dynamic_cast( this ); if( av && av->getNumberOfMasks()>0 ) nargs=nargs-av->getNumberOfMasks(); for(unsigned i=0; iignoreStoredValue(c) || arguments[i]->getRank()==0 || (arguments[i]->getRank()>0 && arguments[i]->hasDerivatives()) ) { + if( arguments[i]->storedata || arguments[i]->getRank()==0 || (arguments[i]->getRank()>0 && arguments[i]->hasDerivatives()) ) { unsigned nvals = arguments[i]->getNumberOfStoredValues(); for(unsigned j=0; jaddForce( j, forces[ind], false ); ind++; } } diff --git a/src/core/ActionWithArguments.h b/src/core/ActionWithArguments.h index 21725fba6b..a45099906e 100644 --- a/src/core/ActionWithArguments.h +++ b/src/core/ActionWithArguments.h @@ -72,7 +72,7 @@ class ActionWithArguments: void requestArguments(const std::vector &arg); void requestExtraDependencies(const std::vector &extra); /// Add forces to arguments (used in apply) - void addForcesOnArguments( const unsigned& argstart, const std::vector& forces, unsigned& ind, const std::string& c ); + void addForcesOnArguments( const unsigned& argstart, const std::vector& forces, unsigned& ind ); public: explicit ActionWithArguments(const ActionOptions&); virtual ~ActionWithArguments() {} diff --git a/src/core/ActionWithVector.cpp b/src/core/ActionWithVector.cpp index fdb6c0e51d..6f9c98c368 100644 --- a/src/core/ActionWithVector.cpp +++ b/src/core/ActionWithVector.cpp @@ -772,13 +772,7 @@ void ActionWithVector::gatherForces( const unsigned& itask, const MultiValue& my void ActionWithVector::apply() { if( !checkForForces() ) return; // Find the top of the chain and add forces - unsigned ind=0; getFirstActionInChain()->addForcesToInput( getForcesToApply(), ind ); -} - -void ActionWithVector::addForcesToInput( const std::vector& forcesToApply, unsigned& ind ) { - if( ind>=forcesToApply.size() ) return; - addForcesOnArguments( 0, forcesToApply, ind, getFirstActionInChain()->getLabel() ); setForcesOnAtoms( forcesToApply, ind ); - if( action_to_do_after ) action_to_do_after->addForcesToInput( forcesToApply, ind ); + unsigned ind=0; addForcesOnArguments( 0, forcesForApply, ind ); setForcesOnAtoms( forcesForApply, ind ); } } diff --git a/src/core/ActionWithVector.h b/src/core/ActionWithVector.h index 4d972f608a..0f50d62668 100644 --- a/src/core/ActionWithVector.h +++ b/src/core/ActionWithVector.h @@ -79,8 +79,6 @@ class ActionWithVector: bool checkComponentsForForce() const ; /// Get the tasks that we need for forces void getForceTasks( std::vector& force_tasks ) const ; -/// Add the gathered forces to the inputs across the whole chain - void addForcesToInput( const std::vector& forcesToApply, unsigned& ind ); /// Check if this ation can reduce the number of tasks we perform void canReduceTasks( std::vector& task_reducing_actions ); /// Send information to arguments that tasks are reduced in depedent actions diff --git a/src/function/Function.cpp b/src/function/Function.cpp index 053c4a9943..c6b53baf3d 100644 --- a/src/function/Function.cpp +++ b/src/function/Function.cpp @@ -55,7 +55,7 @@ void Function::addComponentWithDerivatives( const std::string& name ) { void Function::apply() { if( !checkForForces() ) return; - unsigned ind=0; addForcesOnArguments( 0, getForcesToApply(), ind, getLabel() ); + unsigned ind=0; addForcesOnArguments( 0, getForcesToApply(), ind ); } } diff --git a/src/isdb/EMMI.cpp b/src/isdb/EMMI.cpp index e79b63c4c7..cca1eb8fd1 100644 --- a/src/isdb/EMMI.cpp +++ b/src/isdb/EMMI.cpp @@ -349,7 +349,7 @@ void EMMI::apply() { } } if( wasforced ) { - unsigned ind=0; addForcesOnArguments( 0, forcesToApply, ind, getLabel() ); + unsigned ind=0; addForcesOnArguments( 0, forcesToApply, ind ); if( getNumberOfAtoms()>0 ) setForcesOnAtoms( forcesToApply, ind ); } } diff --git a/src/isdb/MetainferenceBase.h b/src/isdb/MetainferenceBase.h index 6767d0b425..f416fd5bf4 100644 --- a/src/isdb/MetainferenceBase.h +++ b/src/isdb/MetainferenceBase.h @@ -345,7 +345,7 @@ void MetainferenceBase::apply() { } } if( wasforced ) { - unsigned ind=0; addForcesOnArguments( 0, forcesToApply, ind, getLabel() ); + unsigned ind=0; addForcesOnArguments( 0, forcesToApply, ind ); if( getNumberOfAtoms()>0 ) setForcesOnAtoms( forcesToApply, ind ); } } diff --git a/src/vatom/ArgsToVatom.cpp b/src/vatom/ArgsToVatom.cpp index da8147730e..1ced93d66f 100644 --- a/src/vatom/ArgsToVatom.cpp +++ b/src/vatom/ArgsToVatom.cpp @@ -154,7 +154,7 @@ void ArgsToVatom::calculate() { void ArgsToVatom::apply() { if( !checkForForces() ) return ; - unsigned start=0; addForcesOnArguments( 0, getForcesToApply(), start, getLabel() ); + unsigned start=0; addForcesOnArguments( 0, getForcesToApply(), start ); } }