41 std::ifstream fin(fname.c_str());
90 std::cout <<
"Number of independent orbitals: " << NumOfIndOrb << std::endl;
93 std::streampos pivottdb = fin.tellg();
141 std::cout <<
"Number of gaussians " << ng << std::endl;
142 std::cout <<
"Number of primitives " << nx << std::endl;
143 std::cout <<
"Number of atoms " <<
NumberOfAtoms << std::endl;
144 search(fin,
"Shell types");
146 std::cout <<
" Shell types reading: OK" << std::endl;
153 fin.open(fname.c_str());
154 search(fin,
"Alpha Orbital");
157 std::cout <<
" Orbital energies reading: OK" << std::endl;
162 std::vector<value_type> etemp;
166 std::cout <<
" Orbital coefficients reading: OK" << std::endl;
171 std::vector<value_type> etemp;
172 search(fin,
"Beta Orbital");
174 std::cout <<
" Read Beta Orbital energies: OK" << std::endl;
179 std::cout <<
" Alpha and Beta Orbital coefficients reading: OK" << std::endl;
186 std::cerr <<
"Failed to open output file from gaussian. \n";
190 std::streampos beginpos = ofile.tellg();
191 bool found =
lookFor(ofile,
"SLATER DETERMINANT BASIS");
196 ofile.seekg(beginpos);
197 found =
lookFor(ofile,
"Slater Determinants");
203 ofile.seekg(beginpos);
204 search(ofile,
"Total number of active electrons");
207 search(ofile,
"Slater Determinants");
211 std::cerr <<
"Gaussian parser currently works for slater determinant basis only. Use SlaterDet in CAS() or " 216 beginpos = ofile.tellg();
221 found =
lookFor(ofile,
"Do an extra-iteration for final printing");
222 std::map<int, int> coeff2confg;
227 std::streampos tmppos = ofile.tellg();
230 if (
lookFor(ofile,
"EIGENVECTOR USED TO COMPUTE DENSITY MATRICES SET"))
240 if (!
lookFor(ofile,
"EIGENVALUE "))
245 if (!
lookFor(ofile,
"Eigenvalue"))
247 std::cerr <<
"Failed to find CI voefficients.\n";
252 std::streampos strpos = ofile.tellg();
255 ofile.seekg(beginpos);
258 if (
lookFor(ofile,
"NO OF BASIS FUNCTIONS", aline))
267 if (
lookFor(ofile,
"Number of configurations", aline))
274 std::cerr <<
"Problems finding total number of configurations. \n";
278 std::cout <<
"Total number of CI configurations in file (w/o truncation): " << numCI << std::endl;
289 for (
int i = 0; i < 7; i++)
293 getline(ofile, aline,
'\n');
295 for (
int i = 0; i < 7; i++)
301 int q = atoi((aline.substr(pos, pos + 7)).c_str());
302 coeff2confg[q] = cnt++;
303 CIcoeff.push_back(atof((aline.substr(pos + 9, pos + 18)).c_str()));
311 getline(ofile, aline,
'\n');
315 int q = atoi((aline.substr(pos, pos + 7)).c_str());
316 coeff2confg[q] = cnt++;
317 CIcoeff.push_back(atof((aline.substr(pos + 9, pos + 18)).c_str()));
324 int nrows = numCI / 5;
325 int nextra = numCI - nrows * 5;
330 for (
int i = 0; i < nrows; i++)
335 std::cerr <<
"Error reading CI configurations-line: " << i <<
"\n";
338 for (
int k = 0; k < 5; k++)
343 std::cerr <<
"Error reading CI configurations-line: " << i <<
"\n";
346 for (
int k = 0; k < 5; k++)
355 coeff2confg[indx[k]] = cnt++;
366 std::cerr <<
"Error reading CI configurations last line \n";
369 for (
int k = 0; k < nextra; k++)
374 std::cerr <<
"Error reading CI configurations last line \n";
377 for (
int k = 0; k < nextra; k++)
382 coeff2confg[indx[k]] = cnt++;
388 std::cout <<
"Found " <<
CIcoeff.size() <<
" coeffficients after truncation. \n";
393 ofile.seekg(beginpos);
395 search(ofile,
"Truncation Level=");
398 while (!ofile.eof() &&
419 std::map<int, int>::iterator it = coeff2confg.find(pos);
421 if (it != coeff2confg.end())
427 std::cerr <<
"Problem with ci string. \n";
430 for (
int i = 0; i < alp.size(); i++)
445 for (
int i = 0; i < alp.size(); i++)
450 std::cerr <<
"Problems with alpha ci string: " << std::endl
456 for (
int i = 0; i < beta.size(); i++)
461 std::cerr <<
"Problems with beta ci string: " << std::endl
471 for (
int i = 0; i < alp.size(); i++)
475 for (
int i = 0; i < beta.size(); i++)
482 CIbeta[it->second] = beta;
494 ofile.seekg(beginpos);
495 bool first_alpha =
true;
496 bool first_beta =
true;
498 getline(ofile, aline,
'\n');
501 for (
int nst = 0; nst < numCI; nst++)
505 std::map<int, int>::iterator it = coeff2confg.find(pos);
506 if (it != coeff2confg.end())
520 std::cerr <<
"Problems with alpha string: " << pos << std::endl;
542 std::cerr <<
"Problems with beta string: " << pos << std::endl;
553 CIbeta[it->second] = beta;
556 getline(ofile, aline1,
'\n');
563 getline(ofile, aline1,
'\n');
571 std::cerr <<
"Could not find CI coefficients in gaussian output file. \n";
574 std::cout <<
" size of CIalpha,CIbeta: " <<
CIalpha.size() <<
" " <<
CIbeta.size() << std::endl;
584 search(is,
"Atomic numbers");
585 getValues(is, atomic_number.begin(), atomic_number.end());
586 std::streampos pivot = is.tellg();
591 search(is,
"coordinates");
601 int speciesID = species.addSpecies(
GroupName[i]);
611 std::map<int, int> gsMap;
625 for (
int i = 0; i <
n.size(); i++)
635 for (
int i = 0; i <
n.size(); i++)
644 search(is,
"Contraction");
std::vector< value_type > EigVal_beta
void getGaussianCenters(std::istream &is)
std::vector< std::string > currentWords
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
std::vector< double > CIcoeff
std::vector< std::string > GroupName
ParticleIndex GroupID
Species ID.
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
std::vector< value_type > EigVal_alpha
std::vector< int > gBound
std::vector< value_type > gC0
unsigned parsewords(const char *inbuf, std::vector< std::string > &slist, const std::string &extra_tokens)
std::vector< value_type > EigVec
int search(std::istream &is, const std::string &keyword)
void parse(const std::string &fname) override
std::vector< value_type > gExp
static std::map< int, std::string > IonName
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
std::vector< std::string > CIalpha
void create(const std::vector< int > &agroup)
create grouped particles
bool lookFor(std::istream &is, const std::string &keyword)
void getValues(std::istream &is, IT first, IT last)
std::vector< int > gNumber
Custom container for set of attributes for a set of species.
int getwords(std::vector< std::string > &slist, std::istream &fp, std::string &aline)
std::vector< std::string > CIbeta
std::vector< value_type > gC1
std::vector< int > gShell
void getGeometry(std::istream &is)