QMCPACK
OneDimQuinticSpline< Td, Tg, CTd, CTg > Class Template Reference
+ Inheritance diagram for OneDimQuinticSpline< Td, Tg, CTd, CTg >:
+ Collaboration diagram for OneDimQuinticSpline< Td, Tg, CTd, CTg >:

Public Types

using base_type = OneDimGridFunctor< Td, Tg, CTd, CTg >
 
using value_type = typename base_type::value_type
 
using point_type = typename base_type::point_type
 
using data_type = typename base_type::data_type
 
using grid_type = typename base_type::grid_type
 
- Public Types inherited from OneDimGridFunctor< Td, Tg, CTd, CTg >
using value_type = Td
 the type of the value on a grid More...
 
using point_type = Tg
 the type of the grid value More...
 
using data_type = CTd
 the type of the containers Y, dY and d2Y More...
 
using grid_type = OneDimGridBase< Tg, CTg >
 the grid type More...
 
using this_type = OneDimGridFunctor< Td, Tg, CTd, CTg >
 the type of this class More...
 

Public Member Functions

 OneDimQuinticSpline (std::unique_ptr< grid_type > gt=std::unique_ptr< grid_type >())
 
template<class VV >
 OneDimQuinticSpline (std::unique_ptr< grid_type > gt, const VV &nv)
 
void set (Vector< Td > &data)
 
OneDimQuinticSpline< Td, Tg, CTd, CTg > * makeClone () const
 
 OneDimQuinticSpline (const OneDimQuinticSpline< Td, Tg, CTd, CTg > &a)
 
value_type splint (point_type r) const override
 
value_type splint (point_type r, value_type &du, value_type &d2u) const override
 
value_type splint (point_type r, value_type &du, value_type &d2u, value_type &d3u) const
 
void spline (int imin, value_type yp1, int imax, value_type ypn) override
 
void spline () override
 
- Public Member Functions inherited from OneDimGridFunctor< Td, Tg, CTd, CTg >
 OneDimGridFunctor (std::unique_ptr< grid_type > gt=std::unique_ptr< grid_type >())
 constructor More...
 
 OneDimGridFunctor (const OneDimGridFunctor &a)
 
virtual ~OneDimGridFunctor ()=default
 
template<typename TT >
void resetParameters (const TT &active)
 
void setNumOfNodes (int n)
 set the number of nodes More...
 
int getNumOfNodes () const
 return the number of nodes More...
 
value_typedata ()
 return the grid data More...
 
const value_typedata () const
 assign the grid data More...
 
int size () const
 return the number of data points More...
 
void resize (int n)
 resize the number of data points More...
 
const grid_typegrid () const
 return the radial grid More...
 
grid_typegrid ()
 assign a radial grid More...
 
value_type operator() (int i) const
 returns a value More...
 
value_typeoperator() (int i)
 asign a value at i More...
 
point_type dh () const
 return the address of the values More...
 
point_type r (int i) const
 return $r(i)$ the grid point at index i More...
 
point_type dr (int i) const
 return $r(i+1)-r(i)$ More...
 
value_type f (point_type r)
 Evaluate the function and its derivatives, store the derivatives. More...
 
value_type df (point_type r)
 Evaluate the function and its derivatives, store the derivatives. More...
 
value_type evaluate (point_type r, point_type rinv)
 Evaluate the function value only. More...
 
value_type evaluateAll (point_type r, point_type rinv)
 Evaluate the function and its derivatives. More...
 
value_type evaluate (point_type r, point_type rinv, value_type &du, value_type &d2u)
 Evaluate the function and its derivatives. More...
 

Public Attributes

data_type m_Y2
 
data_type B
 
data_type D
 
data_type E
 
data_type F
 
point_type r_min
 
point_type r_max
 
value_type first_deriv
 
value_type last_deriv
 
value_type ConstValue
 
value_type d2Y
 store the second derivative of the function More...
 
value_type dY
 store the derivative of the function More...
 
std::unique_ptr< grid_typem_grid
 pointer to the radial grid More...
 
data_type m_Y
 data for the function on the grid More...
 
value_type Y
 store the value of the function More...
 
int NumNodes
 the number of nodes More...
 
- Public Attributes inherited from OneDimGridFunctor< Td, Tg, CTd, CTg >
std::unique_ptr< grid_typem_grid
 pointer to the radial grid More...
 
value_type Y
 store the value of the function More...
 
value_type dY
 store the derivative of the function More...
 
value_type d2Y
 store the second derivative of the function More...
 
data_type m_Y
 data for the function on the grid More...
 
int NumNodes
 the number of nodes More...
 

Private Member Functions

Td quinticInterpolate (Td cL, Td a, Td b, Td c, Td d, Td e, Td f) const
 
Td quinticInterpolateSecondDeriv (Td cL, Td a, Td b, Td c, Td d, Td e, Td f, Td &du, Td &d2u) const
 
Td quinticInterpolateThirdDeriv (Td cL, Td a, Td b, Td c, Td d, Td e, Td f, Td &du, Td &d2u, Td &d3u) const
 

Detailed Description

template<class Td, class Tg = Td, class CTd = Vector<Td>, class CTg = Vector<Tg>>
class qmcplusplus::OneDimQuinticSpline< Td, Tg, CTd, CTg >

Definition at line 28 of file OneDimQuinticSpline.h.

Member Typedef Documentation

◆ base_type

using base_type = OneDimGridFunctor<Td, Tg, CTd, CTg>

Definition at line 31 of file OneDimQuinticSpline.h.

◆ data_type

using data_type = typename base_type::data_type

Definition at line 34 of file OneDimQuinticSpline.h.

◆ grid_type

using grid_type = typename base_type::grid_type

Definition at line 35 of file OneDimQuinticSpline.h.

◆ point_type

Definition at line 33 of file OneDimQuinticSpline.h.

◆ value_type

Definition at line 32 of file OneDimQuinticSpline.h.

Constructor & Destructor Documentation

◆ OneDimQuinticSpline() [1/3]

OneDimQuinticSpline ( std::unique_ptr< grid_type gt = std::unique_ptr<grid_type>())
inline

Definition at line 57 of file OneDimQuinticSpline.h.

57 : base_type(std::move(gt)) {}
OneDimGridFunctor< Td, Tg, CTd, CTg > base_type

◆ OneDimQuinticSpline() [2/3]

OneDimQuinticSpline ( std::unique_ptr< grid_type gt,
const VV &  nv 
)
inline

Definition at line 60 of file OneDimQuinticSpline.h.

References OneDimQuinticSpline< Td, Tg, CTd, CTg >::B, copy(), OneDimQuinticSpline< Td, Tg, CTd, CTg >::D, OneDimQuinticSpline< Td, Tg, CTd, CTg >::E, OneDimQuinticSpline< Td, Tg, CTd, CTg >::F, OneDimGridFunctor< Td, Tg, CTd, CTg >::m_Y, OneDimQuinticSpline< Td, Tg, CTd, CTg >::m_Y2, and qmcplusplus::n.

61  : base_type(std::move(gt)), first_deriv(0.0), last_deriv(0.0)
62  {
63  int n = nv.size();
64  m_Y.resize(nv.size());
65  m_Y2.resize(nv.size());
66  std::copy(nv.begin(), nv.end(), m_Y.data());
67  B.resize(n);
68  D.resize(n);
69  E.resize(n);
70  F.resize(n);
71  }
OneDimGridFunctor< Td, Tg, CTd, CTg > base_type
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
Definition: Blitz.h:639
data_type m_Y
data for the function on the grid

◆ OneDimQuinticSpline() [3/3]

OneDimQuinticSpline ( const OneDimQuinticSpline< Td, Tg, CTd, CTg > &  a)
inline

Definition at line 87 of file OneDimQuinticSpline.h.

References OneDimQuinticSpline< Td, Tg, CTd, CTg >::B, OneDimQuinticSpline< Td, Tg, CTd, CTg >::ConstValue, OneDimQuinticSpline< Td, Tg, CTd, CTg >::D, OneDimQuinticSpline< Td, Tg, CTd, CTg >::E, OneDimQuinticSpline< Td, Tg, CTd, CTg >::F, OneDimQuinticSpline< Td, Tg, CTd, CTg >::first_deriv, OneDimQuinticSpline< Td, Tg, CTd, CTg >::last_deriv, OneDimQuinticSpline< Td, Tg, CTd, CTg >::m_Y2, OneDimQuinticSpline< Td, Tg, CTd, CTg >::r_max, and OneDimQuinticSpline< Td, Tg, CTd, CTg >::r_min.

88  : OneDimGridFunctor<Td, Tg, CTd, CTg>(a)
89  {
90  m_Y2.resize(a.m_Y2.size());
91  m_Y2 = a.m_Y2;
92  ConstValue = a.ConstValue;
93  r_min = a.r_min;
94  r_max = a.r_max;
95  first_deriv = a.first_deriv;
96  last_deriv = a.last_deriv;
97  B.resize(a.B.size());
98  B = a.B;
99  D.resize(a.D.size());
100  D = a.D;
101  E.resize(a.E.size());
102  E = a.E;
103  F.resize(a.F.size());
104  F = a.F;
105  }

Member Function Documentation

◆ makeClone()

OneDimQuinticSpline<Td, Tg, CTd, CTg>* makeClone ( ) const
inline

Definition at line 85 of file OneDimQuinticSpline.h.

85 { return new OneDimQuinticSpline<Td, Tg, CTd, CTg>(*this); }

◆ quinticInterpolate()

Td quinticInterpolate ( Td  cL,
Td  a,
Td  b,
Td  c,
Td  d,
Td  e,
Td  f 
) const
inlineprivate

Definition at line 108 of file OneDimQuinticSpline.h.

References qmcplusplus::Units::charge::e, and OneDimGridFunctor< Td, Tg, CTd, CTg >::f().

Referenced by OneDimQuinticSpline< Td, Tg, CTd, CTg >::splint().

109  {
110  return a + cL * (b + cL * (c + cL * (d + cL * (e + cL * f))));
111  }
value_type f(point_type r)
Evaluate the function and its derivatives, store the derivatives.

◆ quinticInterpolateSecondDeriv()

Td quinticInterpolateSecondDeriv ( Td  cL,
Td  a,
Td  b,
Td  c,
Td  d,
Td  e,
Td  f,
Td &  du,
Td &  d2u 
) const
inlineprivate

Definition at line 113 of file OneDimQuinticSpline.h.

References qmcplusplus::Units::charge::e, and OneDimGridFunctor< Td, Tg, CTd, CTg >::f().

Referenced by OneDimQuinticSpline< Td, Tg, CTd, CTg >::splint().

114  {
115  du = b + cL * (2.0 * c + cL * (3.0 * d + cL * (4.0 * e + cL * f * 5.0)));
116  d2u = 2.0 * c + cL * (6.0 * d + cL * (12.0 * e + cL * f * 20.0));
117  return a + cL * (b + cL * (c + cL * (d + cL * (e + cL * f))));
118  }
value_type f(point_type r)
Evaluate the function and its derivatives, store the derivatives.

◆ quinticInterpolateThirdDeriv()

Td quinticInterpolateThirdDeriv ( Td  cL,
Td  a,
Td  b,
Td  c,
Td  d,
Td  e,
Td  f,
Td &  du,
Td &  d2u,
Td &  d3u 
) const
inlineprivate

Definition at line 120 of file OneDimQuinticSpline.h.

References qmcplusplus::Units::charge::e, and OneDimGridFunctor< Td, Tg, CTd, CTg >::f().

Referenced by OneDimQuinticSpline< Td, Tg, CTd, CTg >::splint().

121  {
122  du = b + cL * (2.0 * c + cL * (3.0 * d + cL * (4.0 * e + cL * f * 5.0)));
123  d2u = 2.0 * c + cL * (6.0 * d + cL * (12.0 * e + cL * f * 20.0));
124  d3u = 6.0 * d + cL * (24.0 * e + cL * f * 60.0);
125  return a + cL * (b + cL * (c + cL * (d + cL * (e + cL * f))));
126  }
value_type f(point_type r)
Evaluate the function and its derivatives, store the derivatives.

◆ set()

◆ spline() [1/2]

void spline ( int  imin,
value_type  yp1,
int  imax,
value_type  ypn 
)
inlineoverridevirtual

Reimplemented from OneDimGridFunctor< Td, Tg, CTd, CTg >.

Definition at line 175 of file OneDimQuinticSpline.h.

References OneDimQuinticSpline< Td, Tg, CTd, CTg >::B, OneDimQuinticSpline< Td, Tg, CTd, CTg >::ConstValue, OneDimQuinticSpline< Td, Tg, CTd, CTg >::D, OneDimQuinticSpline< Td, Tg, CTd, CTg >::E, OneDimQuinticSpline< Td, Tg, CTd, CTg >::F, OneDimQuinticSpline< Td, Tg, CTd, CTg >::first_deriv, OneDimQuinticSpline< Td, Tg, CTd, CTg >::last_deriv, OneDimGridFunctor< Td, Tg, CTd, CTg >::m_grid, OneDimGridFunctor< Td, Tg, CTd, CTg >::m_Y, OneDimQuinticSpline< Td, Tg, CTd, CTg >::m_Y2, QuinticSplineSolve(), OneDimQuinticSpline< Td, Tg, CTd, CTg >::r_max, OneDimQuinticSpline< Td, Tg, CTd, CTg >::r_min, and OneDimGridFunctor< Td, Tg, CTd, CTg >::size().

Referenced by qmcplusplus::applyCuspCorrection().

176  {
177  first_deriv = yp1;
178  last_deriv = ypn;
179  r_min = m_grid->r(imin);
180  r_max = m_grid->r(imax);
181  int npts(this->size());
182  m_Y2.resize(npts);
183  B.resize(npts);
184  D.resize(npts);
185  E.resize(npts);
186  F.resize(npts);
187  m_Y2 = 0.0;
188  B = 0.0;
189  D = 0.0;
190  E = 0.0;
191  F = 0.0;
192  QuinticSplineSolve(npts - imin, m_grid->data() + imin, m_Y.data() + imin, B.data() + imin, m_Y2.data() + imin,
193  D.data() + imin, E.data() + imin, F.data() + imin);
194  ConstValue = m_Y[imax];
195  }
void QuinticSplineSolve(int N, const Tg *X, T *Y, T *B, T *C, T *D, T *E, T *F)
template function: note that the range of data is [0,n) instead of [1,n] solve the linear system for ...
Definition: SplineSolvers.h:78
int size() const
return the number of data points
std::unique_ptr< grid_type > m_grid
pointer to the radial grid
data_type m_Y
data for the function on the grid

◆ spline() [2/2]

void spline ( )
inlineoverridevirtual

Reimplemented from OneDimGridFunctor< Td, Tg, CTd, CTg >.

Definition at line 197 of file OneDimQuinticSpline.h.

References OneDimGridFunctor< Td, Tg, CTd, CTg >::m_grid, and OneDimQuinticSpline< Td, Tg, CTd, CTg >::spline().

Referenced by OneDimQuinticSpline< Td, Tg, CTd, CTg >::spline().

197 { spline(0, 0.0, m_grid->size() - 1, 0.0); }
std::unique_ptr< grid_type > m_grid
pointer to the radial grid

◆ splint() [1/3]

value_type splint ( point_type  r) const
inlineoverridevirtual

Reimplemented from OneDimGridFunctor< Td, Tg, CTd, CTg >.

Definition at line 129 of file OneDimQuinticSpline.h.

References OneDimQuinticSpline< Td, Tg, CTd, CTg >::B, OneDimQuinticSpline< Td, Tg, CTd, CTg >::ConstValue, OneDimQuinticSpline< Td, Tg, CTd, CTg >::D, OneDimQuinticSpline< Td, Tg, CTd, CTg >::E, OneDimQuinticSpline< Td, Tg, CTd, CTg >::F, OneDimQuinticSpline< Td, Tg, CTd, CTg >::first_deriv, OneDimGridFunctor< Td, Tg, CTd, CTg >::m_grid, OneDimGridFunctor< Td, Tg, CTd, CTg >::m_Y, OneDimQuinticSpline< Td, Tg, CTd, CTg >::m_Y2, OneDimQuinticSpline< Td, Tg, CTd, CTg >::quinticInterpolate(), OneDimGridFunctor< Td, Tg, CTd, CTg >::r(), OneDimQuinticSpline< Td, Tg, CTd, CTg >::r_max, and OneDimQuinticSpline< Td, Tg, CTd, CTg >::r_min.

130  {
131  if (r < r_min)
132  {
133  return m_Y[0] + first_deriv * (r - r_min);
134  }
135  else if (r >= r_max)
136  {
137  return ConstValue;
138  }
139  Td cL;
140  int Loc = m_grid->getIndexAndDistanceFromGridPoint(r, cL);
141  return quinticInterpolate(cL, m_Y[Loc], B[Loc], m_Y2[Loc], D[Loc], E[Loc], F[Loc]);
142  }
Td quinticInterpolate(Td cL, Td a, Td b, Td c, Td d, Td e, Td f) const
point_type r(int i) const
return the grid point at index i
std::unique_ptr< grid_type > m_grid
pointer to the radial grid
data_type m_Y
data for the function on the grid

◆ splint() [2/3]

value_type splint ( point_type  r,
value_type du,
value_type d2u 
) const
inlineoverridevirtual

Reimplemented from OneDimGridFunctor< Td, Tg, CTd, CTg >.

Definition at line 145 of file OneDimQuinticSpline.h.

References OneDimQuinticSpline< Td, Tg, CTd, CTg >::B, OneDimQuinticSpline< Td, Tg, CTd, CTg >::ConstValue, OneDimQuinticSpline< Td, Tg, CTd, CTg >::D, OneDimQuinticSpline< Td, Tg, CTd, CTg >::E, OneDimQuinticSpline< Td, Tg, CTd, CTg >::F, OneDimQuinticSpline< Td, Tg, CTd, CTg >::first_deriv, OneDimGridFunctor< Td, Tg, CTd, CTg >::m_grid, OneDimGridFunctor< Td, Tg, CTd, CTg >::m_Y, OneDimQuinticSpline< Td, Tg, CTd, CTg >::m_Y2, OneDimQuinticSpline< Td, Tg, CTd, CTg >::quinticInterpolateSecondDeriv(), OneDimGridFunctor< Td, Tg, CTd, CTg >::r(), OneDimQuinticSpline< Td, Tg, CTd, CTg >::r_max, and OneDimQuinticSpline< Td, Tg, CTd, CTg >::r_min.

146  {
147  if (r < r_min)
148  {
149  return m_Y[0] + first_deriv * (r - r_min);
150  }
151  else if (r >= r_max)
152  {
153  return ConstValue;
154  }
155  Td cL;
156  int Loc = m_grid->getIndexAndDistanceFromGridPoint(r, cL);
157  return quinticInterpolateSecondDeriv(cL, m_Y[Loc], B[Loc], m_Y2[Loc], D[Loc], E[Loc], F[Loc], du, d2u);
158  }
Td quinticInterpolateSecondDeriv(Td cL, Td a, Td b, Td c, Td d, Td e, Td f, Td &du, Td &d2u) const
point_type r(int i) const
return the grid point at index i
std::unique_ptr< grid_type > m_grid
pointer to the radial grid
data_type m_Y
data for the function on the grid

◆ splint() [3/3]

value_type splint ( point_type  r,
value_type du,
value_type d2u,
value_type d3u 
) const
inline

Definition at line 160 of file OneDimQuinticSpline.h.

References OneDimQuinticSpline< Td, Tg, CTd, CTg >::B, OneDimQuinticSpline< Td, Tg, CTd, CTg >::ConstValue, OneDimQuinticSpline< Td, Tg, CTd, CTg >::D, OneDimQuinticSpline< Td, Tg, CTd, CTg >::E, OneDimQuinticSpline< Td, Tg, CTd, CTg >::F, OneDimQuinticSpline< Td, Tg, CTd, CTg >::first_deriv, OneDimGridFunctor< Td, Tg, CTd, CTg >::m_grid, OneDimGridFunctor< Td, Tg, CTd, CTg >::m_Y, OneDimQuinticSpline< Td, Tg, CTd, CTg >::m_Y2, OneDimQuinticSpline< Td, Tg, CTd, CTg >::quinticInterpolateThirdDeriv(), OneDimGridFunctor< Td, Tg, CTd, CTg >::r(), OneDimQuinticSpline< Td, Tg, CTd, CTg >::r_max, and OneDimQuinticSpline< Td, Tg, CTd, CTg >::r_min.

161  {
162  if (r < r_min)
163  {
164  return m_Y[0] + first_deriv * (r - r_min);
165  }
166  else if (r >= r_max)
167  {
168  return ConstValue;
169  }
170  Td cL;
171  int Loc = m_grid->getIndexAndDistanceFromGridPoint(r, cL);
172  return quinticInterpolateThirdDeriv(cL, m_Y[Loc], B[Loc], m_Y2[Loc], D[Loc], E[Loc], F[Loc], du, d2u, d3u);
173  }
Td quinticInterpolateThirdDeriv(Td cL, Td a, Td b, Td c, Td d, Td e, Td f, Td &du, Td &d2u, Td &d3u) const
point_type r(int i) const
return the grid point at index i
std::unique_ptr< grid_type > m_grid
pointer to the radial grid
data_type m_Y
data for the function on the grid

Member Data Documentation

◆ B

◆ ConstValue

◆ D

◆ d2Y

store the second derivative of the function

Definition at line 191 of file OneDimGridFunctor.h.

◆ dY

store the derivative of the function

Definition at line 189 of file OneDimGridFunctor.h.

◆ E

◆ F

◆ first_deriv

◆ last_deriv

◆ m_grid

std::unique_ptr<grid_type> m_grid

pointer to the radial grid

Definition at line 184 of file OneDimGridFunctor.h.

◆ m_Y

data_type m_Y

data for the function on the grid

Definition at line 194 of file OneDimGridFunctor.h.

Referenced by MultiQuinticSpline1D< T >::add_spline().

◆ m_Y2

◆ NumNodes

int NumNodes

the number of nodes

Definition at line 197 of file OneDimGridFunctor.h.

◆ r_max

◆ r_min

◆ Y

store the value of the function

Definition at line 187 of file OneDimGridFunctor.h.


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