bool PhotoGeocoder::manage_configs(){ //--- Read config file //-------------------- Config cfg; if(!read_configurations(appPath + "config.cfg", cfg)){ logger << MOD_TAG << "Could not read configuration file..." << "\n"; return false; } getValue(cfg, "ccd_database", ccdPath); getValue(cfg, "online_ws", vtreePath); getValue(cfg, "vtree", "top_documents", MAX_DOCUMENTS); getValue(cfg, "vtree", "K", K); getValue(cfg, "vtree", "L", L); featParams = std::vector<std::string>(5,""); getValue(cfg, "siftgpu", "fo", featParams[0]); getValue(cfg, "siftgpu", "tc_type", featParams[1]); getValue(cfg, "siftgpu", "tc_number", featParams[2]); getValue(cfg, "siftgpu", "n_orientations", featParams[3]); getValue(cfg, "siftgpu", "logs", featParams[4]); getValue(cfg, "siftgpu", "min_matches", M_LIMIT); vtreePath = appPath + vtreePath; ccdPath = appPath + ccdPath; return true; }
int Reptation_method::readcheck(string & filename, Array1 <Reptile> & reptiles) { if(filename == "") return 0; ifstream is(filename.c_str()); if(!is) return 0; is.close(); read_configurations(filename, reptiles); return 1; }
void Dmc_method::restorecheckpoint(string & filename, System * sys, Wavefunction_data * wfdata, Pseudopotential * pseudo) { ifstream is(filename.c_str()); if(is) { is.close(); read_configurations(filename, pts); } else { Array1 <Config_save_point> configs; generate_sample(sample,wf,wfdata,guidingwf,nconfig,configs); pts.Resize(nconfig); for(int i=0; i< nconfig; i++) pts(i).config_pos=configs(i); } int ncread=pts.GetDim(0); //cout << "ncread " << ncread << " nwread " << nwread << endl; if(nconfig < ncread) { Array1 <Dmc_point> tmp_pts(nconfig); for(int i=0; i< nconfig; i++) tmp_pts(i)=pts(i); pts=tmp_pts; } else if(nconfig > ncread) { error("Not enough configurations in ", filename); } for(int walker=0; walker < nconfig; walker++) { pts(walker).config_pos.restorePos(sample); mygather.gatherData(pts(walker).prop, pseudo, sys, wfdata, wf, sample, guidingwf); pts(walker).age.Resize(sys->nelectrons(0)+sys->nelectrons(1)); pts(walker).age=0; } find_cutoffs(); updateEtrial(start_feedback); }
/*! Read the "words" from the method section in the input file via doinput() parsing, and store section information in private variables isoses, resolution, and minmax. Set up MO_matrix and Sample_point objects for wavefunction from input */ void Nodes_method::read(vector <string> words, unsigned int & pos, Program_options & options) { pos=0; //always start from first word doublevar Tres; vector <string> Torbs; vector <string> Tminmax; vector <string> orbtext; vector <string> Tdxyz; allocate(options.systemtext[0], sysprop); sysprop->generateSample(mywalker); allocate(options.twftext[0], sysprop, wfdata); wfdata->generateWavefunction(wf); mywalker->attachObserver(wf); pos=0; if(readsection(words,pos=0,Torbs,"CONTOURS")){ // error("Need CONTOURS in METHOD section"); plots.Resize(Torbs.size()); for(unsigned int i=0; i<Torbs.size(); i++){ plots(i)=atoi(Torbs[i].c_str()); } } else { cout <<"WARNING: All electrons are used for scanning!"<<endl; plots.Resize(mywalker->electronSize()); for(int i=0; i<plots.GetSize(); i++){ plots(i)=i+1; } } pos=0; if(! readvalue(words,pos,Tres,"RESOLUTION")) error("Need RESOLUTION in METHOD section"); resolution=Tres; pos=0; minmax.Resize(6); if(readsection(words,pos,Tminmax,"MINMAX")) { if(Tminmax.size() != 6) error("MINMAX needs 6 values"); for(unsigned int i=0; i<Tminmax.size(); i++) { minmax(i)=atof(Tminmax[i].c_str()); } } else { minmax=0.0; int nions=sysprop->nIons(); Array1 <doublevar> ionpos(3); for(int i=0; i< nions; i++) { sysprop->getIonPos(i,ionpos); for(int d=0; d< 3; d++) { if(ionpos(d) < minmax(2*d)) minmax(2*d) = ionpos(d); if(ionpos(d) > minmax(2*d+1)) minmax(2*d+1)=ionpos(d); } } for(int d=0; d< 3; d++) { minmax(2*d)-=4.0; minmax(2*d+1)+=4.0; cout << "minmax " << minmax(2*d) << " " << minmax(2*d+1) << endl; } } // Makes the Nodes methods use the current implementation of Nodes if(readvalue(words, pos=0, readconfig, "READCONFIG")){ Array1 <Config_save_point> config_pos; config_pos.Resize(0); if(readconfig!="") { read_configurations(readconfig, config_pos); } if(config_pos.GetDim(0)<1) error("Could not read a single walker from config file"); //take a first one config_pos(0).restorePos(mywalker); } else { mywalker->randomGuess(); debug_write(cout, 0, " configs read ", 1, " configs randomly generated \n"); } pos=0; doublemove=false; if( readsection(words,pos,Tdxyz,"DOUBLEMOVES")){ doublemove=true; if(plots.GetSize()%2) error("Needs pairs of countours for doublemoves"); unsigned int dummy=3*plots.GetSize()/2; if(Tdxyz.size()!=dummy) error("DOUBLEMOVES needs 3 x # of vectors values"); dxyz.Resize(plots.GetSize()/2,3); for(int i=0; i<plots.GetSize()/2; i++){ for (int j=0; j<3;j++) dxyz(i,j)=atof(Tdxyz[i*3+j].c_str()); } } }