QMCPACK
GaussianTimesRN< T > Struct Template Reference
+ Inheritance diagram for GaussianTimesRN< T >:
+ Collaboration diagram for GaussianTimesRN< T >:

Classes

struct  BasicGaussian
 

Public Types

using value_type = T
 
- Public Types inherited from OptimizableFunctorBase
using real_type = optimize::VariableSet::real_type
 typedef for real values More...
 
using opt_variables_type = optimize::VariableSet
 typedef for variableset: this is going to be replaced More...
 

Public Member Functions

 GaussianTimesRN (const char *node_name="radfunc", const char *exp_name="exponent", const char *c_name="contraction", const char *p_name="power")
 
 ~GaussianTimesRN () override
 
OptimizableFunctorBasemakeClone () const override
 create a clone of this object More...
 
void reset () override
 reset function More...
 
void checkInVariablesExclusive (opt_variables_type &active) override
 check in variational parameters to the global list of parameters used by the optimizer. More...
 
void checkOutVariables (const opt_variables_type &active) override
 check out variational optimizable variables More...
 
void resetParametersExclusive (const opt_variables_type &active) override
 reset the parameters during optimizations. More...
 
int size () const
 return the number Gaussians More...
 
real_type f (real_type r) override
 evaluate the value at r More...
 
real_type df (real_type r) override
 evaluate the first derivative More...
 
real_type evaluate (real_type r, real_type rinv)
 
void evaluateAll (real_type r, real_type rinv)
 
bool put (xmlNodePtr cur) override
 process xmlnode and registers variables to optimize More...
 
bool putBasisGroup (xmlNodePtr cur, int baseOff=0)
 process cur xmlnode More...
 
- Public Member Functions inherited from OptimizableFunctorBase
 OptimizableFunctorBase (const std::string &name="")
 default constructor More...
 
virtual ~OptimizableFunctorBase ()=default
 virtual destrutor More...
 
void getIndex (const opt_variables_type &active)
 
virtual void setDensity (real_type n)
 empty virtual function to help builder classes More...
 
virtual void setCusp (real_type cusp)
 empty virtual function to help builder classes More...
 
virtual void setPeriodic (bool periodic)
 empty virtual function to help builder classes More...
 
virtual bool evaluateDerivatives (real_type r, std::vector< qmcplusplus::TinyVector< real_type, 3 >> &derivs)
 
virtual bool evaluateDerivatives (real_type r, std::vector< real_type > &derivs)
 
virtual void setGridManager (bool willmanage)
 
virtual void checkInVariablesExclusive (opt_variables_type &active)=0
 check in variational parameters to the global list of parameters used by the optimizer. More...
 
virtual void resetParametersExclusive (const opt_variables_type &active)=0
 reset the parameters during optimizations More...
 
- Public Member Functions inherited from OptimizableObject
 OptimizableObject (const std::string &name)
 
const std::string & getName () const
 
bool isOptimized () const
 
virtual void reportStatus (std::ostream &os)
 print the state, e.g., optimizables More...
 
void setOptimization (bool state)
 
virtual void writeVariationalParameters (hdf_archive &hout)
 Write the variational parameters for this object to the VP HDF file. More...
 
virtual void readVariationalParameters (hdf_archive &hin)
 Read the variational parameters for this object from the VP HDF file. More...
 

Public Attributes

real_type Y
 
real_type dY
 
real_type d2Y
 
int basePower
 
std::string nodeName
 
std::string expName
 
std::string coeffName
 
std::string powerName
 
std::vector< xmlNodePtr > InParam
 
std::vector< BasicGaussiangset
 
- Public Attributes inherited from OptimizableFunctorBase
real_type cutoff_radius = 0.0
 maximum cutoff More...
 
opt_variables_type myVars
 set of variables to be optimized More...
 

Detailed Description

template<class T>
struct qmcplusplus::GaussianTimesRN< T >

Definition at line 26 of file GaussianTimesRN.h.

Member Typedef Documentation

◆ value_type

using value_type = T

Definition at line 28 of file GaussianTimesRN.h.

Constructor & Destructor Documentation

◆ GaussianTimesRN()

GaussianTimesRN ( const char *  node_name = "radfunc",
const char *  exp_name = "exponent",
const char *  c_name = "contraction",
const char *  p_name = "power" 
)
inlineexplicit

Definition at line 112 of file GaussianTimesRN.h.

◆ ~GaussianTimesRN()

~GaussianTimesRN ( )
inlineoverride

Definition at line 119 of file GaussianTimesRN.h.

119 {}

Member Function Documentation

◆ checkInVariablesExclusive()

void checkInVariablesExclusive ( opt_variables_type active)
inlineoverridevirtual

check in variational parameters to the global list of parameters used by the optimizer.

Parameters
activea super set of optimizable variables

The existing checkInVariables implementation in WFC/SPO/.. are inclusive and it calls checkInVariables of its members class A: public SPOSet {} class B: public WFC { A objA; checkInVariables() { objA.checkInVariables(); } };

With OptimizableObject, class A: public OptimizableObject {} class B: public OptimizableObject { A objA; checkInVariablesExclusive() { // should not call objA.checkInVariablesExclusive() if objA has been extracted; } }; A vector of OptimizableObject, will be created by calling extractOptimizableObjects(). All the checkInVariablesExclusive() will be called through this vector and thus checkInVariablesExclusive implementation should only handle non-OptimizableObject members.

Implements OptimizableObject.

Definition at line 125 of file GaussianTimesRN.h.

125 {}

◆ checkOutVariables()

void checkOutVariables ( const opt_variables_type active)
inlineoverridevirtual

check out variational optimizable variables

Parameters
activea super set of optimizable variables

Implements OptimizableFunctorBase.

Definition at line 126 of file GaussianTimesRN.h.

126 {}

◆ df()

real_type df ( real_type  r)
inlineoverridevirtual

evaluate the first derivative

Parameters
rdistance

virtual function necessary for a transformation to a numerical functor

Implements OptimizableFunctorBase.

Definition at line 150 of file GaussianTimesRN.h.

References GaussianTimesRN< T >::gset.

151  {
152  real_type res = 0;
153  real_type r2 = r * r;
154  typename std::vector<BasicGaussian>::iterator it(gset.begin());
155  typename std::vector<BasicGaussian>::iterator it_end(gset.end());
156  while (it != it_end)
157  {
158  res += (*it).df(r, r2);
159  ++it;
160  }
161  return res;
162  }
std::vector< BasicGaussian > gset
OHMMS_PRECISION real_type

◆ evaluate()

real_type evaluate ( real_type  r,
real_type  rinv 
)
inline

Definition at line 164 of file GaussianTimesRN.h.

References GaussianTimesRN< T >::gset, and GaussianTimesRN< T >::Y.

165  {
166  Y = 0.0;
167  real_type rr = r * r;
168  typename std::vector<BasicGaussian>::iterator it(gset.begin()), it_end(gset.end());
169  while (it != it_end)
170  {
171  Y += (*it).f(r, rr);
172  ++it;
173  }
174  return Y;
175  }
std::vector< BasicGaussian > gset
OHMMS_PRECISION real_type

◆ evaluateAll()

void evaluateAll ( real_type  r,
real_type  rinv 
)
inline

Definition at line 177 of file GaussianTimesRN.h.

References GaussianTimesRN< T >::d2Y, GaussianTimesRN< T >::dY, GaussianTimesRN< T >::gset, and GaussianTimesRN< T >::Y.

178  {
179  Y = 0.0;
180  dY = 0.0;
181  d2Y = 0.0;
182  real_type rr = r * r;
183  typename std::vector<BasicGaussian>::iterator it(gset.begin()), it_end(gset.end());
184  while (it != it_end)
185  {
186  Y += (*it).evaluate(r, rr, dY, d2Y);
187  ++it;
188  }
189  }
std::vector< BasicGaussian > gset
OHMMS_PRECISION real_type

◆ f()

real_type f ( real_type  r)
inlineoverridevirtual

evaluate the value at r

Parameters
rdistance

virtual function necessary for a transformation to a numerical functor

Implements OptimizableFunctorBase.

Definition at line 136 of file GaussianTimesRN.h.

References GaussianTimesRN< T >::gset.

137  {
138  real_type res = 0;
139  real_type r2 = r * r;
140  typename std::vector<BasicGaussian>::iterator it(gset.begin());
141  typename std::vector<BasicGaussian>::iterator it_end(gset.end());
142  while (it != it_end)
143  {
144  res += (*it).f(r, r2);
145  ++it;
146  }
147  return res;
148  }
std::vector< BasicGaussian > gset
OHMMS_PRECISION real_type

◆ makeClone()

OptimizableFunctorBase* makeClone ( ) const
inlineoverridevirtual

create a clone of this object

Implements OptimizableFunctorBase.

Definition at line 121 of file GaussianTimesRN.h.

121 { return new GaussianTimesRN<T>(*this); }

◆ put()

bool put ( xmlNodePtr  cur)
overridevirtual

process xmlnode and registers variables to optimize

Parameters
curxmlNode for a functor

Implements OptimizableFunctorBase.

Definition at line 201 of file GaussianTimesRN.h.

202 {
203  InParam.push_back(cur);
204  return true;
205 }
std::vector< xmlNodePtr > InParam

◆ putBasisGroup()

bool putBasisGroup ( xmlNodePtr  cur,
int  baseOff = 0 
)

process cur xmlnode

Parameters
curroot node
baseOffoffset to the basePower

Definition at line 238 of file GaussianTimesRN.h.

References getXMLAttributeValue().

Referenced by ECPComponentBuilder::createVrWithBasisGroup().

239 {
240  const std::string t(getXMLAttributeValue(cur, "basePower"));
241  if (!t.empty())
242  basePower = std::stoi(t);
243  basePower += baseOff;
244  cur = cur->children;
245  while (cur != NULL)
246  {
247  std::string cname((const char*)cur->name);
248  if (cname == "radfunc")
249  {
250  put(cur);
251  }
252  cur = cur->next;
253  }
254  reset();
255  return true;
256 }
bool put(xmlNodePtr cur) override
process xmlnode and registers variables to optimize
void reset() override
reset function
std::string getXMLAttributeValue(const xmlNodePtr cur, const std::string_view name)
get the value string for attribute name if name is unfound in cur you get an empty string back this i...

◆ reset()

void reset ( )
overridevirtual

reset function

Implements OptimizableFunctorBase.

Definition at line 208 of file GaussianTimesRN.h.

References OhmmsAttributeSet::add(), qmcplusplus::n, and OhmmsAttributeSet::put().

209 {
210  if (InParam.empty())
211  {
212  for (int i = 0; i < gset.size(); i++)
213  gset[i].reset();
214  }
215  else
216  {
217  int n = gset.size();
218  while (n < InParam.size())
219  {
220  gset.push_back(BasicGaussian());
221  n++;
222  }
223  for (int i = 0; i < InParam.size(); i++)
224  {
225  T alpha(1.0), c(1.0);
226  int np(0);
227  OhmmsAttributeSet radAttrib;
228  radAttrib.add(alpha, expName);
229  radAttrib.add(c, coeffName);
230  radAttrib.add(np, powerName);
231  radAttrib.put(InParam[i]);
232  gset[i].resetGaussian(alpha, c, np + basePower);
233  }
234  }
235 }
void reset() override
reset function
bool put(xmlNodePtr cur)
assign attributes to the set
Definition: AttributeSet.h:55
std::vector< xmlNodePtr > InParam
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
std::vector< BasicGaussian > gset
class to handle a set of attributes of an xmlNode
Definition: AttributeSet.h:24

◆ resetParametersExclusive()

void resetParametersExclusive ( const opt_variables_type active)
inlineoverridevirtual

reset the parameters during optimizations.

Exclusive, see checkInVariablesExclusive

DO NOTHING FOR NOW

Implements OptimizableObject.

Definition at line 127 of file GaussianTimesRN.h.

128  {
129  ///DO NOTHING FOR NOW
130  }

◆ size()

int size ( void  ) const
inline

return the number Gaussians

Definition at line 134 of file GaussianTimesRN.h.

References GaussianTimesRN< T >::gset.

134 { return gset.size(); }
std::vector< BasicGaussian > gset

Member Data Documentation

◆ basePower

int basePower

Definition at line 104 of file GaussianTimesRN.h.

◆ coeffName

std::string coeffName

Definition at line 107 of file GaussianTimesRN.h.

◆ d2Y

real_type d2Y

Definition at line 29 of file GaussianTimesRN.h.

Referenced by GaussianTimesRN< T >::evaluateAll().

◆ dY

Definition at line 29 of file GaussianTimesRN.h.

Referenced by GaussianTimesRN< T >::evaluateAll().

◆ expName

std::string expName

Definition at line 106 of file GaussianTimesRN.h.

◆ gset

◆ InParam

std::vector<xmlNodePtr> InParam

Definition at line 109 of file GaussianTimesRN.h.

◆ nodeName

std::string nodeName

Definition at line 105 of file GaussianTimesRN.h.

◆ powerName

std::string powerName

Definition at line 108 of file GaussianTimesRN.h.

◆ Y


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