QMCPACK
QPParser Class Reference
+ Inheritance diagram for QPParser:
+ Collaboration diagram for QPParser:

Public Member Functions

 QPParser ()
 
 QPParser (int argc, char **argv)
 
void parse (const std::string &fname)
 
void getGeometry (std::istream &is)
 
void getGaussianCenters (std::istream &is)
 
void getMO (std::istream &is)
 
void getMO_single_set (std::istream &is, Matrix< double > &CartMat, std::vector< value_type > &EigVal_alpha)
 
void getQPCI (std::istream &is)
 
- Public Member Functions inherited from QMCGaussianParserBase
 QMCGaussianParserBase ()
 
 QMCGaussianParserBase (int argc, char **argv)
 
virtual ~QMCGaussianParserBase ()=default
 
void setOccupationNumbers ()
 
void createGridNode (int argc, char **argv)
 
void createSPOSets (xmlNodePtr, xmlNodePtr)
 
void createSPOSetsH5 (xmlNodePtr, xmlNodePtr)
 
void PrepareSPOSetsFromH5 (xmlNodePtr, xmlNodePtr)
 
xmlNodePtr createElectronSet (const std::string &ion_tag)
 
xmlNodePtr createIonSet ()
 
xmlNodePtr createCell ()
 
xmlNodePtr createHamiltonian (const std::string &ion_tag, const std::string &psi_tag)
 
xmlNodePtr createBasisSet ()
 
xmlNodePtr createBasisSetWithHDF5 ()
 
xmlNodePtr createCenter (int iat, int _off)
 
void createCenterH5 (int iat, int _off, int numelem)
 
void createShell (int n, int ig, int off_, xmlNodePtr abasis)
 
void createShellH5 (int n, int ig, int off_, int numelem)
 
xmlNodePtr createDeterminantSet ()
 
xmlNodePtr createMultiDeterminantSet ()
 
xmlNodePtr createDeterminantSetWithHDF5 ()
 
xmlNodePtr createMultiDeterminantSetFromH5 ()
 
xmlNodePtr createMultiDeterminantSetCIHDF5 ()
 
xmlNodePtr PrepareDeterminantSetFromHDF5 ()
 
xmlNodePtr createJ3 ()
 
xmlNodePtr createJ2 ()
 
xmlNodePtr createJ1 ()
 
xmlNodePtr parameter (xmlNodePtr Parent, std::string Mypara, std::string a)
 
int numberOfExcitationsCSF (std::string &)
 
virtual void dumpPBC (const std::string &psi_tag, const std::string &ion_tag)
 
virtual void dump (const std::string &psi_tag, const std::string &ion_tag)
 
void dumpStdInput (const std::string &psi_tag, const std::string &ion_tag)
 
void dumpStdInputProd (const std::string &psi_tag, const std::string &ion_tag)
 
- Public Member Functions inherited from OhmmsAsciiParser
void skiplines (std::istream &is, int n)
 
template<class T >
void getValue (std::istream &is, T &aval)
 
template<class T1 , class T2 >
void getValue (std::istream &is, T1 &aval, T2 &bval)
 
template<class IT >
void getValues (std::istream &is, IT first, IT last)
 
int search (std::istream &is, const std::string &keyword)
 
int search (std::istream &is, const std::string &keyword, std::string &the_line)
 
bool lookFor (std::istream &is, const std::string &keyword)
 
bool lookFor (std::istream &is, const std::string &keyword, std::string &the_line)
 

Public Attributes

std::streampos pivot_begin
 
std::vector< std::string > tags
 
std::string MOtype
 
int readtype
 
int numAO
 
int NFZC
 
int NEXT
 
int NTOT
 
int NAC
 
- Public Attributes inherited from QMCGaussianParserBase
bool multideterminant
 
bool multidetH5
 
bool BohrUnit
 
bool SpinRestricted
 
bool Periodicity
 
bool UseHDF5
 
bool PBC
 
bool production
 
bool zeroCI
 
bool orderByExcitation
 
bool addJastrow
 
bool addJastrow3Body
 
bool ECP
 
bool debug
 
bool Structure
 
bool DoCusp
 
bool FixValence
 
bool singledetH5
 
bool optDetCoeffs
 
bool usingCSF
 
bool isSpinor
 
int IonChargeIndex
 
int ValenceChargeIndex
 
int AtomicNumberIndex
 
int NumberOfAtoms
 
int NumberOfEls
 
int target_state
 
int SpinMultiplicity
 
int NumberOfAlpha
 
int NumberOfBeta
 
int SizeOfBasisSet
 
int numMO
 
int readNO
 
int readGuess
 
int numMO2print
 
int ci_size
 
int ci_nca
 
int ci_ncb
 
int ci_nea
 
int ci_neb
 
int ci_nstates
 
int NbKpts
 
int nbexcitedstates
 
double ci_threshold
 
std::vector< double > STwist_Coord
 
std::string Title
 
std::string basisType
 
std::string basisName
 
std::string Normalized
 
std::string CurrentCenter
 
std::string outputFile
 
std::string angular_type
 
std::string expandYlm
 
std::string h5file
 
std::string multih5file
 
std::string WFS_name
 
std::string CodeName
 
const SimulationCell simulation_cell
 
ParticleSet IonSystem
 
std::vector< std::string > GroupName
 
std::vector< int > gShell
 
std::vector< int > gNumber
 
std::vector< int > gBound
 
std::vector< int > Occ_alpha
 
std::vector< int > Occ_beta
 
std::vector< value_typeQv
 
std::vector< value_typegExp
 
std::vector< value_typegC0
 
std::vector< value_typegC1
 
std::vector< value_typeEigVal_alpha
 
std::vector< value_typeEigVal_beta
 
std::vector< value_typeEigVec
 
std::unique_ptr< xmlNode, void(*)(xmlNodePtr)> gridPtr
 
std::vector< std::string > CIalpha
 
std::vector< std::string > CIbeta
 
std::vector< std::string > CSFocc
 
std::vector< std::vector< std::string > > CSFalpha
 
std::vector< std::vector< std::string > > CSFbeta
 
std::vector< std::vector< double > > CSFexpansion
 
std::vector< double > CIcoeff
 
std::vector< double > X
 
std::vector< double > Y
 
std::vector< double > Z
 
std::vector< int > Image
 
std::vector< int > CIexcitLVL
 
std::vector< std::pair< int, double > > coeff2csf
 
- Public Attributes inherited from OhmmsAsciiParser
char dbuffer [bufferSize]
 
std::vector< std::string > currentWords
 

Additional Inherited Members

- Public Types inherited from QMCGaussianParserBase
using value_type = double
 
using SingleParticlePos = ParticleSet::SingleParticlePos
 
- Static Public Member Functions inherited from QMCGaussianParserBase
static void init ()
 
- Static Public Attributes inherited from QMCGaussianParserBase
static std::map< int, std::string > IonName
 
static std::vector< std::string > gShellType
 
static std::vector< int > gShellID
 
static const std::vector< double > gCoreTable
 
- Static Public Attributes inherited from OhmmsAsciiParser
static const int bufferSize = 200
 

Detailed Description

Definition at line 24 of file QPParser.h.

Constructor & Destructor Documentation

◆ QPParser() [1/2]

QPParser ( )

Definition at line 22 of file QPParser.cpp.

References QMCGaussianParserBase::angular_type, QMCGaussianParserBase::basisName, QMCGaussianParserBase::BohrUnit, MOtype, NFZC, QMCGaussianParserBase::Normalized, numAO, and readtype.

23 {
24  basisName = "Gaussian";
25  Normalized = "no";
26  BohrUnit = true;
27  MOtype = "Canonical";
28  angular_type = "cartesian";
29  readtype = 0;
30  NFZC = 0;
31  numAO = 0;
32 }
std::string MOtype
Definition: QPParser.h:33
int NFZC
Definition: QPParser.h:35
int readtype
Definition: QPParser.h:34
int numAO
Definition: QPParser.h:34

◆ QPParser() [2/2]

QPParser ( int  argc,
char **  argv 
)

Definition at line 34 of file QPParser.cpp.

References QMCGaussianParserBase::angular_type, QMCGaussianParserBase::basisName, QMCGaussianParserBase::BohrUnit, MOtype, NFZC, QMCGaussianParserBase::Normalized, numAO, readtype, and QMCGaussianParserBase::SpinRestricted.

34  : QMCGaussianParserBase(argc, argv)
35 {
36  basisName = "Gaussian";
37  Normalized = "no";
38  BohrUnit = true;
39  MOtype = "Canonical";
40  angular_type = "cartesian";
41  SpinRestricted = true;
42  readtype = 0;
43  NFZC = 0;
44  numAO = 0;
45 }
std::string MOtype
Definition: QPParser.h:33
int NFZC
Definition: QPParser.h:35
int readtype
Definition: QPParser.h:34
int numAO
Definition: QPParser.h:34

Member Function Documentation

◆ getGaussianCenters()

void getGaussianCenters ( std::istream &  is)

Definition at line 321 of file QPParser.cpp.

References OhmmsAsciiParser::currentWords, QMCGaussianParserBase::debug, QMCGaussianParserBase::gBound, QMCGaussianParserBase::gC0, QMCGaussianParserBase::gC1, getwords(), QMCGaussianParserBase::gExp, QMCGaussianParserBase::gNumber, QMCGaussianParserBase::gShell, OhmmsAsciiParser::lookFor(), QMCGaussianParserBase::NumberOfAtoms, pivot_begin, QMCGaussianParserBase::SizeOfBasisSet, and tags.

Referenced by parse().

322 {
323  std::string Shell_temp;
324  gBound.resize(NumberOfAtoms + 1);
325  int ng;
326  std::string aline;
327  std::map<std::string, int> basisDataMap;
328  int nUniqAt = 0;
329  for (int i = 0; i < NumberOfAtoms; i++)
330  {
331  std::map<std::string, int>::iterator it(basisDataMap.find(tags[i]));
332  if (it == basisDataMap.end())
333  {
334  basisDataMap[tags[i]] = nUniqAt++;
335  }
336  }
337  std::vector<std::vector<double>> expo(nUniqAt), coef(nUniqAt), coef2(nUniqAt);
338  std::vector<int> nshll(nUniqAt, 0); //use this to
339  std::vector<std::vector<int>> ncoeffpershell(nUniqAt);
340  std::vector<std::vector<std::string>> shID(nUniqAt);
341  std::map<std::string, int> gsMap;
342  gsMap[std::string("S")] = 1;
343  gsMap[std::string("SP")] = 2;
344  gsMap[std::string("P")] = 3;
345  gsMap[std::string("D")] = 4;
346  gsMap[std::string("F")] = 5;
347  gsMap[std::string("G")] = 6;
348  gsMap[std::string("H")] = 7;
349  gsMap[std::string("I")] = 8;
350  is.seekg(pivot_begin);
351  bool found = false;
352  while (!found)
353  {
354  if (is.eof())
355  {
356  std::cerr << "Problem with basis set data.\n";
357  abort();
358  }
359  getwords(currentWords, is);
360  if (currentWords.size() > 2)
361  continue;
362  if (currentWords[0] == "BEGIN_BASIS_SET")
363  found = true;
364  }
365 
366 
367  is.seekg(pivot_begin);
368 
369 
370  int currPos = -1;
371  lookFor(is, "BEGIN_BASIS_SET");
372  int NbCoeffperShell = 0;
373  getwords(currentWords, is);
374  bool allbase = true;
375  while (allbase == true)
376  {
377  if (currentWords.empty())
378  getwords(currentWords, is);
379  if (currentWords.size() == 1)
380  {
381  std::map<std::string, int>::iterator it(basisDataMap.find(currentWords[0]));
382  if (it == basisDataMap.end())
383  {
384  std::cerr << "Error in parser.\n";
385  abort();
386  }
387  currPos = it->second;
388  nshll[currPos] = 0;
389  ncoeffpershell[currPos].clear();
390  ncoeffpershell[currPos].push_back(0);
391  shID[currPos].clear();
392  shID[currPos].push_back("NONE");
393 
394  bool group = true;
395  do
396  {
397  getwords(currentWords, is);
398  if (currentWords[0] == "S" || currentWords[0] == "P" || currentWords[0] == "D" || currentWords[0] == "F" ||
399  currentWords[0] == "G" || currentWords[0] == "H" || currentWords[0] == "I") //empty line after the shell
400  {
401  shID[currPos].push_back(currentWords[0]);
402  Shell_temp = currentWords[0];
403  NbCoeffperShell = atoi(currentWords[1].c_str());
404  ncoeffpershell[currPos][nshll[currPos]] = NbCoeffperShell;
405  for (int nbcoef = 0; nbcoef < NbCoeffperShell; nbcoef++)
406  {
407  getwords(currentWords, is);
408  expo[currPos].push_back(atof(currentWords[1].c_str()));
409  coef[currPos].push_back(atof(currentWords[2].c_str()));
410  shID[currPos][nshll[currPos]] = Shell_temp;
411  if (debug)
412  {
413  std::cout << currPos << ":" << expo[currPos].back() << " " << coef[currPos].back() << " "
414  << ncoeffpershell[currPos][nshll[currPos]] << " " << shID[currPos][nshll[currPos]] << std::endl;
415  }
416  }
417  nshll[currPos]++;
418  ncoeffpershell[currPos].push_back(0);
419  shID[currPos].push_back("NONE");
420  }
421  else
422  {
423  if (currentWords[0] == "END_BASIS_SET")
424  {
425  ng = SizeOfBasisSet;
426  group = false;
427  allbase = false;
428  break;
429  }
430  else
431  {
432  break;
433  }
434  }
435  } while (group == true);
436  }
437  else
438  {
439  std::cerr << "error in parser" << std::endl;
440  abort();
441  }
442  }
443 
444  gShell.clear();
445  gNumber.clear();
446  gExp.clear();
447  gC0.clear();
448  gC1.clear();
449  int gtot = 0;
450 
451  for (int i = 0; i < NumberOfAtoms; i++)
452  {
453  std::map<std::string, int>::iterator it(basisDataMap.find(tags[i]));
454  if (it == basisDataMap.end())
455  {
456  std::cerr << "Error in parser.\n";
457  abort();
458  }
459  gBound[i] = gtot;
460  int indx = it->second;
461  gtot += nshll[indx];
462  for (int k = 0; k < nshll[indx]; k++)
463  {
464  gShell.push_back(gsMap[shID[indx][k]]);
465  }
466  for (int k = 0; k < nshll[indx]; k++)
467  gNumber.push_back(ncoeffpershell[indx][k]);
468  for (int k = 0; k < expo[indx].size(); k++)
469  gExp.push_back(expo[indx][k]);
470  for (int k = 0; k < coef[indx].size(); k++)
471  gC0.push_back(coef[indx][k]);
472  }
473  gBound[NumberOfAtoms] = gtot;
474 }
std::vector< std::string > currentWords
Definition: SimpleParser.h:49
std::vector< std::string > tags
Definition: QPParser.h:32
std::vector< value_type > gC0
std::vector< value_type > gExp
bool lookFor(std::istream &is, const std::string &keyword)
Definition: SimpleParser.h:130
std::streampos pivot_begin
Definition: QPParser.h:31
std::vector< int > gNumber
int getwords(std::vector< std::string > &slist, std::istream &fp, std::string &aline)
std::vector< value_type > gC1

◆ getGeometry()

void getGeometry ( std::istream &  is)

Definition at line 153 of file QPParser.cpp.

References QMCGaussianParserBase::AtomicNumberIndex, OhmmsAsciiParser::currentWords, BLAS::done, QMCGaussianParserBase::ECP, ParticleSet::getSpeciesSet(), getwords(), ParticleSet::GroupID, QMCGaussianParserBase::GroupName, QMCGaussianParserBase::IonChargeIndex, QMCGaussianParserBase::IonName, QMCGaussianParserBase::IonSystem, QMCGaussianParserBase::NumberOfAtoms, pivot_begin, ParticleSet::R, and tags.

Referenced by parse().

154 {
155  //atomic numbers
156  std::vector<int> atomic_number, core;
157  std::vector<double> q, pos;
158  int natms = 0;
159  tags.clear();
160  is.seekg(pivot_begin);
161  //read atomic info
162  bool notfound = true;
163 
164  do
165  {
166  if (is.eof())
167  {
168  std::cerr << "Could not find atomic coordinates. \n";
169  abort();
170  }
171  getwords(currentWords, is);
172  if (currentWords.size() < 4)
173  continue;
174  if (currentWords.size() == 4)
175  if (currentWords[0] == "Atomic" && currentWords[1] == "coord" && currentWords[2] == "in" &&
176  currentWords[3] == "Bohr")
177  {
178  notfound = false;
179  getwords(currentWords, is);
180  while (currentWords.size() != 0)
181  {
182  if (currentWords[0] == "BEGIN_BASIS_SET")
183  break;
184  natms++;
185  double z = atof(currentWords[1].c_str());
186  int zint = (int)z; // is this dangerous???
187  atomic_number.push_back(zint);
188  q.push_back(z); // if using ECPs, change below
189  tags.push_back(currentWords[0]);
190  pos.push_back(atof(currentWords[2].c_str()));
191  pos.push_back(atof(currentWords[3].c_str()));
192  pos.push_back(atof(currentWords[4].c_str()));
193  getwords(currentWords, is);
194  }
195  }
196  } while (notfound);
197  if (natms != NumberOfAtoms)
198  {
199  std::cerr << "Could not find atomic coordinates for all atoms. \n";
200  abort();
201  }
202  //ECP PART!!!
203  if (ECP == true)
204  {
205  is.seekg(pivot_begin);
206  notfound = true;
207 
208  while (notfound)
209  {
210  if (is.eof())
211  {
212  std::cerr << "Problem looking for ECPs, this should not happen. Contact developers for help. \n";
213  abort();
214  }
215  getwords(currentWords, is);
216  // this should appear below the ECP section in the output file
217  // so use this to avoid going all the way to the bottom
218  if (currentWords.size() == 0)
219  continue;
220  if (currentWords[0] == "BEGIN_PSEUDO")
221  {
222  core.resize(NumberOfAtoms);
223  // getwords(currentWords,is); // -------------
224  bool done = false;
225  while (!done)
226  {
227  if (is.eof())
228  {
229  std::cerr << "2 Found ECPs, but problem looking ZCORE data.\n";
230  abort();
231  }
232  getwords(currentWords, is);
233  if (currentWords.size() == 0)
234  continue;
235  if (currentWords.size() == 1)
236  {
237  if (currentWords[0] == "END_PSEUDO")
238  done = true;
239  }
240  if (currentWords[0] == "PARAMETERS" && currentWords[1] == "FOR")
241  {
242  //done=true;
243  std::vector<std::string>::iterator it, it0;
244  it = find(currentWords.begin(), currentWords.end(), "ZCORE");
245  it0 = find(currentWords.begin(), currentWords.end(), "ATOM");
246  if (it0 == currentWords.end())
247  {
248  std::cerr << "Problem with ECP data. Didn't found ATOM tag\n";
249  std::cerr << is.rdbuf() << std::endl;
250  abort();
251  }
252  it0++;
253  int nq0 = atoi(it0->c_str()) - 1;
254  if (it != currentWords.end())
255  {
256  it++;
257  core[nq0] = atoi(it->c_str());
258  q[nq0] -= core[nq0];
259 
260  std::cout << "1 Found ECP for atom " << nq0 << " with zcore " << core[nq0] << std::endl;
261  }
262  else
263  {
264  it = find(currentWords.begin(), currentWords.end(), "ATOM");
265  if (it == currentWords.end())
266  {
267  std::cerr << "Problem with ECP data. Didn't found ATOM tag\n";
268  std::cerr << "Atom: " << nq0 << std::endl;
269  abort();
270  }
271  std::vector<std::string>::iterator it2 = it;
272  it2++;
273  int nq = atoi(it2->c_str());
274  if (nq != nq0 + 1)
275  {
276  std::cerr << "Problem with ECP data. ID's don't agree\n";
277  std::cerr << "Atom: " << nq0 << std::endl;
278  abort();
279  }
280  it = find(it2, currentWords.end(), "ATOM");
281  if (it == currentWords.end())
282  {
283  std::cerr << "Problem with ECP data (2).\n";
284  std::cerr << "Atom: " << nq0 << std::endl;
285  abort();
286  }
287  nq = atoi((it + 1)->c_str());
288  core[nq0] = core[nq - 1];
289  q[nq0] -= core[nq0];
290  std::cout << "2 Found ECP for atom " << nq0 << " with zcore " << core[nq0] << std::endl;
291  }
292  }
293  }
294  notfound = false;
295  }
296  else
297  {
298  if (currentWords.size() < 2)
299  continue;
300  if (currentWords[0] == "END_PSEUDO")
301  break;
302  }
303  }
304  }
305 
306 
307  SpeciesSet& species(IonSystem.getSpeciesSet());
308  for (int i = 0, ii = 0; i < NumberOfAtoms; i++)
309  {
310  IonSystem.R[i][0] = pos[ii++];
311  IonSystem.R[i][1] = pos[ii++];
312  IonSystem.R[i][2] = pos[ii++];
313  GroupName[i] = IonName[atomic_number[i]];
314  int speciesID = species.addSpecies(GroupName[i]);
315  IonSystem.GroupID[i] = speciesID;
316  species(AtomicNumberIndex, speciesID) = atomic_number[i];
317  species(IonChargeIndex, speciesID) = q[i];
318  }
319 }
std::vector< std::string > currentWords
Definition: SimpleParser.h:49
std::vector< std::string > tags
Definition: QPParser.h:32
std::vector< std::string > GroupName
ParticleIndex GroupID
Species ID.
Definition: ParticleSet.h:77
ParticlePos R
Position.
Definition: ParticleSet.h:79
static std::map< int, std::string > IonName
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
Definition: ParticleSet.h:231
constexpr double done
Definition: BLAS.hpp:48
std::streampos pivot_begin
Definition: QPParser.h:31
Custom container for set of attributes for a set of species.
Definition: SpeciesSet.h:33
int getwords(std::vector< std::string > &slist, std::istream &fp, std::string &aline)

◆ getMO()

void getMO ( std::istream &  is)

Definition at line 476 of file QPParser.cpp.

References OhmmsAsciiParser::currentWords, QMCGaussianParserBase::EigVal_alpha, QMCGaussianParserBase::EigVal_beta, QMCGaussianParserBase::EigVec, getMO_single_set(), getwords(), QMCGaussianParserBase::numMO, OhmmsAsciiParser::search(), QMCGaussianParserBase::SizeOfBasisSet, and QMCGaussianParserBase::SpinRestricted.

Referenced by parse().

477 {
478  EigVal_alpha.resize(numMO);
479  EigVal_beta.resize(numMO);
480  EigVec.resize(2 * SizeOfBasisSet * numMO);
481  std::string aline;
482  search(is, "BEGIN_MO");
483  getwords(currentWords, is); // empty line
484 
485  std::vector<double> dummy(50);
487  std::streampos pivot;
488  pivot = is.tellg();
489  std::vector<std::string> CartLabels(SizeOfBasisSet);
490  getwords(currentWords, is);
491  for (int k = 0; k < SizeOfBasisSet; k++)
492  {
493  getwords(currentWords, is);
494  CartLabels[k] = currentWords[0];
495  }
496 
497  is.seekg(pivot);
498 
499  getMO_single_set(is, CartMat, EigVal_alpha);
500  int cnt = 0;
501  for (int i = 0; i < numMO; i++)
502  for (int k = 0; k < SizeOfBasisSet; k++)
503  EigVec[cnt++] = CartMat[i][k];
504 
505  // beta states for now
506  if (!SpinRestricted)
507  {
508  search(is, "BEGIN_MO");
509  getwords(currentWords, is); // empty line
510  getMO_single_set(is, CartMat, EigVal_beta);
511  }
512 
513  for (int i = 0; i < numMO; i++)
514  for (int k = 0; k < SizeOfBasisSet; k++)
515  EigVec[cnt++] = CartMat[i][k];
516  std::cout << "Finished reading MO." << std::endl;
517 }
std::vector< value_type > EigVal_beta
std::vector< std::string > currentWords
Definition: SimpleParser.h:49
std::vector< value_type > EigVal_alpha
std::vector< value_type > EigVec
int search(std::istream &is, const std::string &keyword)
Definition: SimpleParser.h:89
int getwords(std::vector< std::string > &slist, std::istream &fp, std::string &aline)
void getMO_single_set(std::istream &is, Matrix< double > &CartMat, std::vector< value_type > &EigVal_alpha)
Definition: QPParser.cpp:519

◆ getMO_single_set()

void getMO_single_set ( std::istream &  is,
Matrix< double > &  CartMat,
std::vector< value_type > &  EigVal_alpha 
)

Definition at line 519 of file QPParser.cpp.

References OhmmsAsciiParser::currentWords, getwords(), QMCGaussianParserBase::numMO, and QMCGaussianParserBase::SizeOfBasisSet.

Referenced by getMO().

520 {
521  int nq = numMO / 4;
522  int rem = numMO % 4;
523  int cnt = 0;
524  for (int i = 0; i < nq; i++)
525  {
526  getwords(currentWords, is);
527  for (int k = 0; k < SizeOfBasisSet; k++)
528  {
529  getwords(currentWords, is);
530  if (currentWords.size() == 6)
531  {
532  CartMat[cnt][k] = atof(currentWords[2].c_str());
533  CartMat[cnt + 1][k] = atof(currentWords[3].c_str());
534  CartMat[cnt + 2][k] = atof(currentWords[4].c_str());
535  CartMat[cnt + 3][k] = atof(currentWords[5].c_str());
536  }
537  else
538  {
539  std::cerr << "Problem reading orbitals!!" << std::endl;
540  abort();
541  }
542  }
543  getwords(currentWords, is);
544  cnt += 4;
545  }
546  if (rem > 0)
547  {
548  getwords(currentWords, is);
549 
550  for (int k = 0; k < SizeOfBasisSet; k++)
551  {
552  getwords(currentWords, is);
553  for (int i = 0; i < rem; i++)
554  {
555  CartMat[cnt + i][k] = atof(currentWords[2 + i].c_str());
556  }
557  }
558  getwords(currentWords, is);
559  }
560 }
std::vector< std::string > currentWords
Definition: SimpleParser.h:49
int getwords(std::vector< std::string > &slist, std::istream &fp, std::string &aline)

◆ getQPCI()

void getQPCI ( std::istream &  is)

Definition at line 563 of file QPParser.cpp.

References QMCGaussianParserBase::ci_nca, QMCGaussianParserBase::ci_ncb, QMCGaussianParserBase::ci_nea, QMCGaussianParserBase::ci_neb, QMCGaussianParserBase::ci_nstates, QMCGaussianParserBase::ci_size, QMCGaussianParserBase::CIalpha, QMCGaussianParserBase::CIbeta, QMCGaussianParserBase::CIcoeff, OhmmsAsciiParser::currentWords, and getwords().

Referenced by parse().

564 {
565  CIcoeff.clear();
566  CIalpha.clear();
567  CIbeta.clear();
568  CIcoeff.resize(ci_size);
569  CIalpha.resize(ci_size);
570  CIbeta.resize(ci_size);
571 
572 
573  for (int i = 0; i < ci_size; i++)
574  {
575  getwords(currentWords, is); //Empty Line
576  if (currentWords[0] == "END_DET")
577  {
578  std::cout << "Done reading determinants" << std::endl;
579  break;
580  }
581 
582  getwords(currentWords, is); //Coeff
583  CIcoeff[i] = atof(currentWords[0].c_str());
584 
585  //Alpha spin
586  getwords(currentWords, is);
587  CIalpha[i] = currentWords[0];
588  //Beta spin
589  getwords(currentWords, is);
590  CIbeta[i] = currentWords[0];
591  }
592  ci_nea = ci_neb = 0;
593  for (int i = 0; i < CIalpha[0].size(); i++)
594  if (CIalpha[0].at(i) == '1')
595  ci_nea++;
596  for (int i = 0; i < CIbeta[0].size(); i++)
597  if (CIbeta[0].at(i) == '1')
598  ci_neb++;
599  if (CIalpha[0].size() != CIbeta[0].size())
600  {
601  std::cerr << "QMCPACK can't handle different number of active orbitals in alpha and beta channels right now. "
602  "Contact developers for help (Miguel).\n";
603  abort();
604  }
605  // int ds=SpinMultiplicity-1;
606  // int neb= (NumberOfEls-ds)/2;
607  // int nea= NumberOfEls-NumberOfBeta;
608  ci_nca = 0;
609  ci_ncb = 0;
610  std::cout << " Done reading CIs!!" << std::endl;
611  ci_nstates = CIalpha[0].size();
612 }
std::vector< std::string > currentWords
Definition: SimpleParser.h:49
std::vector< double > CIcoeff
std::vector< std::string > CIalpha
int getwords(std::vector< std::string > &slist, std::istream &fp, std::string &aline)
std::vector< std::string > CIbeta

◆ parse()

void parse ( const std::string &  fname)
virtual

Implements QMCGaussianParserBase.

Definition at line 47 of file QPParser.cpp.

References QMCGaussianParserBase::ci_size, ParticleSet::create(), OhmmsAsciiParser::currentWords, QMCGaussianParserBase::ECP, getGaussianCenters(), getGeometry(), getMO(), getQPCI(), getwords(), QMCGaussianParserBase::GroupName, QMCGaussianParserBase::IonSystem, MOtype, QMCGaussianParserBase::multideterminant, NAC, NEXT, NFZC, NTOT, numAO, QMCGaussianParserBase::NumberOfAlpha, QMCGaussianParserBase::NumberOfAtoms, QMCGaussianParserBase::NumberOfBeta, QMCGaussianParserBase::NumberOfEls, QMCGaussianParserBase::numMO, parsewords(), pivot_begin, readtype, OhmmsAsciiParser::search(), QMCGaussianParserBase::SizeOfBasisSet, QMCGaussianParserBase::SpinMultiplicity, and QMCGaussianParserBase::SpinRestricted.

48 {
49  std::ifstream fin(fname.c_str());
50  pivot_begin = fin.tellg();
51  std::string aline;
52 
53  search(fin, "do_pseudo", aline);
54  parsewords(aline.c_str(), currentWords);
55  if (currentWords[1] == "True")
56  {
57  ECP = true;
58  }
59  else
60  {
61  ECP = false;
62  }
63  std::cout << "usingECP: " << (ECP ? ("yes") : ("no")) << std::endl;
64  std::cout.flush();
65 
66  search(fin, "multi_det", aline);
67  parsewords(aline.c_str(), currentWords);
68  if (currentWords[1] == "True")
69  multideterminant = true;
70  else
71  multideterminant = false;
72 
73  std::cout << "Multideterminant: " << (multideterminant ? ("yes") : ("no")) << std::endl;
74 
75 
76  search(fin, "ao_num", aline);
77  parsewords(aline.c_str(), currentWords);
78  numAO = atoi(currentWords[1].c_str());
79  std::cout << "NUMBER OF AOs: " << numAO << std::endl;
81  std::cout << "Size of Basis Set: " << SizeOfBasisSet << std::endl;
82 
83  search(fin, "mo_num", aline);
84  parsewords(aline.c_str(), currentWords);
85  numMO = atoi(currentWords[1].c_str());
86  std::cout << "NUMBER OF MOs: " << numMO << std::endl;
87 
88 
89  search(fin, "elec_alpha_num", aline);
90  parsewords(aline.c_str(), currentWords);
91  NumberOfAlpha = atoi(currentWords[1].c_str());
92  std::cout << "Number of alpha electrons: " << NumberOfAlpha << std::endl;
93  search(fin, "elec_beta_num", aline);
94  parsewords(aline.c_str(), currentWords);
95  NumberOfBeta = atoi(currentWords[1].c_str());
96  std::cout << "Number of beta electrons: " << NumberOfBeta << std::endl;
97 
98 
99  search(fin, "elec_tot_num", aline);
100  parsewords(aline.c_str(), currentWords);
101  NumberOfEls = atoi(currentWords[1].c_str());
102  std::cout << "Number of electrons: " << NumberOfEls << std::endl;
103 
104 
105  search(fin, "spin_multiplicity", aline);
106  parsewords(aline.c_str(), currentWords);
107  SpinMultiplicity = atoi(currentWords[1].c_str());
108  std::cout << "SPIN MULTIPLICITY: " << SpinMultiplicity << std::endl;
109 
110  SpinRestricted = true;
111 
112 
113  search(fin, "nucl_num", aline);
114  parsewords(aline.c_str(), currentWords);
115  NumberOfAtoms = atoi(currentWords[1].c_str());
116  std::cout << "NUMBER OF ATOMS: " << NumberOfAtoms << std::endl;
117 
118 
120  GroupName.resize(NumberOfAtoms);
121  getGeometry(fin);
122  fin.seekg(pivot_begin);
123 
124  getGaussianCenters(fin);
125  fin.seekg(pivot_begin);
126  MOtype = "Canonical";
127  readtype = 0;
128  getMO(fin);
129  fin.close();
130 
131 
132  if (multideterminant)
133  {
134  fin.open(fname.c_str());
135  QP = true;
136  pivot_begin = fin.tellg();
137  search(fin, "BEGIN_DET", aline);
138  getwords(currentWords, fin); //Empty Line
139  getwords(currentWords, fin); //mo_num
140  getwords(currentWords, fin); //Number Of determinants
141  std::cout << "Found " << currentWords[1] << " Determinants" << std::endl;
142  ci_size = atoi(currentWords[1].c_str());
143  NFZC = 0;
144  NAC = numMO;
145  NEXT = 0;
146  NTOT = NEXT + NAC;
147  std::cout << "# core, #active, #external: " << NFZC << " " << NAC << " " << NEXT << std::endl;
148  //fin.seekg(pivot_begin);
149  getQPCI(fin);
150  }
151 }
std::vector< std::string > currentWords
Definition: SimpleParser.h:49
int NAC
Definition: QPParser.h:35
void getMO(std::istream &is)
Definition: QPParser.cpp:476
int NEXT
Definition: QPParser.h:35
std::string MOtype
Definition: QPParser.h:33
std::vector< std::string > GroupName
int NFZC
Definition: QPParser.h:35
int readtype
Definition: QPParser.h:34
unsigned parsewords(const char *inbuf, std::vector< std::string > &slist, const std::string &extra_tokens)
int numAO
Definition: QPParser.h:34
int search(std::istream &is, const std::string &keyword)
Definition: SimpleParser.h:89
void create(const std::vector< int > &agroup)
create grouped particles
int NTOT
Definition: QPParser.h:35
std::streampos pivot_begin
Definition: QPParser.h:31
int getwords(std::vector< std::string > &slist, std::istream &fp, std::string &aline)
void getGeometry(std::istream &is)
Definition: QPParser.cpp:153
void getQPCI(std::istream &is)
Definition: QPParser.cpp:563
void getGaussianCenters(std::istream &is)
Definition: QPParser.cpp:321

Member Data Documentation

◆ MOtype

std::string MOtype

Definition at line 33 of file QPParser.h.

Referenced by parse(), and QPParser().

◆ NAC

int NAC

Definition at line 35 of file QPParser.h.

Referenced by parse().

◆ NEXT

int NEXT

Definition at line 35 of file QPParser.h.

Referenced by parse().

◆ NFZC

int NFZC

Definition at line 35 of file QPParser.h.

Referenced by parse(), and QPParser().

◆ NTOT

int NTOT

Definition at line 35 of file QPParser.h.

Referenced by parse().

◆ numAO

int numAO

Definition at line 34 of file QPParser.h.

Referenced by parse(), and QPParser().

◆ pivot_begin

std::streampos pivot_begin

Definition at line 31 of file QPParser.h.

Referenced by getGaussianCenters(), getGeometry(), and parse().

◆ readtype

int readtype

Definition at line 34 of file QPParser.h.

Referenced by parse(), and QPParser().

◆ tags

std::vector<std::string> tags

Definition at line 32 of file QPParser.h.

Referenced by getGaussianCenters(), and getGeometry().


The documentation for this class was generated from the following files: