QMCPACK
EstimatorManagerCrowd.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: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
8 //
9 // File refactored from: EstimatorManagerBase.h
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 #ifndef QMCPLUSPLUS_ESTIMATORMANAGERCROWD_H
13 #define QMCPLUSPLUS_ESTIMATORMANAGERCROWD_H
14 
15 #include <bitset>
16 
17 #include "Configuration.h"
18 #include "Utilities/Timer.h"
19 #include "Pools/PooledData.h"
20 #include "Message/Communicate.h"
23 #include "Particle/Walker.h"
24 #include "OhmmsPETE/OhmmsVector.h"
25 
26 namespace qmcplusplus
27 {
28 class MCWalkerConifugration;
29 class QMCHamiltonian;
30 
31 /** Thread local estimator container/accumulator
32  *
33  * Stepping away from the CloneManger + clones design which creates EstimatorManagers
34  * Which operate differently based on internal switches.
35  *
36  * see EstimatorManagerNew.h for full description of the new design.
37  */
39 {
40 public:
44 
45  /** EstimatorManagerCrowd are always spawn of an EstimatorManagerNew
46  */
48 
49  ///destructor
51 
52  ///return the number of ScalarEstimators
53  inline int size() const { return scalar_estimators_.size(); }
54 
55  /** start a block
56  * @param steps number of steps in a block
57  */
58  void startBlock(int steps);
59 
60  void stopBlock();
61 
62  /** Accumulate over all scalar estimators and operator estimators over all walkers in crowd.
63  * Not all estimators make use of all these arguments
64  * \param[in] walkers walkers in crowd
65  * \param[in] psets walker particle sets
66  * \param[in] wfns walker wavefunctions
67  * \param[in] hams walker Hamiltonians
68  * \param[inout] rng crowd scope RandomGenerator
69  *
70  * walkers is especially questionable since its really just hiding the full sweep hamiltonian values from
71  * the most recent (maybe) QMCHamiltonian evaluate which are written into it by the QMCHamiltonians
72  * previous to the accumulate.
73  * walkers might additionally be useful because they hold another copy of the dynamic (electron) particle sets coords
74  * that could be inconsistent with psets.
75  *
76  * As soon as the legacy Estimators are dropped this API should be reviewed with an eye to disentangling
77  * ParticleSet, Walker, and QMCHamiltonian.
78  */
80  const RefVector<ParticleSet>& psets,
81  const RefVector<TrialWaveFunction>& wfns,
82  const RefVector<QMCHamiltonian>& hams,
84 
88 
91 
92  /** This registers the crowd lever estimators that require listeners into the QMCHamiltonianMultiWalkerResources
93  * We really only need a QMCHamiltonian leader but resource acquisition and release works better this way.
94  */
96 
97 private:
98  ///number of samples accumulated in a block
100  ///total weight accumulated in a block
102 
104  ///estimators of simple scalars
106 
108 };
109 
110 } // namespace qmcplusplus
111 
112 #endif
RefVector< ScalarEstimatorBase > get_scalar_estimators()
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
EstimatorManagerNew::RealType RealType
Class to manage a set of ScalarEstimators As a manager, this class handles the aggregation of data fr...
RefVector< qmcplusplus::OperatorEstBase > get_operator_estimators()
Timer class.
std::vector< std::unique_ptr< T > > UPtrVector
int size() const
return the number of ScalarEstimators
const char walkers[]
Definition: HDFVersion.h:36
static RefVector< T > convertUPtrToRefVector(const UPtrVector< T > &ptr_list)
convert a vector of std::unique_ptrs<T> to a refvector<T>
void startBlock(int steps)
start a block
Thread local estimator container/accumulator.
UPtrVector< ScalarEstimatorBase > scalar_estimators_
estimators of simple scalars
std::unique_ptr< T > UPtr
RealType block_num_samples_
number of samples accumulated in a block
RealType block_weight_
total weight accumulated in a block
std::vector< std::reference_wrapper< T > > RefVector
Declaraton of Vector<T,Alloc> Manage memory through Alloc directly and allow referencing an existing ...
UPtr< ScalarEstimatorBase > main_estimator_
ScalarEstimatorBase & get_main_estimator()
void registerListeners(const RefVectorWithLeader< QMCHamiltonian > &ham_list)
This registers the crowd lever estimators that require listeners into the QMCHamiltonianMultiWalkerRe...
QMCTraits::FullPrecRealType FullPrecRealType
Abstract class for an estimator of a scalar operator.
EstimatorManagerCrowd(EstimatorManagerNew &em)
EstimatorManagerCrowd are always spawn of an EstimatorManagerNew.
A container class to represent a walker.
Definition: Walker.h:49
QMCTraits::FullPrecRealType RealType
This is to deal with vague expression of precision in legacy code. Don&#39;t use in new code...
Define a serialized buffer to store anonymous data.
UPtrVector< OperatorEstBase > operator_ests_
void accumulate(const RefVector< MCPWalker > &walkers, const RefVector< ParticleSet > &psets, const RefVector< TrialWaveFunction > &wfns, const RefVector< QMCHamiltonian > &hams, RandomBase< FullPrecRealType > &rng)
Accumulate over all scalar estimators and operator estimators over all walkers in crowd...
EstimatorManagerNew::FullPrecRealType FullPrecRealType