QMCPACK
OneDimGridFactory Struct Reference

Factory class using Singleton pattern. More...

+ Inheritance diagram for OneDimGridFactory:
+ Collaboration diagram for OneDimGridFactory:

Public Types

using GridType = OneDimGridBase< RealType >
 typedef of the one-dimensional grid More...
 
- Public Types inherited from QMCTraits
enum  { DIM = OHMMS_DIM, DIM_VGL = OHMMS_DIM + 2 }
 
using QTBase = QMCTypes< OHMMS_PRECISION, DIM >
 
using QTFull = QMCTypes< OHMMS_PRECISION_FULL, DIM >
 
using RealType = QTBase::RealType
 
using ComplexType = QTBase::ComplexType
 
using ValueType = QTBase::ValueType
 
using PosType = QTBase::PosType
 
using GradType = QTBase::GradType
 
using TensorType = QTBase::TensorType
 
using IndexType = OHMMS_INDEXTYPE
 define other types More...
 
using FullPrecRealType = QTFull::RealType
 
using FullPrecValueType = QTFull::ValueType
 
using PropertySetType = RecordNamedProperty< FullPrecRealType >
 define PropertyList_t More...
 
using PtclGrpIndexes = std::vector< std::pair< int, int > >
 

Static Public Member Functions

static std::unique_ptr< GridTypecreateGrid (xmlNodePtr cur)
 return a GridType* More...
 

Detailed Description

Factory class using Singleton pattern.

Definition at line 24 of file OneDimGridFactory.h.

Member Typedef Documentation

◆ GridType

typedef of the one-dimensional grid

Definition at line 27 of file OneDimGridFactory.h.

Member Function Documentation

◆ createGrid()

std::unique_ptr< OneDimGridFactory::GridType > createGrid ( xmlNodePtr  cur)
static

return a GridType*

Parameters
curxmlnode for the grid definition

Definition at line 21 of file OneDimGridFactory.cpp.

References OhmmsAttributeSet::add(), qmcplusplus::app_error(), qmcplusplus::Units::charge::e, LOGMSG, and OhmmsAttributeSet::put().

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

22 {
23  std::unique_ptr<GridType> agrid;
24  RealType ri = 1e-5;
25  RealType rf = 100.0;
26  RealType ascale = -1.0e0;
27  RealType astep = 1.25e-2;
28  IndexType npts = 1001;
29  std::string gridType("log");
30  std::string gridID("invalid");
31  OhmmsAttributeSet radAttrib;
32  radAttrib.add(gridType, "type");
33  radAttrib.add(npts, "npts");
34  radAttrib.add(ri, "ri");
35  radAttrib.add(rf, "rf");
36  radAttrib.add(ascale, "ascale");
37  radAttrib.add(astep, "astep");
38  radAttrib.add(ascale, "scale");
39  radAttrib.add(astep, "step");
40  radAttrib.add(gridID, "id");
41  radAttrib.add(gridID, "name");
42  radAttrib.add(gridID, "ref");
43  if (cur != NULL)
44  radAttrib.put(cur);
45  if (gridType == "log")
46  {
47  if (ascale > 0.0)
48  {
49  LOGMSG("Using log grid with default values: scale = " << ascale << " step = " << astep << " npts = " << npts)
50  agrid = std::make_unique<LogGridZero<RealType>>();
51  agrid->set(astep, ascale, npts);
52  }
53  else
54  {
55  LOGMSG("Using log grid with default values: ri = " << ri << " rf = " << rf << " npts = " << npts)
56  if (ri < std::numeric_limits<RealType>::epsilon())
57  {
58  ri = std::numeric_limits<RealType>::epsilon();
59  app_error() << " LogGrid cannot accept r=0 for the initial point. Using ri=" << ri << std::endl;
60  }
61  agrid = std::make_unique<LogGrid<RealType>>();
62  agrid->set(ri, rf, npts);
63  }
64  }
65  else if (gridType == "linear")
66  {
67  LOGMSG("Using linear grid with default values: ri = " << ri << " rf = " << rf << " npts = " << npts)
68  agrid = std::make_unique<LinearGrid<RealType>>();
69  agrid->set(ri, rf, npts);
70  }
71  else
72  {
73  throw UniformCommunicateError("Unknown gridtype. Valid settings are \"log\" and \"linear\"\n");
74  }
75  return agrid;
76 }
bool put(xmlNodePtr cur)
assign attributes to the set
Definition: AttributeSet.h:55
std::ostream & app_error()
Definition: OutputManager.h:67
class to handle a set of attributes of an xmlNode
Definition: AttributeSet.h:24
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
QMCTraits::RealType RealType
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
#define LOGMSG(msg)
Definition: OutputManager.h:82

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