QMCPACK
RadialWF.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: Paul R. C. Kent, kentpr@ornl.gov, Oak Ridge National Laboratory
8 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
9 //
10 // File created by: Paul R. C. Kent, kentpr@ornl.gov, Oak Ridge National Laboratory
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 
14 // http://pathintegrals.info //
15 /////////////////////////////////////////////////////////////
16 
17 #ifndef RADIAL_WF_H
18 #define RADIAL_WF_H
19 
20 #include "Potential.h"
21 #include "CubicSplineCommon.h"
22 #include "IO.h"
23 
24 class RadialWF
25 {
26 private:
27  int TurningIndex();
28  double IntegrateInOut(int& tindex);
29  void OriginBC(double r0, double& u0, double& du0);
30  void InfinityBC(double rend, double& uend, double& duend);
34 
35 public:
36  std::shared_ptr<Grid> grid;
38  int n, l, CoreNodes;
40  std::string Label;
41 
42  inline double NormDeriv(double r, double u);
43  inline Vec2 PseudoDerivs(double r, Vec2& u_and_du);
44  inline Vec2 NormalDerivs(double r, Vec2& u_and_du);
45  inline Vec2 ScalarRelDerivs(double r, Vec2& u_and_du);
46  int CountNodes();
47  void IntegrateOut();
48  double PartialNorm();
49  double LogDerivative();
50  void Solve(double tolerance = 1.0e-8);
51  void Normalize();
52  void SetGrid(std::shared_ptr<Grid>& newgrid);
53  void SetPotential(Potential* newPot);
55  void Write(IOSectionClass& out);
56  void Read(IOSectionClass& in);
57 };
58 
59 
60 // These are wrappers so we can inline integration routines
61 
62 /// Derivative used for normalization of the radial function
64 {
65 private:
67 
68 public:
69  inline double operator()(double r, double u) { return WF.NormDeriv(r, u); }
71  { /* Do nothing */
72  }
73 };
74 
75 /// Derivatives for the radial equation given a pseudoHamiltonian
76 class PHDerivs
77 {
78 private:
80 
81 public:
82  inline Vec2 operator()(double r, Vec2& u_and_du) { return WF.PseudoDerivs(r, u_and_du); }
83  PHDerivs(RadialWF& wf) : WF(wf)
84  { /* Do nothing */
85  }
86 };
87 
88 /// Derivatives for the radial equation given a pseudoHamiltonian
90 {
91 private:
93 
94 public:
95  inline Vec2 operator()(double r, Vec2& u_and_du) { return WF.NormalDerivs(r, u_and_du); }
97  { /* Do nothing */
98  }
99 };
100 
101 
102 /// Derivatives for the scalar relativistic radial equation
104 {
105 private:
107 
108 public:
109  inline Vec2 operator()(double r, Vec2& u_and_du) { return WF.ScalarRelDerivs(r, u_and_du); }
111  { /* Do nothing */
112  }
113 };
114 
115 
116 /////////////////////////////////////////////////////////////////
117 // Inline functions //
118 /////////////////////////////////////////////////////////////////
119 
120 inline double RadialWF::NormDeriv(double r, double cumulative)
121 {
122  double uval = u(r);
123  return (uval * uval);
124 }
125 
126 inline Vec2 RadialWF::PseudoDerivs(double r, Vec2& u_and_du)
127 {
128  Vec2 derivs;
129  derivs[0] = u_and_du[1];
130  double A = pot->A(r);
131  double B = pot->B(r);
132  double V = pot->V(l, r);
133  double dAdr = pot->dAdr(r);
134  derivs[1] = 1.0 / A *
135  (-dAdr * u_and_du[1] + (dAdr / r + (double)(l * (l + 1)) * B / (r * r) + 2.0 * (V - Energy)) * u_and_du[0]);
136  return derivs;
137 }
138 
139 
140 inline Vec2 RadialWF::NormalDerivs(double r, Vec2& u_and_du)
141 {
142  Vec2 derivs;
143  double V = pot->V(l, r);
144  derivs[0] = u_and_du[1];
145  derivs[1] = ((double)(l * (l + 1)) / (r * r) + 2.0 * (V - Energy)) * u_and_du[0];
146  return derivs;
147 }
148 
149 
150 inline Vec2 RadialWF::ScalarRelDerivs(double r, Vec2& u_and_du)
151 {
152  const double alpha = 1.0 / 137.036;
153  const double kappa = -1.0;
154 
155  Vec2 derivs;
156  derivs[0] = u_and_du[1];
157  double V = pot->V(l, r);
158  double dVdr = pot->dVdr(r);
159  double M = 1.0 - alpha * alpha * 0.5 * (V - Energy);
160 
161  derivs[1] = ((double)(l * (l + 1)) / (r * r) + 2.0 * M * (V - Energy)) * u_and_du[0] -
162  0.5 * alpha * alpha / M * dVdr * (u_and_du[1] + u_and_du[0] * kappa / r);
163 
164  return derivs;
165 }
166 
167 #endif
double Occupancy
Definition: RadialWF.h:39
virtual double B(double r)
Definition: PotentialBase.h:37
void Normalize()
double Energy
Definition: RadialWF.h:39
RegularDerivs(RadialWF &wf)
Definition: RadialWF.h:96
int l
Definition: RadialWF.h:38
NonPHDerivs(RadialWF &wf)
Definition: RadialWF.h:110
void IntegrateOut()
void Read(IOSectionClass &in)
int n
Definition: RadialWF.h:38
Derivatives for the radial equation given a pseudoHamiltonian.
Definition: RadialWF.h:89
The CubicSplineCommon class is a third-order spline representation of a function. ...
double IntegrateInOut(int &tindex)
RadialWF & WF
Definition: RadialWF.h:79
double PartialNorm()
virtual double dVdr(int l, double r)
double LogDerivative()
double NormDeriv(double r, double u)
Definition: RadialWF.h:120
Derivatives for the radial equation given a pseudoHamiltonian.
Definition: RadialWF.h:76
Vec2 NormalDerivs(double r, Vec2 &u_and_du)
Definition: RadialWF.h:140
virtual double A(double r)
Definition: PotentialBase.h:36
RadialWF & WF
Definition: RadialWF.h:106
double Weight
Definition: RadialWF.h:39
std::shared_ptr< Grid > grid
Definition: RadialWF.h:36
int CoreNodes
Definition: RadialWF.h:38
RadialWF & WF
Definition: RadialWF.h:66
NormalizeDeriv(RadialWF &wf)
Definition: RadialWF.h:70
Vec2 ScalarRelDerivs(double r, Vec2 &u_and_du)
Definition: RadialWF.h:150
virtual double dAdr(double r)
Definition: PotentialBase.h:38
virtual double V(int l, double r)
Potential * pot
Definition: RadialWF.h:33
Vec2 operator()(double r, Vec2 &u_and_du)
Definition: RadialWF.h:109
std::string Label
Definition: RadialWF.h:40
double operator()(double r, double u)
Definition: RadialWF.h:69
void Write(IOSectionClass &out)
void InfinityBC(double rend, double &uend, double &duend)
int CountNodes()
Wrapper class for IOTreeClass that gives a nearly identical interface as the OutputSectionClass.
Definition: IO.h:110
Vec2 PseudoDerivs(double r, Vec2 &u_and_du)
Definition: RadialWF.h:126
void Solve(double tolerance=1.0e-8)
void SetPotential(Potential *newPot)
CubicSplineCommon dudr
Definition: RadialWF.h:37
RadialWF & WF
Definition: RadialWF.h:92
double B(double x, int k, int i, const std::vector< double > &t)
PHDerivs(RadialWF &wf)
Definition: RadialWF.h:83
void OriginBC(double r0, double &u0, double &du0)
int TurningIndex()
Vec2 operator()(double r, Vec2 &u_and_du)
Definition: RadialWF.h:82
A D-dimensional Array class based on PETE.
Definition: OhmmsArray.h:25
CubicSplineCommon u
Definition: RadialWF.h:37
void SetGrid(std::shared_ptr< Grid > &newgrid)
Array< double, 1 > normVec
Definition: RadialWF.h:32
Array< Vec2, 1 > uduVec
Definition: RadialWF.h:31
Vec2 operator()(double r, Vec2 &u_and_du)
Definition: RadialWF.h:95
Potential * GetPotential()
Derivatives for the scalar relativistic radial equation.
Definition: RadialWF.h:103
Derivative used for normalization of the radial function.
Definition: RadialWF.h:63