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" 16 #include "Particle/WalkerSetRef.h" 17 #include "QMCHamiltonians/OperatorBase.h" 18 #include "ParticleBase/ParticleAttribOps.h" 19 #include "Particle/DistanceTableData.h" 20 21 namespace qmcplusplus 22 { 23 /** lattice deviation estimator 24 * 25 * 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 26 One can also create any reference point to measure the deviation of an up electron, for example 27 <particleset name="wf_center"> 28 <group name="origin" size="1"> 29 <attrib name="position" datatype="posArray" condition="0"> 30 0.00000000 0.00000000 0.00000000 31 </attrib> 32 </group> 33 </particleset> 34 <estimator type="latticedeviation" name="latdev" hdf5="yes" per_xyz="yes" 35 source="wf_center" sgroup="origin" target="e" tgroup="u"/> 36 This estimator outputs to both scalar.dat and stat.h5. The scalar.dat entries are averaged over all 37 particles, whereas the stat.h5 entries are particle-resolved. The two sets of outputs can be compared 38 as a consistency check for the estimator. 39 */ 40 class LatticeDeviationEstimator : public OperatorBase 41 { 42 public: 43 LatticeDeviationEstimator(ParticleSet& P, ParticleSet& sP, const std::string& tgroup, const std::string& sgroup); ~LatticeDeviationEstimator()44 ~LatticeDeviationEstimator() {} 45 46 bool put(xmlNodePtr cur); // read input xml node, required 47 bool get(std::ostream& os) const; // class description, required 48 49 Return_t evaluate(ParticleSet& P); // main function that calculates the observable 50 51 // allow multiple scalars to be registered in scalar.dat 52 void addObservables(PropertySetType& plist, BufferType& collectables); 53 void setObservables(PropertySetType& plist); 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<observable_helper*>& h5desc, hid_t gid) const; 58 //void addObservables(PropertySetType& plist, BufferType& collectables); // also used for multiple scalars 59 60 // pure virtual functions require overrider 61 void resetTargetParticleSet(ParticleSet& P); // required 62 OperatorBase* makeClone(ParticleSet& qp, TrialWaveFunction& psi); // 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 81