diff --git a/src/bias/Restraint.cpp b/src/bias/Restraint.cpp index fd876f1118d06fcdfd8168f9dd1a181d47d87b4e..3abe6bf439d0a89a5d7bd08a3231a237556c4c8e 100644 --- a/src/bias/Restraint.cpp +++ b/src/bias/Restraint.cpp @@ -62,6 +62,8 @@ class Restraint : public Bias{ std::vector<double> at; std::vector<double> kappa; std::vector<double> slope; + Value* valueBias; + Value* valueForce2; public: Restraint(const ActionOptions&); void calculate(); @@ -101,6 +103,8 @@ slope(getNumberOfArguments(),0.0) addComponent("bias"); componentIsNotPeriodic("bias"); addComponent("force2"); componentIsNotPeriodic("force2"); + valueBias=getPntrToComponent("bias"); + valueForce2=getPntrToComponent("force2"); } @@ -116,8 +120,8 @@ void Restraint::calculate(){ setOutputForce(i,f); totf2+=f*f; }; - getPntrToComponent("bias")->set(ene); - getPntrToComponent("force2")->set(totf2); + valueBias->set(ene); + valueForce2->set(totf2); } } diff --git a/src/core/ActionWithValue.h b/src/core/ActionWithValue.h index ddaaf33b2fc077b4b83bbac2bae79e2c083d51e9..707a5ab587392be71c028105f9a2ae0622dfe447 100644 --- a/src/core/ActionWithValue.h +++ b/src/core/ActionWithValue.h @@ -169,10 +169,8 @@ double ActionWithValue::getOutputQuantity(const unsigned j) const { inline double ActionWithValue::getOutputQuantity( const std::string& name ) const { std::string thename; thename=getLabel() + "." + name; - if( exists(thename) ){ - for(unsigned i=0;i<values.size();++i){ - if( values[i]->name==thename ) return values[i]->value; - } + for(unsigned i=0;i<values.size();++i){ + if( values[i]->name==thename ) return values[i]->value; } return 0.0; }