QMCPACK
test_SFNBranch.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: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
8 //
9 // File created by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 #include <catch.hpp>
13 
14 #include "Message/Communicate.h"
15 
17 #include "Particle/Walker.h"
19 #include "ParticleSetPool.h"
20 #include "WaveFunctionPool.h"
21 #include "HamiltonianPool.h"
22 #include "QMCDrivers/SFNBranch.h"
26 
27 namespace qmcplusplus
28 {
29 using MCPWalker = Walker<QMCTraits, PtclOnLatticeTraits>;
30 using RealType = double;
31 
32 namespace testing
33 {
35 {
36 public:
38 
40 
42  {
43  pop_ = std::make_unique<MCPopulation>(1, comm_->rank(), &pset, &twf, &ham);
44  // MCPopulation owns it walkers it cannot just take refs so we just create and then update its walkers.
45  pop_->createWalkers(2, walker_confs_);
46 
48 
49  walkers[0].get().R[0] = 1.0;
50  walkers[1].get().R[0] = 0.5;
51 
52  auto sfnb = std::make_unique<SFNBranch>(tau_, 1.0, DMCRefEnergyScheme::LIMITED_HISTORY);
53 
55 
56  sfnb->initParam(*pop_, 0, 0, false, false);
57 
58  return sfnb;
59  }
60 
61 private:
62  void createMyNode(SFNBranch& sfnb, const char* xml)
63  {
64  doc_ = std::make_unique<Libxml2Document>();
65  doc_->parseFromString(xml);
66  sfnb.put(doc_->getRoot());
67  }
68 
74 
75  RealType tau_ = 1.0;
77 };
78 
79 } // namespace testing
80 
81 TEST_CASE("SFNBranch::branch(MCPopulation...)", "[drivers]")
82 {
83  using namespace testing;
86  std::unique_ptr<SFNBranch> sfnb =
87  setup_sfnb(*pools.particle_pool->getParticleSet("e"), *pools.wavefunction_pool->getPrimary(),
88  *pools.hamiltonian_pool->getPrimary());
89 }
90 
91 
92 } // namespace qmcplusplus
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
int rank() const
return the rank
Definition: Communicate.h:116
Manages the state of QMC sections and handles population control for DMCs.
Definition: SFNBranch.h:63
UPtr< ParticleSetPool > particle_pool
Definition: SetupPools.h:33
A set of light weight walkers that are carried between driver sections and restart.
TEST_CASE("complex_helper", "[type_traits]")
Collection of Local Energy Operators.
UPtr< HamiltonianPool > hamiltonian_pool
Definition: SetupPools.h:35
const char walkers[]
Definition: HDFVersion.h:36
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
static RefVector< T > convertUPtrToRefVector(const UPtrVector< T > &ptr_list)
convert a vector of std::unique_ptrs<T> to a refvector<T>
Wrapping information on parallelism.
Definition: Communicate.h:68
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
UPtr< WaveFunctionPool > wavefunction_pool
Definition: SetupPools.h:34
Declaration of WaveFunctionPool.
SetupPools pools
UPtr< EstimatorManagerNew > emb_
std::unique_ptr< T > UPtr
std::unique_ptr< SFNBranch > sfnb
void createMyNode(SFNBranch &sfnb, const char *xml)
std::vector< std::reference_wrapper< T > > RefVector
QMCTraits::RealType RealType
constexpr int valid_dmc_input_dmc_batch_index
Declaration of HamiltonianPool.
Class to represent a many-body trial wave function.
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker
Definition: test_walker.cpp:31
constexpr std::array< const char *, 3 > valid_dmc_input_sections
avoids many repeated xml heredoc sections
SetupSimpleFixedNodeBranch setup_sfnb
Declaration of ParticleSetPool.
std::unique_ptr< SFNBranch > operator()(ParticleSet &pset, TrialWaveFunction &twf, QMCHamiltonian &ham)