QMCPACK
ExampleHeComponent.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) 2019 QMCPACK developers.
6 //
7 // File developed by: Mark Dewing, mdewing@anl.gov, Argonne National Laboratory
8 //
9 // File created by: Mark Dewing, mdewing@anl.gov, Argonne National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #ifndef QMCPLUSPLUS_EXAMPLEHECOMPONENT_H
14 #define QMCPLUSPLUS_EXAMPLEHECOMPONENT_H
16 
17 /**@file ExampleHeComponent.h
18  *
19  * An example wavefunction component for a simple wavefunction for a helium atom.
20  * It uses STO orbitals and a Pade Jastrow. This wavefunction can be created using
21  * the input file in examples/molecules/He/he_example_wf.xml.
22  * There is more detail in the manual in the Development chapter, in the "Adding a wavefunction" section.
23  */
24 namespace qmcplusplus
25 {
27 {
28 public:
30  : OptimizableObject("example"),
31  ions_(ions),
33  my_table_ei_idx_(els.addTable(ions, DTModes::NEED_VP_FULL_TABLE_ON_HOST)){};
34 
37 
38  std::string getClassName() const override { return "ExampleHeComponent"; }
39  void extractOptimizableObjectRefs(UniqueOptObjRefs& opt_obj_refs) override { opt_obj_refs.push_back(*this); }
40  bool isOptimizable() const override { return true; }
41  void checkInVariablesExclusive(OptVariablesType& active) override { active.insertFrom(my_vars_); }
42  void checkOutVariables(const OptVariablesType& active) override { my_vars_.getIndex(active); }
43  void resetParametersExclusive(const OptVariablesType& active) override;
44 
47  ParticleSet::ParticleLaplacian& L) override;
48 
49  void acceptMove(ParticleSet& P, int iat, bool safe_to_delay = false) override {}
50 
51  void restore(int iat) override {}
52 
53  PsiValue ratio(ParticleSet& P, int iat) override;
54 
55  GradType evalGrad(ParticleSet& P, int iat) override;
56 
57  PsiValue ratioGrad(ParticleSet& P, int iat, GradType& grad_iat) override;
58 
60  const OptVariablesType& optvars,
61  Vector<ValueType>& dlogpsi,
62  Vector<ValueType>& dhpsioverpsi) override;
63 
64 
65  void registerData(ParticleSet& P, WFBufferType& buf) override {}
66 
67  LogValue updateBuffer(ParticleSet& P, WFBufferType& buf, bool fromscratch = false) override;
68 
69  void copyFromBuffer(ParticleSet& P, WFBufferType& buf) override {}
70 
71  std::unique_ptr<WaveFunctionComponent> makeClone(ParticleSet& tpq) const override;
72 
73  bool put(xmlNodePtr cur);
74 
75  bool opt_B;
77  std::string ID_B;
78 
81 
82 private:
84  const int my_table_ee_idx_;
85  const int my_table_ei_idx_;
86 
88 };
89 
90 } // namespace qmcplusplus
91 #endif
std::vector< std::pair< int, int > > PtclGrpIndexes
Definition: Configuration.h:72
LogValue evaluateLog(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L) override
evaluate the value of the WaveFunctionComponent from scratch
void checkInVariablesExclusive(OptVariablesType &active) override
check in variational parameters to the global list of parameters used by the optimizer.
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
QTBase::RealType RealType
Definition: Configuration.h:58
void registerData(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
void restore(int iat) override
If a move for iat-th particle is rejected, restore to the content.
std::string getClassName() const override
return class name
For distance tables of virtual particle (VP) sets constructed based on this table, whether full table is needed on host The corresponding DT of VP need to set MW_EVALUATE_RESULT_NO_TRANSFER_TO_HOST accordingly.
LatticeGaussianProduct::GradType GradType
GradType evalGrad(ParticleSet &P, int iat) override
return the current gradient for the iat-th particle
void evaluateDerivatives(ParticleSet &P, const OptVariablesType &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi) override
Compute the derivatives of both the log of the wavefunction and kinetic energy with respect to optimi...
Attaches a unit to a Vector for IO.
An abstract class for a component of a many-body trial wave function.
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
bool isOptimizable() const override
if true, this contains optimizable components
PsiValue ratio(ParticleSet &P, int iat) override
evaluate the ratio of the new to old WaveFunctionComponent value
void resetParametersExclusive(const OptVariablesType &active) override
reset the parameters during optimizations.
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
optimize::VariableSet OptVariablesType
ExampleHeComponent(const ParticleSet &ions, ParticleSet &els)
std::unique_ptr< WaveFunctionComponent > makeClone(ParticleSet &tpq) const override
make clone
void extractOptimizableObjectRefs(UniqueOptObjRefs &opt_obj_refs) override
extract underlying OptimizableObject references
PsiValue ratioGrad(ParticleSet &P, int iat, GradType &grad_iat) override
evaluate the ratio of the new to old WaveFunctionComponent value and the new gradient ...
void copyFromBuffer(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
void insertFrom(const VariableSet &input)
insert a VariableSet to the list
Definition: VariableSet.cpp:37
Declaration of WaveFunctionComponent.
std::complex< double > LogValue
void checkOutVariables(const OptVariablesType &active) override
check out variational optimizable variables
int getIndex(const std::string &vname) const
return the Index vaule for the named parameter
void push_back(OptimizableObject &obj)
whether temporary data set on the host is updated or not when a move is proposed. ...
void acceptMove(ParticleSet &P, int iat, bool safe_to_delay=false) override
a move for iat-th particle is accepted.
LogValue updateBuffer(ParticleSet &P, WFBufferType &buf, bool fromscratch=false) override
For particle-by-particle move.