QMCPACK
GaussianCombo< T > Struct Template Reference
+ Collaboration diagram for GaussianCombo< T >:

Classes

struct  BasicGaussian
 

Public Types

using real_type = T
 

Public Member Functions

 GaussianCombo (int l=0, bool normalized=false, const char *node_name="radfunc", const char *exp_name="exponent", const char *c_name="contraction")
 
void reset ()
 
int size () const
 return the number Gaussians More...
 
real_type f (real_type r)
 
real_type df (real_type r)
 
real_type evaluate (real_type r, real_type rinv)
 
void evaluateAll (real_type r, real_type rinv)
 
void evaluateWithThirdDeriv (real_type r, real_type rinv)
 
bool put (xmlNodePtr cur)
 
void addGaussian (real_type c, real_type alpha)
 
bool putBasisGroup (xmlNodePtr cur)
 
bool putBasisGroupH5 (hdf_archive &hin, Communicate &myComm)
 
int DFactorial (int num)
 double factorial of num More...
 

Public Attributes

real_type Y
 
real_type dY
 
real_type d2Y
 
real_type d3Y
 
bool Normalized
 Boolean. More...
 
real_type L
 
real_type NormL
 
real_type NormPow
 
std::string nodeName
 
std::string expName
 
std::string coeffName
 
std::vector< BasicGaussiangset
 

Detailed Description

template<class T>
struct qmcplusplus::GaussianCombo< T >

Definition at line 24 of file GaussianBasisSet.h.

Member Typedef Documentation

◆ real_type

using real_type = T

Definition at line 30 of file GaussianBasisSet.h.

Constructor & Destructor Documentation

◆ GaussianCombo()

GaussianCombo ( int  l = 0,
bool  normalized = false,
const char *  node_name = "radfunc",
const char *  exp_name = "exponent",
const char *  c_name = "contraction" 
)
explicit

Definition at line 211 of file GaussianBasisSet.h.

References qmcplusplus::atan(), GaussianCombo< T >::DFactorial(), GaussianCombo< T >::L, GaussianCombo< T >::NormL, GaussianCombo< T >::NormPow, pi, qmcplusplus::pow(), and qmcplusplus::sqrt().

212  : Normalized(normalized), nodeName(node_name), expName(exp_name), coeffName(c_name)
213 {
214  L = static_cast<real_type>(l);
215  //Everything related to L goes to NormL and NormPow
216  const real_type pi = 4.0 * std::atan(1.0);
217  NormL =
218  std::pow(2, L + 1) * std::sqrt(2.0 / static_cast<real_type>(DFactorial(2 * l + 1))) * std::pow(2.0 / pi, 0.25);
219  NormPow = 0.5 * (L + 1.0) + 0.25;
220 }
const double pi
Definition: Standard.h:56
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)
MakeReturn< UnaryNode< FnArcTan, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t atan(const Vector< T1, C1 > &l)
int DFactorial(int num)
double factorial of num
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
OHMMS_PRECISION real_type

Member Function Documentation

◆ addGaussian()

void addGaussian ( real_type  c,
real_type  alpha 
)

Definition at line 235 of file GaussianBasisSet.h.

References qmcplusplus::pow().

Referenced by qmcplusplus::TEST_CASE().

236 {
237  if (!Normalized)
238  {
239  c *= NormL * std::pow(alpha, NormPow);
240  }
241  // LOGMSG(" Gaussian exponent = " << alpha
242  // << "\n contraction=" << c0 << " normalized contraction = " << c)
243  gset.push_back(BasicGaussian(alpha, c));
244 }
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)
std::vector< BasicGaussian > gset

◆ df()

real_type df ( real_type  r)
inline

Definition at line 123 of file GaussianBasisSet.h.

References GaussianCombo< T >::gset.

Referenced by qmcplusplus::TEST_CASE().

124  {
125  real_type res = 0;
126  real_type r2 = r * r;
127  typename std::vector<BasicGaussian>::const_iterator it(gset.begin());
128  typename std::vector<BasicGaussian>::const_iterator it_end(gset.end());
129  while (it != it_end)
130  {
131  res += (*it).df(r, r2);
132  ++it;
133  }
134  return res;
135  }
OHMMS_PRECISION real_type
std::vector< BasicGaussian > gset

◆ DFactorial()

int DFactorial ( int  num)
inline

double factorial of num

Parameters
numinteger to be factored
Returns
num!!

num == even, $ num!! = 2\cdot 4\cdot ... \cdot num-2 \cdot num$

Definition at line 207 of file GaussianBasisSet.h.

References GaussianCombo< T >::DFactorial().

Referenced by GaussianCombo< T >::DFactorial(), and GaussianCombo< T >::GaussianCombo().

207 { return (num < 2) ? 1 : num * DFactorial(num - 2); }
int DFactorial(int num)
double factorial of num

◆ evaluate()

real_type evaluate ( real_type  r,
real_type  rinv 
)
inline

Definition at line 137 of file GaussianBasisSet.h.

References GaussianCombo< T >::gset, and GaussianCombo< T >::Y.

Referenced by qmcplusplus::TEST_CASE().

138  {
139  Y = 0.0;
140  real_type rr = r * r;
141  typename std::vector<BasicGaussian>::iterator it(gset.begin()), it_end(gset.end());
142  while (it != it_end)
143  {
144  Y += (*it).f(rr);
145  ++it;
146  }
147  return Y;
148  }
OHMMS_PRECISION real_type
std::vector< BasicGaussian > gset

◆ evaluateAll()

void evaluateAll ( real_type  r,
real_type  rinv 
)
inline

Definition at line 150 of file GaussianBasisSet.h.

References GaussianCombo< T >::d2Y, GaussianCombo< T >::dY, GaussianCombo< T >::gset, and GaussianCombo< T >::Y.

Referenced by qmcplusplus::TEST_CASE().

151  {
152  Y = 0.0;
153  dY = 0.0;
154  d2Y = 0.0;
155  real_type rr = r * r;
156  typename std::vector<BasicGaussian>::iterator it(gset.begin()), it_end(gset.end());
157  while (it != it_end)
158  {
159  Y += (*it).evaluate(r, rr, dY, d2Y);
160  ++it;
161  }
162  }
OHMMS_PRECISION real_type
std::vector< BasicGaussian > gset

◆ evaluateWithThirdDeriv()

void evaluateWithThirdDeriv ( real_type  r,
real_type  rinv 
)
inline

Definition at line 164 of file GaussianBasisSet.h.

References GaussianCombo< T >::d2Y, GaussianCombo< T >::d3Y, GaussianCombo< T >::dY, GaussianCombo< T >::gset, and GaussianCombo< T >::Y.

Referenced by qmcplusplus::TEST_CASE().

165  {
166  Y = 0.0;
167  dY = 0.0;
168  d2Y = 0.0, d3Y = 0.0;
169  real_type rr = r * r;
170  typename std::vector<BasicGaussian>::iterator it(gset.begin()), it_end(gset.end());
171  while (it != it_end)
172  {
173  Y += (*it).evaluate(r, rr, dY, d2Y, d3Y);
174  ++it;
175  }
176  }
OHMMS_PRECISION real_type
std::vector< BasicGaussian > gset

◆ f()

real_type f ( real_type  r)
inline

Definition at line 110 of file GaussianBasisSet.h.

References GaussianCombo< T >::gset.

Referenced by qmcplusplus::TEST_CASE().

111  {
112  real_type res = 0;
113  real_type r2 = r * r;
114  typename std::vector<BasicGaussian>::const_iterator it(gset.begin());
115  typename std::vector<BasicGaussian>::const_iterator it_end(gset.end());
116  while (it != it_end)
117  {
118  res += (*it).f(r2);
119  ++it;
120  }
121  return res;
122  }
OHMMS_PRECISION real_type
std::vector< BasicGaussian > gset

◆ put()

bool put ( xmlNodePtr  cur)

Definition at line 223 of file GaussianBasisSet.h.

References OhmmsAttributeSet::add(), and OhmmsAttributeSet::put().

224 {
225  real_type alpha(1.0), c(1.0);
226  OhmmsAttributeSet radAttrib;
227  radAttrib.add(alpha, expName);
228  radAttrib.add(c, coeffName);
229  radAttrib.put(cur);
230  addGaussian(c, alpha);
231  return true;
232 }
bool put(xmlNodePtr cur)
assign attributes to the set
Definition: AttributeSet.h:55
class to handle a set of attributes of an xmlNode
Definition: AttributeSet.h:24
OHMMS_PRECISION real_type
void addGaussian(real_type c, real_type alpha)
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

◆ putBasisGroup()

bool putBasisGroup ( xmlNodePtr  cur)

Definition at line 254 of file GaussianBasisSet.h.

Referenced by RadialOrbitalSetBuilder< COT >::addGaussian().

255 {
256  cur = cur->children;
257  while (cur != NULL)
258  {
259  std::string cname((const char*)cur->name);
260  if (cname == "radfunc")
261  {
262  put(cur);
263  }
264  cur = cur->next;
265  }
266  reset();
267  return true;
268 }
bool put(xmlNodePtr cur)

◆ putBasisGroupH5()

bool putBasisGroupH5 ( hdf_archive hin,
Communicate myComm 
)

Definition at line 271 of file GaussianBasisSet.h.

References Communicate::bcast(), hdf_archive::pop(), qmcplusplus::pow(), hdf_archive::push(), Communicate::rank(), and hdf_archive::read().

Referenced by RadialOrbitalSetBuilder< COT >::addGaussianH5().

272 {
273  int NbRadFunc(0);
274  if (myComm.rank() == 0)
275  {
276  hin.read(NbRadFunc, "NbRadFunc");
277  hin.push("radfunctions");
278  }
279  myComm.bcast(NbRadFunc);
280 
281  for (int i = 0; i < NbRadFunc; i++)
282  {
283  real_type alpha(1.0), c(1.0);
284  std::stringstream tempdata;
285  std::string dataradID0 = "DataRad", dataradID;
286  tempdata << dataradID0 << i;
287  dataradID = tempdata.str();
288 
289  if (myComm.rank() == 0)
290  {
291  hin.push(dataradID.c_str());
292  hin.read(alpha, "exponent");
293  hin.read(c, "contraction");
294  }
295 
296  myComm.bcast(alpha);
297  myComm.bcast(c);
298 
299  if (!Normalized)
300  c *= NormL * std::pow(alpha, NormPow);
301  // LOGMSG(" Gaussian exponent = " << alpha
302  // << "\n contraction=" << c0 << " nomralized contraction = " << c)
303  gset.push_back(BasicGaussian(alpha, c));
304  if (myComm.rank() == 0)
305  hin.pop();
306  }
307  reset();
308  if (myComm.rank() == 0)
309  hin.pop();
310 
311  return true;
312 }
int rank() const
return the rank
Definition: Communicate.h:116
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)
OHMMS_PRECISION real_type
void bcast(T &)
std::vector< BasicGaussian > gset

◆ reset()

void reset ( )

Definition at line 247 of file GaussianBasisSet.h.

248 {
249  for (int i = 0; i < gset.size(); i++)
250  gset[i].reset();
251 }
std::vector< BasicGaussian > gset

◆ size()

int size ( void  ) const
inline

return the number Gaussians

Definition at line 108 of file GaussianBasisSet.h.

References GaussianCombo< T >::gset.

Referenced by qmcplusplus::TEST_CASE().

108 { return gset.size(); }
std::vector< BasicGaussian > gset

Member Data Documentation

◆ coeffName

std::string coeffName

Definition at line 95 of file GaussianBasisSet.h.

◆ d2Y

◆ d3Y

◆ dY

◆ expName

std::string expName

Definition at line 94 of file GaussianBasisSet.h.

◆ gset

◆ L

Definition at line 90 of file GaussianBasisSet.h.

Referenced by GaussianCombo< T >::GaussianCombo().

◆ nodeName

std::string nodeName

Definition at line 93 of file GaussianBasisSet.h.

◆ Normalized

bool Normalized

Boolean.

Definition at line 89 of file GaussianBasisSet.h.

◆ NormL

real_type NormL

Definition at line 91 of file GaussianBasisSet.h.

Referenced by GaussianCombo< T >::GaussianCombo().

◆ NormPow

real_type NormPow

Definition at line 92 of file GaussianBasisSet.h.

Referenced by GaussianCombo< T >::GaussianCombo().

◆ Y


The documentation for this struct was generated from the following file: