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) 2020 QMCPACK developers. 6 // 7 // File developed by: Mark Dewing, mdewing@anl.gov, Argonne National Laboratory 8 // 9 // File created by: Mark Dewing, mdewing@anl.gov, Argonne National Laboratory 10 ////////////////////////////////////////////////////////////////////////////////////// 11 12 /** @file MCSample.h 13 * @brief Stores particle configurations for later use in DMC and wavefunction optimization 14 * 15 * Stores less temporary data than the buffer object. 16 */ 17 18 #ifndef QMCPLUSPLUS_MCSAMPLE_H 19 #define QMCPLUSPLUS_MCSAMPLE_H 20 21 #include "Particle/ParticleSet.h" 22 #include "Particle/Walker.h" 23 24 namespace qmcplusplus 25 { 26 /** store minimum Walker data 27 */ 28 struct MCSample 29 { 30 using WP = WalkerProperties::Indexes; 31 using Walker_t = ParticleSet::Walker_t; 32 33 ParticleSet::ParticlePos_t R; 34 ParticleSet::ParticleScalar_t spins; 35 ParticleSet::ParticleGradient_t G; 36 ParticleSet::ParticleLaplacian_t L; 37 ParticleSet::RealType LogPsi, Sign, PE, KE; 38 MCSampleMCSample39 inline MCSample(const ParticleSet& pset) : R(pset.R), spins(pset.spins) {} 40 41 /// deprecated. Beyond w.R and w.spins, others are used perhaps somewhere but intended not to. MCSampleMCSample42 inline MCSample(const Walker_t& w) : R(w.R), spins(w.spins), G(w.G), L(w.L) 43 { 44 LogPsi = w.Properties(WP::LOGPSI); 45 Sign = w.Properties(WP::SIGN); 46 PE = w.Properties(WP::LOCALPOTENTIAL); 47 KE = w.Properties(WP::LOCALENERGY) - PE; 48 } 49 MCSampleMCSample50 inline MCSample(int n) 51 { 52 R.resize(n); 53 spins.resize(n); 54 G.resize(n); 55 L.resize(n); 56 } 57 convertToWalkerMCSample58 inline void convertToWalker(Walker_t& w) const 59 { 60 w.R = R; 61 w.spins = spins; 62 w.G = G; 63 w.L = L; 64 w.Properties(WP::LOGPSI) = LogPsi; 65 w.Properties(WP::SIGN) = Sign; 66 w.Properties(WP::LOCALPOTENTIAL) = PE; 67 w.Properties(WP::LOCALENERGY) = PE + KE; 68 } 69 }; 70 71 } // namespace qmcplusplus 72 #endif 73