bool Value::applyForce(std::vector<double>& forces ) const { if( !hasForce ) return false; plumed_dbg_massert( derivatives.size()==forces.size()," forces array has wrong size" ); const unsigned N=derivatives.size(); for(unsigned i=0; i<N; ++i) forces[i]=inputForce*derivatives[i]; return true; }
unsigned CInterpolation::findBox( const std::vector<double>& pos ){ plumed_dbg_massert( pos.size()==np.size(), "position size does not match the size of the grid"); unsigned jold, ccf_box, bnew=0; for(unsigned i=0;i<np.size();++i){ jold=static_cast<int>( std::floor( double(bold)/double(stride[i]) ) ); bold-=jold*stride[i]; ccf_box=search1( i, pos[i], jold ); bnew+=ccf_box; } plumed_dbg_assert( bold==0 ); bold=bnew; for(unsigned i=0;i<np.size();++i){ lb[i]=splinepoints(bold,i); ub[i]=splinepoints(bold+stride[i],i); } return bold; }
Value* ActionWithValue::getPntrToComponent( int n ) { plumed_dbg_massert(n<values.size(),"you have requested a pointer that is out of bounds"); return values[n]; }
Value* ActionWithValue::getPntrToValue() { plumed_dbg_massert(values.size()==1,"The number of components is not equal to one"); plumed_dbg_massert(values[0]->name==getLabel(), "The value you are trying to retrieve is not the default"); return values[0]; }