Skip to content

Commit

Permalink
Removed some old chain functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Gareth Aneurin Tribello authored and Gareth Aneurin Tribello committed Sep 17, 2024
1 parent 374d19f commit 03e8500
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/colvar/RMSDVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/ActionWithArguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>& forces, unsigned& ind, const std::string& c ) {
void ActionWithArguments::addForcesOnArguments( const unsigned& argstart, const std::vector<double>& forces, unsigned& ind ) {
unsigned nargs=arguments.size(); const ActionWithVector* av=dynamic_cast<const ActionWithVector*>( this );
if( av && av->getNumberOfMasks()>0 ) nargs=nargs-av->getNumberOfMasks();
for(unsigned i=0; i<nargs; ++i) {
if( i==0 && getName().find("EVALUATE_FUNCTION_FROM_GRID")!=std::string::npos ) continue ;
if( !arguments[i]->ignoreStoredValue(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; j<nvals; ++j) { arguments[i]->addForce( j, forces[ind], false ); ind++; }
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/ActionWithArguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ActionWithArguments:
void requestArguments(const std::vector<Value*> &arg);
void requestExtraDependencies(const std::vector<Value*> &extra);
/// Add forces to arguments (used in apply)
void addForcesOnArguments( const unsigned& argstart, const std::vector<double>& forces, unsigned& ind, const std::string& c );
void addForcesOnArguments( const unsigned& argstart, const std::vector<double>& forces, unsigned& ind );
public:
explicit ActionWithArguments(const ActionOptions&);
virtual ~ActionWithArguments() {}
Expand Down
8 changes: 1 addition & 7 deletions src/core/ActionWithVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>& 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 );
}

}
2 changes: 0 additions & 2 deletions src/core/ActionWithVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ class ActionWithVector:
bool checkComponentsForForce() const ;
/// Get the tasks that we need for forces
void getForceTasks( std::vector<unsigned>& force_tasks ) const ;
/// Add the gathered forces to the inputs across the whole chain
void addForcesToInput( const std::vector<double>& forcesToApply, unsigned& ind );
/// Check if this ation can reduce the number of tasks we perform
void canReduceTasks( std::vector<ActionWithVector*>& task_reducing_actions );
/// Send information to arguments that tasks are reduced in depedent actions
Expand Down
2 changes: 1 addition & 1 deletion src/function/Function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/isdb/EMMI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/isdb/MetainferenceBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/vatom/ArgsToVatom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

}
Expand Down

0 comments on commit 03e8500

Please sign in to comment.