ManyRestraintsBase::ManyRestraintsBase(const ActionOptions& ao): Action(ao), ActionWithValue(ao), ActionPilot(ao), ActionWithVessel(ao), ActionWithInputVessel(ao) { // Read in the vessel we are action on readArgument("bridge"); aves=dynamic_cast<ActionWithVessel*>( getDependencies()[0] ); plumed_assert( getDependencies().size()==1 && aves ); log.printf(" adding restraints on variables calculated by %s action with label %s\n", aves->getName().c_str(),aves->getLabel().c_str()); // Add a task list in order to avoid problems for(unsigned i=0; i<aves->getFullNumberOfTasks(); ++i) addTaskToList( aves->getTaskCode(i) ); // And turn on the derivatives (note problems here because of ActionWithValue) turnOnDerivatives(); needsDerivatives(); // Now create the vessel std::string fake_input="LABEL=bias"; addVessel( "SUM", fake_input, 0 ); readVesselKeywords(); }
Bias::Bias(const ActionOptions&ao): Action(ao), ActionPilot(ao), ActionWithValue(ao), ActionWithArguments(ao), outputForces(getNumberOfArguments(),0.0) { addComponentWithDerivatives("bias"); componentIsNotPeriodic("bias"); valueBias=getPntrToComponent("bias"); if(getStride()>1) { log<<" multiple time step "<<getStride()<<" "; log<<cite("Ferrarotti, Bottaro, Perez-Villa, and Bussi, J. Chem. Theory Comput. 11, 139 (2015)")<<"\n"; } for(unsigned i=0; i<getNumberOfArguments(); ++i) { (getPntrToArgument(i)->getPntrToAction())->turnOnDerivatives(); } turnOnDerivatives(); }