Ejemplo n.º 1
0
PathBase::PathBase(const ActionOptions& ao):
Action(ao),
Mapping(ao)
{
  bool noz; parseFlag("NOZPATH",noz);
  parse("LAMBDA",lambda);

  // Create the list of tasks
  for(unsigned i=0;i<getNumberOfReferencePoints();++i) addTaskToList( i );

  std::string empty="LABEL=zpath";
  if(!noz) addVessel("ZPATH",empty,0);
}
Ejemplo n.º 2
0
ActionWithIntegral::ActionWithIntegral(const ActionOptions&ao):
Action(ao),
ActionWithInputGrid(ao)
{
  plumed_assert( ingrid->getNumberOfComponents()==1 ); 
  // Retrieve the volume of the grid (for integration)
  volume = ingrid->getCellVolume();
  // Create something that is going to calculate the sum of all the values 
  // at the various grid points - this is going to be the integral
  std::string fake_input; addVessel( "SUM", fake_input, -1 ); readVesselKeywords();
  // Now create task list - number of tasks is equal to the number of grid points
  // as we have to evaluate the function at each grid points
  for(unsigned i=0;i<ingrid->getNumberOfPoints();++i) addTaskToList(i);
  // And activate all tasks
  deactivateAllTasks(); 
  for(unsigned i=0;i<ingrid->getNumberOfPoints();++i) taskFlags[i]=1;
  lockContributors();
}
void FindContourSurface::prepareForAveraging() {
  // Create a task list if first time
  if( firsttime ) {
    std::vector<unsigned> find( ingrid->getDimension() );
    std::vector<unsigned> ind( mygrid->getDimension() );
    for(unsigned i=0; i<mygrid->getNumberOfPoints(); ++i) {
      find.assign( find.size(), 0 ); mygrid->getIndices( i, ind );
      for(unsigned j=0; j<gdirs.size(); ++j) find[gdirs[j]]=ind[j];
      // Current will be set equal to the start point for this grid index
      addTaskToList( ingrid->getIndex(find) );
    }
    // And prepare the task list
    deactivateAllTasks();
    for(unsigned i=0; i<getFullNumberOfTasks(); ++i) taskFlags[i]=1;
    lockContributors();
    // Set the direction in which to look for the contour
    direction.resize( ingrid->getDimension(), 0 );
    direction[dir_n] = 0.999999999*ingrid->getGridSpacing()[dir_n];
  }
}
BridgedMultiColvarFunction::BridgedMultiColvarFunction(const ActionOptions&ao):
Action(ao),
MultiColvarBase(ao)
{
  std::string mlab; parse("DATA",mlab);
  mycolv = plumed.getActionSet().selectWithLabel<MultiColvarBase*>(mlab);
  if(!mycolv) error("action labeled " + mlab + " does not exist or is not a multicolvar");
  BridgedMultiColvarFunction* check = dynamic_cast<BridgedMultiColvarFunction*>( mycolv );
  if(check) error("cannot create a bridge of a bridge");

  // When using numerical derivatives here we must use numerical derivatives
  // in base multicolvar
  if( checkNumericalDerivatives() ) mycolv->useNumericalDerivatives();

  myBridgeVessel = mycolv->addBridgingVessel( this ); addDependency(mycolv);
  weightHasDerivatives=true;
  // Number of tasks is the same as the number in the underlying MultiColvar
  for(unsigned i=0;i<mycolv->getFullNumberOfTasks();++i) addTaskToList( mycolv->getTaskCode(i) );
  // Do all setup stuff in MultiColvarBase
  resizeLocalArrays();
}