QMCPACK
SlaterTypeOrbital.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
8 // Miguel Morales, moralessilva2@llnl.gov, Lawrence Livermore National Laboratory
9 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
10 //
11 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
12 //////////////////////////////////////////////////////////////////////////////////////
13 
14 
15 #ifndef QMCPLUSPLUS_SLATERTYPEORBITAL_H
16 #define QMCPLUSPLUS_SLATERTYPEORBITAL_H
17 #include <cmath>
18 
19 /** class to evaluate the normalization factors for the Slater-Type orbitals
20  */
21 template<class T>
22 struct STONorm
23 {
24  static_assert(std::is_floating_point<T>::value, "T must be a float point type");
25  std::vector<T> Factorial;
26 
27  explicit STONorm(int nmax = 1) { set(nmax); }
28 
29  inline void set(int nmax)
30  {
31  int n = 2 * nmax + 2;
32  Factorial.resize(n + 1);
33  Factorial[0] = 1.0;
34  for (int i = 1; i < n + 1; i++)
35  Factorial[i] = Factorial[i - 1] * static_cast<T>(i);
36  }
37 
38  inline T operator()(int n, T screen)
39  {
40  return 1.0 / sqrt(Factorial[2 * n + 2] / pow(2.0 * screen, 2 * n + 3));
41  //return
42  // 1.0/sqrt(Factorial[2*n+2]*4.0*(4.0*atan(1.0))/pow(2.0*screen,2*n+3));
43  }
44 };
45 
46 
47 /** Generic Slater-Type Orbital
48  *
49  * This class evalaute \f$ \frac{\chi_{n,\xi}(r)}{r^l} \f$
50  * where a normalized STO is defined as
51  * \f$\chi_{n,\xi}(r) = C r^{n-1} \exp{-\xi r}\f$
52  * C is a contraction factor.
53  * The physical principal quantum number n has to be a positive integer,
54  * where n-1 is the number of nodes.
55  */
56 template<class T>
57 struct GenericSTO
58 {
59  static_assert(std::is_floating_point<T>::value, "T must be a float point type");
60  using real_type = T;
61 
62  int ID;
63  ///Principal number
64  int N;
65  ///N-l-1
66  int Power;
70 
71  GenericSTO() : N(-1), Power(0), Z(1.0), Norm(1.0) {}
72 
73  /** constructor with a known contraction factor
74  */
75  explicit GenericSTO(int power, real_type z, real_type norm) : N(-1), Power(power), Z(z), Norm(norm) {}
76 
77  /** constructor with a set of quantum numbers
78  * @param n principal quantum number
79  * @param l angular quantum number
80  * @param z exponent
81  *
82  * Power = n-l-1
83  * Contraction factor is the normalization factor evaluated based on N and Z.
84  */
85  explicit GenericSTO(int n, int l, real_type z) : N(n), Power(n - l - 1), Z(z) { reset(); }
86 
87  inline void reset()
88  {
89  if (N > 0)
90  {
91  STONorm<T> anorm(N);
92  Norm = anorm(N - 1, Z);
93  }
94  }
95 
96  inline void setgrid(real_type r) {}
97 
98  inline real_type f(real_type r) { return exp(-Z * r) * Norm * pow(r, Power); }
99 
101  {
102  real_type rnl = exp(-Z * r) * Norm;
103  if (Power == 0)
104  {
105  return -Z * rnl;
106  }
107  else
108  {
109  return rnl * pow(r, Power) * (Power / r - Z);
110  }
111  }
112 
113  /** return the value only
114  * @param r distance
115  * @param rinv inverse of r
116  */
117  inline real_type evaluate(real_type r, real_type rinv) { return Y = Norm * pow(r, Power) * exp(-Z * r); }
118 
119  inline void evaluateAll(real_type r, real_type rinv) { Y = evaluate(r, rinv, dY, d2Y); }
120 
121  inline real_type evaluate(real_type r, real_type rinv, real_type& drnl, real_type& d2rnl)
122  {
123  real_type rnl = Norm * exp(-Z * r);
124  if (Power == 0)
125  {
126  drnl = -Z * rnl;
127  d2rnl = rnl * Z * Z;
128  }
129  else
130  {
131  rnl *= pow(r, Power);
132  real_type x = Power * rinv - Z;
133  drnl = rnl * x;
134  d2rnl = rnl * (x * x - Power * rinv * rinv);
135  }
136  return rnl;
137  }
138 
139  inline real_type evaluate(real_type r, real_type rinv, real_type& drnl, real_type& d2rnl, real_type& d3rnl)
140  {
141  real_type rnl = Norm * exp(-Z * r);
142  if (Power == 0)
143  {
144  drnl = -Z * rnl;
145  d2rnl = rnl * Z * Z;
146  d3rnl = -d2rnl * Z;
147  }
148  else
149  {
150  rnl *= pow(r, Power);
151  real_type x = Power * rinv - Z;
152  drnl = rnl * x;
153  d2rnl = rnl * (x * x - Power * rinv * rinv);
154  d3rnl = rnl * (x * x * x + (2.0 * rinv - 3.0 * x) * Power * rinv * rinv);
155  }
156  return rnl;
157  }
158 };
159 
160 /**class for Slater-type orbitals,
161  *
162  *@f[
163  *\Psi_{n,l,m}({\bf R}) = N r^{n-1} \exp{-Zr} Y_{lm}(\theta,\phi)
164  *@f]
165  */
166 template<class T>
167 struct RadialSTO
168 {
169  static_assert(std::is_floating_point<T>::value, "T must be a float point type");
170  using real_type = T;
172  T Z;
173  T Norm;
174  T Y, dY, d2Y;
175  RadialSTO() : NminusOne(0), Z(1.0), Norm(1.0) {}
176  RadialSTO(int n, double z, double norm = 1.0) : NminusOne(n - 1), Z(z), Norm(norm) {}
177 
178  inline void setgrid(T r) {}
179 
180  inline T f(T r) const { return pow(r, NminusOne) * exp(-Z * r) * Norm; }
181 
182  inline T df(T r) const
183  {
184  T rnl = pow(r, NminusOne) * exp(-Z * r) * Norm;
185  return (NminusOne / r - Z) * rnl;
186  }
187 
188  inline T evaluate(T r) { return pow(r, NminusOne) * exp(-Z * r) * Norm; }
189 
190  inline void evaluateAll(T r, T rinv) { Y = evaluate(r, rinv, dY, d2Y); }
191 
192  inline T evaluate(T r, T rinv, T& drnl, T& d2rnl)
193  {
194  T rnl = pow(r, NminusOne) * exp(-Z * r) * Norm;
195  T x = NminusOne * rinv - Z;
196  drnl = rnl * x;
197  d2rnl = rnl * (x * x - NminusOne * rinv * rinv);
198  return rnl;
199  }
200 };
201 
202 
203 #endif
T evaluate(T r, T rinv, T &drnl, T &d2rnl)
real_type evaluate(real_type r, real_type rinv)
return the value only
GenericSTO(int power, real_type z, real_type norm)
constructor with a known contraction factor
class for Slater-type orbitals,
void evaluateAll(T r, T rinv)
T f(T r) const
RadialSTO(int n, double z, double norm=1.0)
Generic Slater-Type Orbital.
int Power
N-l-1.
T df(T r) const
void evaluateAll(real_type r, real_type rinv)
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
double norm(const zVec &c)
Definition: VectorOps.h:118
real_type evaluate(real_type r, real_type rinv, real_type &drnl, real_type &d2rnl, real_type &d3rnl)
T operator()(int n, T screen)
void setgrid(T r)
std::vector< T > Factorial
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
real_type dY
real_type evaluate(real_type r, real_type rinv, real_type &drnl, real_type &d2rnl)
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
real_type d2Y
real_type Norm
real_type df(real_type r)
void setgrid(real_type r)
int N
Principal number.
real_type f(real_type r)
class to evaluate the normalization factors for the Slater-Type orbitals
GenericSTO(int n, int l, real_type z)
constructor with a set of quantum numbers
real_type d3Y
STONorm(int nmax=1)