QMCPACK
EnergyDensityEstimator.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) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
8 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
9 //
10 // File created by: Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 
14 #ifndef QMCPLUSPLUS_ENERGY_DENSITY_ESTIMATOR_H
15 #define QMCPLUSPLUS_ENERGY_DENSITY_ESTIMATOR_H
17 #include "OhmmsPETE/OhmmsMatrix.h"
20 #include <map>
21 #include <vector>
22 
23 namespace qmcplusplus
24 {
26 {
27 public:
29  using PSPool = std::map<std::string, const std::unique_ptr<ParticleSet>>;
30 
31  EnergyDensityEstimator(const PSPool& PSP, const std::string& defaultKE);
32  ~EnergyDensityEstimator() override;
33 
34  std::string getClassName() const override { return "EnergyDensityEstimator"; }
35  void resetTargetParticleSet(ParticleSet& P) override;
36  Return_t evaluate(ParticleSet& P) override;
38  void addObservables(PropertySetType& plist, BufferType& olist) override;
39  void registerCollectables(std::vector<ObservableHelper>& h5desc, hdf_archive& file) const override;
40  void setObservables(PropertySetType& plist) override;
41  void setParticlePropertyList(PropertySetType& plist, int offset) override;
42  bool put(xmlNodePtr cur) override;
43  bool put(xmlNodePtr cur, ParticleSet& P);
44  bool get(std::ostream& os) const override;
45  std::unique_ptr<OperatorBase> makeClone(ParticleSet& qp, TrialWaveFunction& psi) final;
46 
47  void write_description(std::ostream& os);
48 
49  void write_EDValues(void);
50  void write_nonzero_domains(const ParticleSet& P);
51  void write_Collectables(std::string& label, int& cnt, ParticleSet& P);
52 
53 private:
54  //original xml
55  xmlNodePtr input_xml;
56  //system information
57  std::string defKE;
58  const PSPool& psetpool;
61  ParticleSet* get_particleset(std::string& psname);
64  bool ion_points;
65  int nions;
68  //collection of points from which to build spacegrid origin and axes
70  //EnergyDenstity quantities
71  enum
72  {
73  W = 0,
74  T,
75  V,
77  };
80  //for EnergyDensity of particles falling outside any spacegrid
82  std::vector<bool> particles_outside;
83  //spacegrids are used to find which cell domain
84  // contains the Energy information of particles
85  std::vector<SpaceGrid*> spacegrids;
86  //particle positions
88  //number of samples accumulated
89  int nsamples;
90 
91  //needed (temporarily) for chempot
92  //ParticleSet should carry Zptcl so it doesn't have
93  // to be computed everywhere from species
94  std::vector<RealType> Zptcl;
96  void set_ptcl(void);
97  void unset_ptcl(void);
98 
103 
104  void getRequiredTraces(TraceManager& tm) override;
105 
106  void contributeScalarQuantities() override {}
108  void collectScalarQuantities() override {}
109  void deleteScalarQuantities() override {}
110 };
111 
112 
113 } // namespace qmcplusplus
114 #endif
std::string getClassName() const override
return class name
Return_t evaluate(ParticleSet &P) override
Evaluate the local energy contribution of this component.
void setObservables(PropertySetType &plist) override
Set the values evaluated by this object to plist Default implementation is to assign Value which is u...
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
bool put(xmlNodePtr cur) override
check xml elements
void checkoutScalarQuantities(TraceManager &tm) override
void setParticlePropertyList(PropertySetType &plist, int offset) override
Declaration of OperatorBase.
void registerCollectables(std::vector< ObservableHelper > &h5desc, hdf_archive &file) const override
class to handle hdf file
Definition: hdf_archive.h:51
TinyVector< RealType, DIM > Point
Vectorized record engine for scalar properties.
ParticleSet * get_particleset(std::string &psname)
void write_nonzero_domains(const ParticleSet &P)
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
void getRequiredTraces(TraceManager &tm) override
TODO: add docs.
ParticleSet::Buffer_t BufferType
typedef for the serialized buffer
Definition: OperatorBase.h:75
void addObservables(PropertySetType &plist)
void write_Collectables(std::string &label, int &cnt, ParticleSet &P)
void resetTargetParticleSet(ParticleSet &P) override
Reset the data with the target ParticleSet.
std::unique_ptr< OperatorBase > makeClone(ParticleSet &qp, TrialWaveFunction &psi) final
EnergyDensityEstimator(const PSPool &PSP, const std::string &defaultKE)
CombinedTraceSample< TraceReal > * Vs_trace
An abstract class for Local Energy operators.
Definition: OperatorBase.h:59
Particle traits to use UniformGridLayout for the ParticleLayout.
Definition: Configuration.h:77
Class to represent a many-body trial wave function.
std::map< std::string, const std::unique_ptr< ParticleSet > > PSPool
ParticleAttrib< SingleParticlePos > ParticlePos
Definition: Configuration.h:92
CombinedTraceSample< TraceReal > * Vd_trace
BareKineticEnergy::Return_t Return_t
RecordNamedProperty< FullPrecRealType > PropertySetType
define PropertyList_t
Definition: Configuration.h:69