QMCPACK
SampleStack.cpp
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) 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 
13 #include "SampleStack.h"
15 
16 namespace qmcplusplus
17 {
18 
19 /** allocate the SampleStack
20  * @param n number of samples per rank
21  * @param num_ranks number of ranks. Used to set global number of samples.
22  */
24 {
25  max_samples_ = n;
28  sample_vector_.resize(n, MCSample(0));
29 }
30 
31 const MCSample& SampleStack::getSample(size_t i) const { return sample_vector_[i]; }
32 
34 {
35  // Ignore samples in excess of the expected number of samples
37  {
38  sample_vector_[current_sample_count_] = std::move(sample);
40  }
41 }
42 
43 /** load a single sample from SampleStack
44  */
45 void SampleStack::loadSample(ParticleSet& pset, size_t iw) const
46 {
47  pset.R = sample_vector_[iw].R;
48  pset.spins = sample_vector_[iw].spins;
49 }
50 
52 {
53  sample_vector_.clear();
55 }
56 
58 
59 
60 } // namespace qmcplusplus
Stores particle configurations for later use in DMC and wavefunction optimization.
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
void resetSampleCount()
Set the sample count to zero but preserve the storage.
Definition: SampleStack.cpp:57
std::vector< MCSample > sample_vector_
Definition: SampleStack.h:62
T min(T a, T b)
void clearEnsemble()
clear the ensemble
Definition: SampleStack.cpp:51
store minimum Walker data
Definition: MCSample.h:28
void loadSample(ParticleSet &pset, size_t iw) const
load a single sample from SampleStack
Definition: SampleStack.cpp:45
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
const MCSample & getSample(size_t i) const
Definition: SampleStack.cpp:31
void setMaxSamples(size_t n, size_t number_of_ranks=1)
set the number of max samples per rank.
Definition: SampleStack.cpp:23
void appendSample(MCSample &&sample)
Definition: SampleStack.cpp:33