QMCPACK
OneDimNumGridFunctor.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 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
9 //
10 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 
14 /** @file OneDimNumGridFunctor.h
15  * @brief Definition of OneDimNumGridFunctor
16  */
17 #ifndef QMCPLUSPLUS_ONEDIMNUMGRIDFUNCTOR_H
18 #define QMCPLUSPLUS_ONEDIMNUMGRIDFUNCTOR_H
21 
22 namespace qmcplusplus
23 {
24 /** adaptor class to handle a temporary OneDimCubicSpline on a numerical grid.
25  */
26 template<class T>
28 {
31 
33 
34  inline OneDimNumGridFunctor() { myFunc.m_grid = std::make_unique<GridType>(); }
35 
36  inline T r(int i) const { return (*myFunc.m_grid)[i]; }
37  inline T operator()(int i) const { return myFunc(i); }
38 
39  inline T rmax() const { return myFunc.m_grid->rmax(); }
40 
41  inline T rmin() const { return myFunc.m_grid->rmin(); }
42 
43  inline T splint(T r) { return myFunc.splint(r); }
44 
45  void put(int npoints, std::istream& fin)
46  {
47  auto& myGrid = dynamic_cast<GridType&>(*myFunc.m_grid);
48  myGrid.resize(npoints);
49  myFunc.resize(npoints);
50  for (int j = 0; j < npoints; j++)
51  {
52  fin >> myGrid(j) >> myFunc(j);
53  }
54  myGrid.set(myGrid(0), myGrid(npoints - 1), npoints);
55  T yprime_i = (myFunc(1) - myFunc(0)) / (myGrid(1) - myGrid(0));
56  myFunc.spline(0, yprime_i, npoints - 1, 0.0);
57  }
58 
59  bool put(xmlNodePtr cur) { return true; }
60 };
61 } // namespace qmcplusplus
62 #endif
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
std::unique_ptr< grid_type > m_grid
pointer to the radial grid
value_type splint(point_type r) const override
void spline(int imin, value_type yp1, int imax, value_type ypn) override
Evaluate the 2nd derivative on the grid points.
Decalaration of One-Dimesional grids.
void put(int npoints, std::istream &fin)
One-Dimensional numerical grid with arbitrary grid spacings.
adaptor class to handle a temporary OneDimCubicSpline on a numerical grid.
void resize(int n)
resize the number of data points