QMCPACK
MomentumDistribution.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) 2021 QMCPACK developers.
6 //
7 // File developed by: Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
8 // Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
9 //
10 // File refactored from: MomentumEstimator.h
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 #ifndef QMCPLUSPLUS_MOMENTUMDISTRIBUTION_H
14 #define QMCPLUSPLUS_MOMENTUMDISTRIBUTION_H
15 #include <vector>
16 
17 #include "Configuration.h"
18 #include "OperatorEstBase.h"
20 
22 
23 
24 namespace qmcplusplus
25 {
26 namespace testing
27 {
28 class MomentumDistributionTests;
29 }
30 /** Class that collects momentum distribution of electrons
31  *
32  */
34 {
35 public:
41 
42  //data members set only during construction
43  ///input values
45  ///twist angle
46  const PosType twist;
47  ///lattice vector
49  ///normalization factor for n(k)
51  ///list of k-points in Cartesian Coordinates
52  std::vector<PosType> kPoints;
53  ///weight of k-points (make use of symmetry)
54  std::vector<int> kWeights;
55 
56  /** @ingroup MomentumDistribution mutable data members
57  */
58  ///sample positions
59  std::vector<PosType> vPos;
60  ///wavefunction ratios
61  std::vector<ValueType> psi_ratios;
62  ///wavefunction ratios all samples
64  ///nofK internal
66  ///phases
68  ///phases of vPos
69  std::vector<VectorSoaContainer<RealType, 2>> phases_vPos;
70  ///nofK
72 
73 public:
74  /** Constructor for MomentumDistributionInput
75  */
77  size_t np,
78  const PosType& twist,
79  const LatticeType& lattice,
81 
82  /** Constructor used when spawing crowd clones
83  * needs to be public so std::make_unique can call it.
84  * Do not use directly unless you've really thought it through.
85  */
87 
88  /** This allows us to allocate the necessary data for the DataLocality::queue
89  */
90  void startBlock(int steps) override;
91 
92  /** standard interface
93  */
94  std::unique_ptr<OperatorEstBase> spawnCrowdClone() const override;
95 
96  /** accumulate 1 or more walkers of MomentumDistribution samples
97  */
99  const RefVector<ParticleSet>& psets,
100  const RefVector<TrialWaveFunction>& wfns,
101  const RefVector<QMCHamiltonian>& hams,
102  RandomBase<FullPrecRealType>& rng) override;
103 
104  /** this allows the EstimatorManagerNew to reduce without needing to know the details
105  * of MomentumDistribution's data.
106  *
107  * can use base class default until crowd level MomentumDistribution
108  * estimators don't have a copy of the density grid.
109  */
110  void collect(const RefVector<OperatorEstBase>& operator_estimators) override;
111 
112  /** this allows the EstimatorManagerNew to reduce without needing to know the details
113  * of MomentumDistribution's data.
114  *
115  * can use base class default until crowd level MomentumDistribution estimators don't have a copy of the density grid.
116  */
117  //void collect(const OperatorEstBase& oeb);
118 
119  /** this gets us into the hdf5 file
120  *
121  * Just parroting for now don't fully understand.
122  *, needs to be unraveled and simplified the hdf5 output is another
123  * big state big coupling design.
124  */
125  void registerOperatorEstimator(hdf_archive& file) override;
126 
127 private:
128  MomentumDistribution(const MomentumDistribution& md) = default;
129 
131 };
132 
133 } // namespace qmcplusplus
134 
135 #endif /* QMCPLUSPLUS_MOMENTUMDISTRIBUTION_H */
a class that defines a supercell in D-dimensional Euclean space.
std::vector< T, aligned_allocator< T > > aligned_vector
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
QTBase::RealType RealType
Definition: Configuration.h:58
std::unique_ptr< OperatorEstBase > spawnCrowdClone() const override
standard interface
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > ParticleLayout
Definition: Configuration.h:79
std::vector< ValueType > psi_ratios
wavefunction ratios
Vector< RealType > kdotp
nofK internal
Class that collects momentum distribution of electrons.
class to preserve access control in MomentumDistribution
void collect(const RefVector< OperatorEstBase > &operator_estimators) override
this allows the EstimatorManagerNew to reduce without needing to know the details of MomentumDistribu...
class to handle hdf file
Definition: hdf_archive.h:51
QTBase::ComplexType ComplexType
Definition: Configuration.h:59
const char walkers[]
Definition: HDFVersion.h:36
Matrix< ValueType > psi_ratios_all
wavefunction ratios all samples
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
void registerOperatorEstimator(hdf_archive &file) override
this allows the EstimatorManagerNew to reduce without needing to know the details of MomentumDistribu...
const RealType norm_nofK
normalization factor for n(k)
aligned_vector< RealType > nofK
nofK
QTBase::ValueType ValueType
Definition: Configuration.h:60
std::vector< int > kWeights
weight of k-points (make use of symmetry)
An abstract class for gridded estimators.
std::vector< VectorSoaContainer< RealType, 2 > > phases_vPos
phases of vPos
const LatticeType Lattice
lattice vector
QTBase::PosType PosType
Definition: Configuration.h:61
std::vector< std::reference_wrapper< T > > RefVector
std::vector< PosType > kPoints
list of k-points in Cartesian Coordinates
const MomentumDistributionInput input_
input values
VectorSoaContainer< RealType, 2 > phases
phases
DataLocality
data locality with respect to walker buffer
Definition: DataLocality.h:19
MomentumDistribution(MomentumDistributionInput &&mdi, size_t np, const PosType &twist, const LatticeType &lattice, DataLocality dl=DataLocality::crowd)
Constructor for MomentumDistributionInput.
void startBlock(int steps) override
This allows us to allocate the necessary data for the DataLocality::queue.
Native representation for Momentum Distribution Estimators inputs.
void accumulate(const RefVector< MCPWalker > &walkers, const RefVector< ParticleSet > &psets, const RefVector< TrialWaveFunction > &wfns, const RefVector< QMCHamiltonian > &hams, RandomBase< FullPrecRealType > &rng) override
accumulate 1 or more walkers of MomentumDistribution samples