QMCPACK
CSEnergyEstimator.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) 2022 QMCPACK developers.
6 //
7 // File developed by: Ken Esler, kpesler@gmail.com, University of Illinois at Urbana-Champaign
8 // Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
9 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
10 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
11 // Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
12 //
13 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
14 //////////////////////////////////////////////////////////////////////////////////////
15 
16 
17 #ifndef QMCPLUSPLUS_CORRELATEDLOCALENERGYESTIMATOR_H
18 #define QMCPLUSPLUS_CORRELATEDLOCALENERGYESTIMATOR_H
19 
21 #include "ScalarEstimatorInputs.h"
22 
23 namespace qmcplusplus
24 {
25 class QMCHamiltonian;
26 class TrialWaveFunction;
27 
29 {
30  //enum {ENERGY_INDEX, ENERGY_SQ_INDEX, WEIGHT_INDEX, PE_INDEX, KE_INDEX, LE_INDEX};
31  enum
32  {
37  };
38 
39  ///number of correlated systems
40  int NumCopies;
41  ///index of the starting Hamiltonian component
43  ///index of the ending Hamiltonian component
45  ///save umbrella weights
46  std::vector<RealType> uweights;
47  ///temporary dat
49  ///name of hamiltonian components
50  std::vector<std::string> h_components;
52  /** constructor
53  * @param h QMCHamiltonian to define the components
54  * @param hcopy number of copies of QMCHamiltonians
55  */
56  CSEnergyEstimator(const QMCHamiltonian& h, int hcopy = 1);
57 
59 
60  std::string getName() const override { return "CSEnergyEstimator"; }
61 
62  inline RealType getUmbrellaWeight(int ipsi)
63  {
64  return scalars_saved[ipsi * LE_INDEX + WEIGHT_INDEX].result();
65  //return d_data[ipsi*LE_INDEX+WEIGHT_INDEX];
66  }
67 
68  void accumulate(const Walker_t& awalker, RealType wgt);
69 
70  inline void accumulate(const MCWalkerConfiguration& W,
71  WalkerIterator first,
72  WalkerIterator last,
73  RealType wgt) override
74  {
75  //accumulate the number of times accumulation has occurred.
76  //d_wgt+=last-first;
77  for (; first != last; ++first)
78  accumulate(**first, wgt);
79  }
80 
81  inline void accumulate(const RefVector<MCPWalker>& walkers) override
82  {
83  for (MCPWalker& walker : walkers)
84  accumulate(walker, 1.0);
85  }
86 
87  /** add the local energy, variance and all the Hamiltonian components to the scalar record container
88  *@param record storage of scalar records (name,value)
89  */
90  void add2Record(RecordNamedProperty<RealType>& record) override;
91  void registerObservables(std::vector<ObservableHelper>& h5dec, hdf_archive& gid) override;
92  CSEnergyEstimator* clone() override;
93  const std::string& getSubTypeStr() const override { return input_.get_type(); }
94  void evaluateDiff();
95  // CSEnergyEstimator is the main estimator for
96  bool isMainEstimator() const override { return true; }
97 };
98 
99 } // namespace qmcplusplus
100 #endif
Matrix< RealType > tmp_data
temporary dat
CSEnergyEstimator * clone() override
clone the object
This file contains the input classes for the supported "main estimator" classes derived from ScalarEs...
const std::string & get_type() const
A set of walkers that are to be advanced by Metropolis Monte Carlo.
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
RealType getUmbrellaWeight(int ipsi)
Collection of Local Energy Operators.
class to handle hdf file
Definition: hdf_archive.h:51
void registerObservables(std::vector< ObservableHelper > &h5dec, hdf_archive &gid) override
add descriptors of observables to utilize hdf5
std::vector< std::string > h_components
name of hamiltonian components
std::vector< RealType > uweights
save umbrella weights
const char walkers[]
Definition: HDFVersion.h:36
bool isMainEstimator() const override
Is this estimator a main estimator i.e. the estimator required for a particular driver.
const std::string & getSubTypeStr() const override
String representation of the derived type of the ScalarEstimator.
void accumulate(const RefVector< MCPWalker > &walkers) override
a virtual function to accumulate observables or collectables
int FirstHamiltonian
index of the starting Hamiltonian component
const CSLocalEnergyInput input_
std::string getName() const override
void accumulate(const MCWalkerConfiguration &W, WalkerIterator first, WalkerIterator last, RealType wgt) override
std::vector< accumulator_type > scalars_saved
scalars saved
int NumCopies
number of correlated systems
std::vector< std::reference_wrapper< T > > RefVector
int LastHamiltonian
index of the ending Hamiltonian component
void accumulate(const Walker_t &awalker, RealType wgt)
MCWalkerConfiguration::const_iterator WalkerIterator
void add2Record(RecordNamedProperty< RealType > &record) override
add the local energy, variance and all the Hamiltonian components to the scalar record container ...
Abstract class for an estimator of a scalar operator.
A container class to represent a walker.
Definition: Walker.h:49
CSEnergyEstimator(const QMCHamiltonian &h, int hcopy=1)
constructor
MCWalkerConfiguration::Walker_t Walker_t