Scine::Sparrow  5.0.0
Library for fast and agile quantum chemical calculations with semiempirical methods.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
SKAtom.h
Go to the documentation of this file.
1 
8 #ifndef SPARROW_SKATOM_H
9 #define SPARROW_SKATOM_H
10 
12 #include <algorithm>
13 #include <array>
14 #include <vector>
15 
16 namespace Scine {
17 namespace Sparrow {
18 namespace dftb {
19 
20 class SKAtom {
21  public:
22  enum orbital { s, p, d };
23 
24  explicit SKAtom(Utils::ElementType el);
25  void setEnergies(double es, double ep, double ed);
26  void setOccupations(int fs, int fp, int fd);
27  void setHubbardParameter(double us, double up, double ud);
28  void setSpinConstants(std::array<std::array<double, 3>, 3> arr);
29  bool hasSpinConstants() const {
30  return allowsSpin;
31  }
32  void setHubbardDerivative(double hubbard) {
33  hubbardDerivative = hubbard;
34  allowsDFTB3 = true;
35  }
36  double getHubbardDerivative() const {
37  return hubbardDerivative;
38  }
39  bool hasHubbardDerivative() const {
40  return allowsDFTB3;
41  }
42  int getnAOs() const {
43  return nAOs;
44  }
45  int getOccupation() const {
46  return totalOccupation;
47  }
48  double getHubbardParameter() const;
49  double getOrbitalEnergy(int orbital) const;
50  double getEnergy() const;
64  double getSpinConstant(int i, int j) {
65  return sc[i][j];
66  }
67  double getAtomicResolvedSpinConstant() const;
68  orbital getHighestOrbital() const {
69  return highestOrbital;
70  }
71 
72  bool operator==(const SKAtom& rhs) const {
73  return element_ == rhs.element_;
74  }
75 
76  private:
77  Utils::ElementType element_;
78  int nAOs;
79  orbital highestOrbital;
80  double Es, Ep, Ed; // Energies of orbitals
81  int totalOccupation, Fs, Fp, Fd; // Occupations of orbitals
82  double Us, Up, Ud; // Hubbard parameters of orbitals
83 
84  // For SDFTB
85  std::array<std::array<double, 3>, 3> sc; // Array containing the spin constants; first index is for angular momentum
86  // of first orbital, second index for second one.
87  bool allowsSpin;
88 
89  // For DFTB3
90  double hubbardDerivative;
91  bool allowsDFTB3;
92 };
93 
94 inline double SKAtom::getAtomicResolvedSpinConstant() const {
95  if (!hasSpinConstants())
96  throw std::runtime_error("No spin constant available for element " + Utils::ElementInfo::symbol(element_));
97  if (highestOrbital == orbital::s) { // s orbital is HOMO
98  return sc[0][0]; // return element W_{ss}
99  }
100  else if (highestOrbital == orbital::p) { // p orbital is HOMO
101  return sc[1][1]; // return element W_{pp}
102  }
103  else { // d orbital is HOMO
104  return sc[2][2]; // return element W_{dd}
105  }
106 }
107 } // namespace dftb
108 } // namespace Sparrow
109 } // namespace Scine
110 
111 #endif // SPARROW_SKATOM_H
double getSpinConstant(int i, int j)
Function returning the spin constants (magnetic Hubbard) Spin constants are stored as follows: sc[0][...
Definition: SKAtom.h:64
static std::string symbol(ElementType e)
Definition: SKAtom.h:20