Kindfield
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Friends Pages
gaussiancore.cpp
Go to the documentation of this file.
1 #include "gaussiancore.h"
2 
3 #include "math/vector3.h"
5 #include <hf.h>
6 
7 #include <boost/regex.hpp>
8 
16 GaussianCore::GaussianCore(Vector3 position, string fileName) :
17  m_position(position)
18 {
19  if(fileName != "") {
20  load(fileName);
21  }
22 }
23 
24 GaussianCore::GaussianCore(Vector3 position, int atomNumber, string basisName) :
25  m_position(position)
26 {
27  cout << "Got " << atomNumber << " " << basisName << endl;
28  HF::AtomType type = static_cast<HF::AtomType>(atomNumber);
29  string filename = HF::filenameFromAtomAndBasis(type, basisName);
30  load(filename);
31 }
32 
33 GaussianCore::GaussianCore(Vector3 position, string atomAbbreviation, string basisName) :
34  m_position(position)
35 {
36  string filename = HF::filenameFromAtomAndBasis(atomAbbreviation, basisName);
37  load(filename);
38 }
39 
40 void GaussianCore::load(string fileName)
41 {
43  bool ok = parser.load(fileName);
44  if(!ok) {
45  cerr << "Could not load file " << fileName << endl;
46  throw logic_error("Could not read basis file");
47  }
48  m_atomType = parser.atomType();
49  m_nElectrons = int(m_atomType);
50  m_charge = int(m_atomType);
51  m_contractedOrbitals = parser.contractedBasisFunctions();
52  for(GaussianContractedOrbital &contracted : m_contractedOrbitals) {
53  contracted.setCorePosition(m_position);
54  }
55 }
56 
58 {
59  return m_position;
60 }
61 
62 void GaussianCore::setPosition(const Vector3 &position)
63 {
64  m_position = position;
65  for(GaussianContractedOrbital &contracted : m_contractedOrbitals) {
66  contracted.setCorePosition(m_position);
67  }
68 }
69 
70 const vector<GaussianContractedOrbital> &GaussianCore::contractedOrbitals() const
71 {
72  return m_contractedOrbitals;
73 }
74 
75 void GaussianCore::setContractedOrbitals(const vector<GaussianContractedOrbital> &contractedOrbitals)
76 {
77  m_contractedOrbitals = contractedOrbitals;
78 }
79 
81 {
82  return m_nElectrons;
83 }
84 
85 void GaussianCore::setNElectrons(int nElectrons)
86 {
87  m_nElectrons = nElectrons;
88 }
90 {
91  return m_atomType;
92 }
93 
95 {
96  m_atomType = atomType;
97 }
99 {
100  return m_charge;
101 }
102 
103 void GaussianCore::setCharge(int charge)
104 {
105  m_charge = charge;
106 }
107 
108 
109 
110 
111