QMCPACK
CollectablesEstimator.cpp
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) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
8 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
9 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
10 //
11 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
12 //////////////////////////////////////////////////////////////////////////////////////
13 
14 
15 #include "CollectablesEstimator.h"
17 
18 namespace qmcplusplus
19 {
21 {
22  scalars.resize(h.sizeOfCollectables());
24 }
25 
26 void CollectablesEstimator::registerObservables(std::vector<ObservableHelper>& h5desc, hdf_archive& file)
27 {
28  int loc = h5desc.size();
29  refH.registerCollectables(h5desc, file);
30  for (int i = loc; i < h5desc.size(); ++i)
31  h5desc[i].lower_bound += FirstIndex;
32 }
33 
35 
36 /** add the local energy, variance and all the Hamiltonian components to the scalar record container
37  * @param record storage of scalar records (name,value)
38  *
39  * Do not add Collectables to record
40  */
42 {
43  FirstIndex = record.size();
44  LastIndex = FirstIndex + scalars.size();
45  //FirstIndex = record.size();
46  //for(int i=0; i<refH.sizeOfCollectables(); ++i)
47  //{
48  // std::ostringstream o;
49  // o<<"a"<<i;
50  // int dummy=record.add(o.str());
51  //}
52  //LastIndex = record.size();
53  clear();
54 }
55 
56 //void CollectablesEstimator::accumulate(const MCWalkerConfiguration& W
57 // , WalkerIterator first, WalkerIterator last , RealType wgt)
58 //{
59 // for(int i=0; i<refH.sizeOfCollectables(); ++i)
60 // scalars[i](W.Collectables[i],wgt);
61 //}
62 } // namespace qmcplusplus
void registerCollectables(std::vector< ObservableHelper > &h5desc, hdf_archive &file) const
register collectables so that their averages can be dumped to hdf5
int sizeOfCollectables() const
return the size of collectables
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
Collection of Local Energy Operators.
class to handle hdf file
Definition: hdf_archive.h:51
CollectablesEstimator * clone() override
implement virtual function
int FirstIndex
first index within an record of the first element handled by an object
std::vector< accumulator_type > scalars
scalars to be measured
TinyVector< T, 3 > lower_bound(const TinyVector< T, 3 > &a, const TinyVector< T, 3 > &b)
helper function to determine the lower bound of a domain (need to move up)
void add2Record(RecordListType &record) override
add the local energy, variance and all the Hamiltonian components to the scalar record container ...
Declaration of ObservableHelper and other helper class for observables.
Handle an ensemble average of Hamiltonian components.
std::vector< accumulator_type > scalars_saved
scalars saved
void clear()
clear the scalars to collect
void registerObservables(std::vector< ObservableHelper > &h5dec, hdf_archive &file) override
add descriptors of observables to utilize hdf5
int LastIndex
last index within an record of the first element handled by an object
const QMCHamiltonian & refH
save the reference hamiltonian
CollectablesEstimator(QMCHamiltonian &h)
constructor