QMCPACK
LogGridZero< T, CT > Struct Template Reference

One-Dimensional logarithmic-grid starting at the origin (Used in Siesta). More...

+ Inheritance diagram for LogGridZero< T, CT >:
+ Collaboration diagram for LogGridZero< T, CT >:

Public Member Functions

std::unique_ptr< OneDimGridBase< T, CT > > makeClone () const override
 
int locate (T r) const override
 evaluate the index of r More...
 
void set (T ri, T rf, int n) override
 the meaing of ri/rf are different from the convetions of other classes More...
 
- Public Member Functions inherited from OneDimGridBase< T, CT >
 OneDimGridBase ()
 
virtual ~OneDimGridBase ()=default
 
int getGridTag () const
 
int getIndex (T r) const
 
T & operator[] (int i)
 assign a value More...
 
T & operator() (int i)
 assign a value More...
 
operator[] (int i) const
 return a value More...
 
operator() (int i) const
 return a value More...
 
const T * data () const
 
T * data ()
 
dh () const
 return the differential spacing of the grid More...
 
r (int i) const
 returns $ r(i)$ More...
 
dr (int i) const
 returns $ r(i+1)-r(i)$ More...
 
int size () const
 returns the size of the grid More...
 
rmin () const
 return the first grid point More...
 
rmax () const
 return the last grid point More...
 
template<typename T1 >
int getIndexAndDistanceFromGridPoint (T r, T1 &dist) const
 

Public Attributes

OneOverA
 
OneOverB
 
- Public Attributes inherited from OneDimGridBase< T, CT >
int GridTag
 
int num_points
 
value_type lower_bound
 
value_type upper_bound
 
value_type Delta
 differential spacing of the grid More...
 
double DeltaInv
 
Array_t X
 array to store the radial grid data More...
 

Additional Inherited Members

- Public Types inherited from OneDimGridBase< T, CT >
using value_type = T
 
using Array_t = CT
 

Detailed Description

template<class T, class CT = Vector<T>>
struct qmcplusplus::LogGridZero< T, CT >

One-Dimensional logarithmic-grid starting at the origin (Used in Siesta).

The analytic form $ r_i = B \left[ \exp(Ai)-1 \right] , $ where the number of points is $ N $ and the index $ i $ runs from 0 to $ N-1 $

Definition at line 233 of file OneDimGridBase.h.

Member Function Documentation

◆ locate()

int locate ( r) const
inlineoverridevirtual

evaluate the index of r

Parameters
rcurrent position

The grid index satisfies $ X[Loc] \ge r < X[Loc+1]$.

Implements OneDimGridBase< T, CT >.

Definition at line 249 of file OneDimGridBase.h.

References qmcplusplus::log(), LogGridZero< T, CT >::OneOverA, LogGridZero< T, CT >::OneOverB, and OneDimGridBase< T, CT >::r().

249 { return static_cast<int>(std::log(r * OneOverB + 1.0) * OneOverA); }
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)
T r(int i) const
returns

◆ makeClone()

std::unique_ptr<OneDimGridBase<T, CT> > makeClone ( ) const
inlineoverridevirtual

Implements OneDimGridBase< T, CT >.

Definition at line 244 of file OneDimGridBase.h.

245  {
246  return std::make_unique<LogGridZero<T, CT>>(*this);
247  }

◆ set()

void set ( ri,
rf,
int  n 
)
inlineoverridevirtual

the meaing of ri/rf are different from the convetions of other classes

Parameters
riratio
rfnorm
nnumber of grid, [0,n)

Implements OneDimGridBase< T, CT >.

Definition at line 256 of file OneDimGridBase.h.

References OneDimGridBase< T, CT >::Delta, qmcplusplus::exp(), OneDimGridBase< T, CT >::GridTag, LOGZERO_1DGRID, OneDimGridBase< T, CT >::lower_bound, qmcplusplus::n, OneDimGridBase< T, CT >::num_points, LogGridZero< T, CT >::OneOverA, LogGridZero< T, CT >::OneOverB, OneDimGridBase< T, CT >::upper_bound, and OneDimGridBase< T, CT >::X.

257  {
259  lower_bound = ri;
260  upper_bound = rf;
261  num_points = n;
262  OneOverA = 1.0 / ri;
263  OneOverB = 1.0 / rf;
264  X.resize(n);
265  for (int i = 0; i < n; i++)
266  X[i] = rf * (std::exp(ri * i) - 1.0);
267  Delta = 0.0;
268  }
Array_t X
array to store the radial grid data
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
value_type Delta
differential spacing of the grid

Member Data Documentation

◆ OneOverA

T OneOverA

Definition at line 241 of file OneDimGridBase.h.

Referenced by LogGridZero< T, CT >::locate(), and LogGridZero< T, CT >::set().

◆ OneOverB

T OneOverB

Definition at line 242 of file OneDimGridBase.h.

Referenced by LogGridZero< T, CT >::locate(), and LogGridZero< T, CT >::set().


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