QMCPACK
LatticeDeviationEstimator.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: Yubo Yang, paul.young.0414@gmail.com, University of Illinois at Urbana-Champaign
8 //
9 // File created by: Yubo Yang, paul.young.0414@gmail.com, University of Illinois at Urbana-Champaign
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 #ifndef QMCPLUSPLUS_LATTICEDEVIATION_H
13 #define QMCPLUSPLUS_LATTICEDEVIATION_H
14 
15 #include "Particle/ParticleSet.h"
18 #include "Particle/DistanceTable.h"
19 
20 namespace qmcplusplus
21 {
22 /** lattice deviation estimator
23  *
24  * Compute deviation of species="tgroup" in target particle set from species="sgroup" in source particle set. The motivation is to observe the deviation of protons from their crystal sites in an all electron-proton simulation of hydrogen i.e. two-component system
25  One can also create any reference point to measure the deviation of an up electron, for example
26  <particleset name="wf_center">
27  <group name="origin" size="1">
28  <attrib name="position" datatype="posArray" condition="0">
29  0.00000000 0.00000000 0.00000000
30  </attrib>
31  </group>
32  </particleset>
33  <estimator type="latticedeviation" name="latdev" hdf5="yes" per_xyz="yes"
34  source="wf_center" sgroup="origin" target="e" tgroup="u"/>
35  This estimator outputs to both scalar.dat and stat.h5. The scalar.dat entries are averaged over all
36 particles, whereas the stat.h5 entries are particle-resolved. The two sets of outputs can be compared
37 as a consistency check for the estimator.
38  */
40 {
41 public:
42  LatticeDeviationEstimator(ParticleSet& P, ParticleSet& sP, const std::string& tgroup, const std::string& sgroup);
44 
45  std::string getClassName() const override { return "LatticeDeviationEstimator"; }
46  bool put(xmlNodePtr cur) override; // read input xml node, required
47  bool get(std::ostream& os) const override; // class description, required
48 
49  Return_t evaluate(ParticleSet& P) override; // main function that calculates the observable
50 
51  // allow multiple scalars to be registered in scalar.dat
52  void addObservables(PropertySetType& plist, BufferType& collectables) override;
53  void setObservables(PropertySetType& plist) override;
54  //void setParticlePropertyList(PropertySetType& plist, int offset); // is this method ever used?
55 
56  // make room in hdf5 observable registry
57  void registerCollectables(std::vector<ObservableHelper>& h5desc, hdf_archive& file) const override;
58  //void addObservables(PropertySetType& plist, BufferType& collectables); // also used for multiple scalars
59 
60  // pure virtual functions require overrider
61  void resetTargetParticleSet(ParticleSet& P) override; // required
62  std::unique_ptr<OperatorBase> makeClone(ParticleSet& qp, TrialWaveFunction& psi) final; // required
63 
64 private:
65  SpeciesSet& tspecies; // species table of target particle set
66  SpeciesSet& sspecies; // species table of source particle set
67  ParticleSet &tpset, spset; // save references to source and target particle sets
68  std::string tgroup, sgroup; // name of species to track
69  int num_sites; // number of lattice sites (i.e. number of source particles)
70  bool hdf5_out; // use .h5 file for data (follow SkEstimator)
71  int h5_index; // track the starting memory location in P.Collectables
72  bool per_xyz; // track deviation in each of x,y,z directions
73  std::vector<RealType> xyz2; // temporary storage for deviation in each of x,y,z directions
74  xmlNodePtr input_xml; // original xml
75  // distance table ID
76  const int myTableID_;
77 }; // LatticeDeviationEstimator
78 
79 } // namespace qmcplusplus
80 #endif
LatticeDeviationEstimator(ParticleSet &P, ParticleSet &sP, const std::string &tgroup, const std::string &sgroup)
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
Declaration of OperatorBase.
class to handle hdf file
Definition: hdf_archive.h:51
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
ParticleSet::Buffer_t BufferType
typedef for the serialized buffer
Definition: OperatorBase.h:75
void setObservables(PropertySetType &plist) override
Set the values evaluated by this object to plist Default implementation is to assign Value which is u...
std::unique_ptr< OperatorBase > makeClone(ParticleSet &qp, TrialWaveFunction &psi) final
An abstract class for Local Energy operators.
Definition: OperatorBase.h:59
void registerCollectables(std::vector< ObservableHelper > &h5desc, hdf_archive &file) const override
bool put(xmlNodePtr cur) override
Read the input parameter.
Class to represent a many-body trial wave function.
std::string getClassName() const override
return class name
Declaraton of ParticleAttrib<T>
Return_t evaluate(ParticleSet &P) override
Evaluate the local energy contribution of this component.
Custom container for set of attributes for a set of species.
Definition: SpeciesSet.h:33
BareKineticEnergy::Return_t Return_t
void addObservables(PropertySetType &plist, BufferType &collectables) override
named values to the property list Default implementaton uses addValue(plist_)
void resetTargetParticleSet(ParticleSet &P) override
Reset the data with the target ParticleSet.
RecordNamedProperty< FullPrecRealType > PropertySetType
define PropertyList_t
Definition: Configuration.h:69