void ActionWithVessel::readVesselKeywords(){
  // Set maxderivatives if it is too big
  if( maxderivatives>getNumberOfDerivatives() ) maxderivatives=getNumberOfDerivatives();

  // Loop over all keywords find the vessels and create appropriate functions
  for(unsigned i=0;i<keywords.size();++i){
      std::string thiskey,input; thiskey=keywords.getKeyword(i);
      // Check if this is a key for a vessel
      if( vesselRegister().check(thiskey) ){
          plumed_assert( keywords.style(thiskey,"vessel") );
          bool dothis=false; parseFlag(thiskey,dothis);
          if(dothis) addVessel( thiskey, input );

          parse(thiskey,input);
          if(input.size()!=0){ 
                addVessel( thiskey, input );
          } else {
             for(unsigned i=1;;++i){
                if( !parseNumbered(thiskey,i,input) ) break;
                std::string ss; Tools::convert(i,ss);
                addVessel( thiskey, input, i ); 
                input.clear();
             } 
          }
      }
  }

  // Make sure all vessels have had been resized at start
  if( functions.size()>0 ) resizeFunctions();
}
Exemple #2
0
vesselbase::StoreDataVessel* MultiColvarBase::buildDataStashes( const bool& allow_wcutoff, const double& wtol ){
  // Check if vessels have already been setup
  for(unsigned i=0;i<getNumberOfVessels();++i){
     StoreColvarVessel* ssc=dynamic_cast<StoreColvarVessel*>( getPntrToVessel(i) );
     if(ssc){
        if( allow_wcutoff && !ssc->weightCutoffIsOn() ) error("Cannot have more than one data stash with different properties");
        if( !allow_wcutoff && ssc->weightCutoffIsOn() ) error("Cannot have more than one data stash with different properties");
        return ssc;
     }
  }
 
  // Setup central atoms
  vesselbase::VesselOptions da("","",0,"",this);
  mycatoms=new StoreCentralAtomsVessel(da);
  if( allow_wcutoff ) mycatoms->setHardCutoffOnWeight( wtol );
  addVessel(mycatoms); 

  // Setup store values vessel
  vesselbase::VesselOptions ta("","",0,"",this);
  myvalues=new StoreColvarVessel(ta);   
  if( allow_wcutoff ) myvalues->setHardCutoffOnWeight( wtol );
  addVessel(myvalues);

  // Make sure resizing of vessels is done
  resizeFunctions();
  return myvalues;
}
Exemple #3
0
BridgeVessel* ActionWithVessel::addBridgingVessel( ActionWithVessel* tome ){
  VesselOptions da("","",0,"",this); 
  BridgeVessel* bv=new BridgeVessel(da);
  bv->setOutputAction( tome );
  functions.push_back( dynamic_cast<Vessel*>(bv) );
  resizeFunctions();
  return bv; 
}
void ActionWithVessel::unlockContributors(){
  if( contributorsAreUnlocked ) return;
  nactive_tasks = fullTaskList.size();
  for(unsigned i=0;i<fullTaskList.size();++i){ 
     partialTaskList[i] = fullTaskList[i]; taskFlags[i]=0; 
     indexOfTaskInFullList[i]=i;
  }
  finishTaskListUpdate();
  contributorsAreUnlocked=true;
  resizeFunctions();
}
void ActionWithVessel::needsDerivatives(){
  // Turn on the derivatives and resize
  noderiv=false; resizeFunctions(); 
  // Setting contributors unlocked here ensures that link cells are ignored
  contributorsAreUnlocked=true; finishTaskListUpdate(); contributorsAreUnlocked=false;
  // And turn on the derivatives in all actions on which we are dependent
  for(unsigned i=0;i<getDependencies().size();++i){
      ActionWithVessel* vv=dynamic_cast<ActionWithVessel*>( getDependencies()[i] );
      if(vv) vv->needsDerivatives();
  }
}
StoreDataVessel* ActionWithVessel::buildDataStashes( const bool& allow_wcutoff, const double& wtol ){
  if(mydata) return mydata;
  
  VesselOptions da("","",0,"",this);
  StoreDataVessel* mm=new StoreDataVessel(da);
  if( allow_wcutoff ) mm->setHardCutoffOnWeight( wtol );
  addVessel(mm);

  // Make sure resizing of vessels is done
  resizeFunctions();

  return mydata;
}
void ActionWithVessel::lockContributors(){
  nactive_tasks = 0;
  for(unsigned i=0;i<fullTaskList.size();++i){
      // Deactivate sets inactive tasks to number not equal to zero
      if( taskFlags[i]==0 ){
          partialTaskList[nactive_tasks] = fullTaskList[i]; 
          indexOfTaskInFullList[nactive_tasks]=i;
          nactive_tasks++; 
      } 
  }
  contributorsAreUnlocked=false;
  finishTaskListUpdate();
  resizeFunctions();
}
void ActionWithAveraging::setAveragingAction( AveragingVessel* av_vessel, const bool& usetasks ) {
  myaverage=av_vessel; addVessel( myaverage );
  useRunAllTasks=usetasks; resizeFunctions();
}