QMCPACK
SlaterBasisSet.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_RADIALGRIDFUNCTOR_SLATERBASISSET_H
16 #define QMCPLUSPLUS_RADIALGRIDFUNCTOR_SLATERBASISSET_H
18 #include "OhmmsData/AttributeSet.h"
19 #include "hdf/hdf_archive.h"
20 
21 namespace qmcplusplus
22 {
23 template<class T>
25 {
26  static_assert(std::is_floating_point<T>::value, "T must be a float point type");
27  using real_type = T;
29 
30  int L;
31  bool Normalized;
32 
33  std::string nodeName;
34  std::string expName;
35  std::string coeffName;
36  std::vector<xmlNodePtr> InParam;
37  std::vector<Component_t> sset;
39 
40  explicit SlaterCombo(int l = 0,
41  bool normalized = true,
42  const char* node_name = "radfunc",
43  const char* exp_name = "exponent",
44  const char* c_name = "contraction");
45 
46  inline real_type f(real_type r)
47  {
48  real_type res = 0;
49  typename std::vector<Component_t>::iterator it(sset.begin());
50  typename std::vector<Component_t>::iterator it_end(sset.end());
51  while (it != it_end)
52  {
53  res += (*it).f(r);
54  ++it;
55  }
56  return res;
57  }
58 
60  {
61  real_type res = 0;
62  typename std::vector<Component_t>::iterator it(sset.begin());
63  typename std::vector<Component_t>::iterator it_end(sset.end());
64  while (it != it_end)
65  {
66  res += (*it).df(r);
67  ++it;
68  }
69  return res;
70  }
71 
73  {
74  Y = 0.0;
75  dY = 0.0;
76  d2Y = 0.0;
77  typename std::vector<Component_t>::iterator it(sset.begin()), it_end(sset.end());
78  while (it != it_end)
79  {
80  Y += (*it).evaluate(r, rinv);
81  ++it;
82  }
83  return Y;
84  }
85 
86  inline void evaluateAll(real_type r, real_type rinv)
87  {
88  Y = 0.0;
89  dY = 0.0;
90  d2Y = 0.0;
91  real_type du, d2u;
92  typename std::vector<Component_t>::iterator it(sset.begin()), it_end(sset.end());
93  while (it != it_end)
94  {
95  Y += (*it).evaluate(r, rinv, du, d2u);
96  dY += du;
97  d2Y += d2u;
98  ++it;
99  }
100  }
101 
103  {
104  Y = 0.0;
105  dY = 0.0;
106  d2Y = 0.0;
107  d3Y = 0.0;
108  real_type du, d2u, d3u;
109  typename std::vector<Component_t>::iterator it(sset.begin()), it_end(sset.end());
110  while (it != it_end)
111  {
112  Y += (*it).evaluate(r, rinv, du, d2u, d3u);
113  dY += du;
114  d2Y += d2u;
115  d3Y += d3u;
116  ++it;
117  }
118  }
119 
120  bool putBasisGroup(xmlNodePtr cur);
122  {
123  APP_ABORT(" Error: Slater Orbitals with HDF5 not implemented. Please contact developers. Aborting.\n");
124  return true;
125  }
126 };
127 
128 template<class T>
129 SlaterCombo<T>::SlaterCombo(int l, bool normalized, const char* node_name, const char* exp_name, const char* c_name)
130  : L(l), Normalized(normalized), nodeName(node_name), expName(exp_name), coeffName(c_name)
131 {}
132 
133 template<class T>
134 bool SlaterCombo<T>::putBasisGroup(xmlNodePtr cur)
135 {
136  cur = cur->children;
137  while (cur != NULL)
138  {
139  std::string cname((const char*)cur->name);
140  if (cname == "radfunc" || cname == "Rnl")
141  {
142  real_type zeta(1.0), c(1.0);
143  int qN = 1;
144  OhmmsAttributeSet radAttrib;
145  radAttrib.add(zeta, expName);
146  radAttrib.add(zeta, "alpha");
147  radAttrib.add(c, coeffName);
148  radAttrib.add(zeta, "c");
149  radAttrib.add(qN, "node");
150  radAttrib.add(qN, "n");
151  radAttrib.put(cur);
152  if (Normalized)
153  {
154  //z is not right
155  sset.push_back(Component_t(qN - 1, zeta, c));
156  LOGMSG(" Slater Component (n,zeta,c)= " << qN - 1 << " " << zeta << " " << c)
157  }
158  else
159  {
160  STONorm<T> anorm(qN);
161  //multiply a normalization factor to the contraction factor
162  //anorm(n,\zeta) = 1/\sqrt((2n+2)!/(2*\zeta)^{2*n+3))
163  c *= anorm(qN - 1, zeta);
164  sset.push_back(Component_t(qN - L - 1, zeta, c));
165  LOGMSG(" Slater Component (n,zeta,c)= " << qN << " " << zeta << " " << c)
166  }
167  }
168  cur = cur->next;
169  }
170  //reset();
171  return true;
172 }
173 
174 } // namespace qmcplusplus
175 #endif
SlaterCombo(int l=0, bool normalized=true, const char *node_name="radfunc", const char *exp_name="exponent", const char *c_name="contraction")
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
void evaluateWithThirdDeriv(real_type r, real_type rinv)
bool put(xmlNodePtr cur)
assign attributes to the set
Definition: AttributeSet.h:55
real_type df(real_type r)
class to handle hdf file
Definition: hdf_archive.h:51
real_type evaluate(real_type r, real_type rinv)
Generic Slater-Type Orbital.
Wrapping information on parallelism.
Definition: Communicate.h:68
void evaluateAll(real_type r, real_type rinv)
class to handle a set of attributes of an xmlNode
Definition: AttributeSet.h:24
real_type f(real_type r)
bool putBasisGroup(xmlNodePtr cur)
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
std::vector< Component_t > sset
std::vector< xmlNodePtr > InParam
bool putBasisGroupH5(hdf_archive &hin, Communicate &myComm)
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
Definition: AttributeSet.h:42
class to evaluate the normalization factors for the Slater-Type orbitals
#define LOGMSG(msg)
Definition: OutputManager.h:82