/*This function prints out the parameter associated index in successfully read file */ void print_file_index_output(sentence s, map<string, vector<int> > x, sentence sf) { size_t maxlen=0; for(int i=0;i!=sf.size();i++) maxlen=max(maxlen,sf[i].length()); cout << print_space(maxlen+11); for(sentence::iterator aa=++s.begin(); aa!=s.end(); aa++) cout << *aa << "\t"; cout << endl; for(int j=0;j!=f.size();j++) { cout << "File-> " << sf[j] << print_space(maxlen-sf[j].length()+1) <<": "; for(sentence::iterator aa=++s.begin(); aa!=s.end(); aa++) { cout << x[*aa][j] << "\t"; } cout << endl; } }
/* This function searches if the parameter is present in the lammps file and return a array of associated with the parameter stored in string */ map<string, vector<int> > update2_userinput(sentence temp) { if ((!temp[0].compare("s")) || (!temp[0].compare("p"))) { s_type j; int jtemp; int notfind; int notfindall=1; map<string, vector<int> > ret; sentence::iterator tb=temp.begin(); for(j=0;j!=f.size();j++) ret[*tb].push_back(0); tb++; for(sentence::iterator aa=tb; aa!=temp.end(); aa++) { notfind=1; for(j=0;j!=f.size();j++) { if (search_string(*aa,f[j][0],jtemp)) { ret[*aa].push_back(jtemp); notfind=0; notfindall=0; } else ret[*aa].push_back(0); } if (notfind) { temp.erase(aa); aa--; } } if (notfindall) { cerr << "\nDid not find any matching parameters in any input files, read successfully. Please check!!!\n\n"; exit(1); } return ret; } else { cerr << "\nFirst string should be s (for series) or p (for parallel)\n\n" << endl; exit(1); } }