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
SKPair.h
Go to the documentation of this file.
1 
8 #ifndef SPARROW_DFTB_SKPAIR_H
9 #define SPARROW_DFTB_SKPAIR_H
10 
11 #include "RepulsionParameters.h"
15 #include <vector>
16 
17 namespace Scine {
18 namespace Sparrow {
19 
20 namespace dftb {
21 class SKAtom;
22 
23 template<Utils::DerivativeOrder O>
25  std::array<Utils::AutomaticDifferentiation::Value1DType<O>, 28> derivIntegral;
26  std::array<std::array<Utils::AutomaticDifferentiation::Value1DType<O>, 8>, 28> C;
27  std::array<std::array<Utils::AutomaticDifferentiation::Value1DType<O>, 8>, 28> D;
28  std::array<double, 8> xa;
29  std::array<std::array<double, 8>, 28> ya;
30 };
31 
32 // Class containing the DFTB0 parameters of a pair of atoms
33 class SKPair {
34  public:
35  SKPair(SKAtom* atomicParameters1, SKAtom* atomicParameters2, SkfData data);
36 
37  void complete(SKPair* p);
38 
39  template<Utils::DerivativeOrder O>
40  int getHS(double dist, InterpolationValues<O>& val) const;
41  template<Utils::DerivativeOrder O>
42  Utils::AutomaticDifferentiation::Value1DType<O> getRepulsion(double const& r) const;
43 
44  struct GammaTerms {
45  double g1a, g1b, g2a, g2b;
46  };
47  const GammaTerms& getGammaTerms() const;
48 
50  double dgab1a, dgab1b, dgab2a, dgab2b, dgba1a, dgba1b, dgba2a, dgba2b, dgadr, dgbdr;
51  };
52  const GammaDerivativeTerms& getGammaDerTerms() const;
53 
54  void precalculateGammaTerms();
55  int getNIntegrals() const {
56  return nIntegrals;
57  }
58  const dftb::RepulsionParameters& getRepulsionParameters() const {
59  return repulsion_;
60  }
61 
62  private:
63  // Private methods
64  template<Utils::DerivativeOrder O>
65  int getHSIntegral(InterpolationValues<O>& val, double dist) const;
66  template<Utils::DerivativeOrder O>
67  void interpolate(InterpolationValues<O>& val, double x, int start) const;
68  void precompute5Extrapolation();
69 
71  static constexpr double distFudge = 1.0;
72 
74  static constexpr int nInter = 8;
75  static constexpr int nInterRight = 4;
76  static constexpr int nInterLeft = 4;
77 
79  static constexpr double deltaR = 1e-5;
80 
82  static constexpr std::array<int, 28> integralIndexes = {
83  {19, 9, 18, 8, 15, 5, 16, 6, 27, 23, 17, 7, 26, 22, 13, 3, 14, 4, 24, 20, 25, 21, 10, 0, 11, 1, 12, 2}};
84 
85  // Private member variables
86  SKAtom* atomType1;
87  SKAtom* atomType2;
88  double gridDist;
89  int nGridPoints;
90  double rMax; // Distance after which integral is zero
91  std::array<std::vector<double>, 28> integralTable; // Matrix containing the integrals
92 
93  dftb::RepulsionParameters repulsion_;
94 
95  // Members used for the interpolation
96  std::vector<double> extrC3, extrC4, extrC5; // precomputed coefficients for integral extrapolation
97  int nIntegrals; // Number of integrals that need be calculated for the pair
98 
99  // Members for efficient gamma calculation
100  GammaTerms gamma;
101  GammaDerivativeTerms gammaDerivative;
102 };
103 
104 } // namespace dftb
105 
106 } // namespace Sparrow
107 } // namespace Scine
108 #endif
Definition: SKPair.h:33
Definition: SkfParser.h:21
Definition: RepulsionParameters.h:20
Definition: SKAtom.h:20