QMCPACK
GenerateRandomParticleSets.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) 2024 QMCPACK developers.
6 //
7 // File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Lab
8 //
9 // File created by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Lab
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 /** \file
13  * Several ParticleSet functions use the global Random so we have to avoid the normal
14  * sequence of particleset state transforms and set particle positions explicitly.
15  * This function does that as well as facilitates writing out a set of positions for test reproducibility.
16  */
17 
20 
21 namespace qmcplusplus
22 {
23 namespace testing
24 {
25 template<bool GEN_TEST_DATA>
27  ParticleSet& pset_source,
28  std::vector<ParticleSet::ParticlePos>& deterministic_rs,
29  int num_psets)
30 {
31  int nwalkers = num_psets;
32  std::vector<ParticleSet> psets(num_psets, pset_target);
33  if constexpr (GEN_TEST_DATA)
34  {
35  std::cout << "Initialize OneBodyDensityMatrices::accumulate psets with:\n{";
36  std::vector<ParticleSet> psets;
37  for (int iw = 0; iw < nwalkers; ++iw)
38  {
39  //psets.emplace_back(pset_target);
40  psets.back().randomizeFromSource(pset_source);
41  std::cout << "{";
42  for (auto r : psets.back().R)
43  std::cout << NativePrint(r) << ",";
44  std::cout << "},\n";
45  }
46  std::cout << "}\n";
47  }
48  else
49  {
50  for (int iw = 0; iw < nwalkers; ++iw)
51  psets[iw].R = deterministic_rs[iw];
52  }
53  return psets;
54 }
55 
56 template
58  ParticleSet& pset_source,
59  std::vector<ParticleSet::ParticlePos>& deterministic_rs,
60  int num_psets);
61 
62 template
64  ParticleSet& pset_source,
65  std::vector<ParticleSet::ParticlePos>& deterministic_rs,
66  int num_psets);
67 
68 
69 } // namespace testing
70 } // namespace qmcplusplus
The operator<< functions provide output for data structures that can be used to directly initialize t...
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
Some ParticleSet functions use the global Random so we need some helper functions to avoid interminan...
This wrapper is to allow us to leave the user facing operator<< for classes alone.
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
std::vector< ParticleSet > generateRandomParticleSets(ParticleSet &pset_target, ParticleSet &pset_source, std::vector< ParticleSet::ParticlePos > &deterministic_rs, int num_psets)
This function sets particle set positions from a set of Rs or writes out a set of positions for test ...
template std::vector< ParticleSet > generateRandomParticleSets< false >(ParticleSet &pset_target, ParticleSet &pset_source, std::vector< ParticleSet::ParticlePos > &deterministic_rs, int num_psets)
template std::vector< ParticleSet > generateRandomParticleSets< true >(ParticleSet &pset_target, ParticleSet &pset_source, std::vector< ParticleSet::ParticlePos > &deterministic_rs, int num_psets)