Example #1
0
void PammObject::setup( const std::string& filename, const double& reg, const std::vector<std::string>& valnames,
                        const std::vector<bool>& pbcin, const std::vector<std::string>& imin, const std::vector<std::string>& imax,
                        std::string& errorstr ) {
  IFile ifile; regulariser=reg;
  if( !ifile.FileExist(filename) ) {
    errorstr = "could not find file named " + filename;
    return;
  }

  std::vector<std::unique_ptr<Value>> pos;
  pbc.resize( valnames.size() );
  min.resize( valnames.size() );
  max.resize( valnames.size() );
  for(unsigned i=0; i<valnames.size(); ++i) {
    pbc[i]=pbcin[i]; min[i]=imin[i]; max[i]=imax[i];
    pos.emplace_back( new Value() );
    if( !pbc[i] ) pos[i]->setNotPeriodic();
    else pos[i]->setDomain( min[i], max[i] );
  }

  ifile.open(filename); ifile.allowIgnoredFields(); kernels.resize(0);
  for(unsigned k=0;; ++k) {
    std::unique_ptr<KernelFunctions> kk = KernelFunctions::read( &ifile, false, valnames );
    if( !kk ) break ;
    kk->normalize( Tools::unique2raw( pos ) );
    kernels.emplace_back( std::move(kk) );
    ifile.scanField();
  }
  ifile.close();
}
Example #2
0
bool FuncSumHills::checkFilesAreExisting(const vector<string> & hills ){
	plumed_massert(hills.size()!=0,"the number of  files provided should be at least one" );
        IFile *ifile = new IFile();
        ifile->link(*this);
        for(unsigned i=0; i< hills.size();i++){  
          plumed_massert(ifile->FileExist(hills[i]),"missing file "+hills[i]);
        }
        return true; 

}