QMCPACK
test_SimpleFixedNodeBranch.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) 2019 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 
18 #include "Particle/Walker.h"
23 #include "QMCDrivers/Crowd.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  {
39  comm_ = comm;
40  emb_ = std::make_unique<EstimatorManagerBase>(comm_);
41  emb_->add(std::make_unique<FakeEstimator>(), "fake");
42  }
43 
45  {
47  emb_ = std::make_unique<EstimatorManagerBase>(comm_);
48  emb_->add(std::make_unique<FakeEstimator>(), "fake");
49  }
50 
52  {
53  const SimulationCell simulation_cell;
54  mcwc_ = std::make_unique<MCWalkerConfiguration>(simulation_cell);
55  mcwc_->setName("electrons");
56 
57  mcwc_->create({1});
58  mcwc_->R[0][0] = 0.0;
59  mcwc_->R[0][1] = 1.0;
60  mcwc_->R[0][2] = 2.0;
61 
62  MCPWalker w1(1);
63  w1.R[0] = 1.0;
64  MCPWalker w2(1);
65  w2.R[0] = 0.5;
66 
67  mcwc_->createWalkers(2);
68  (*mcwc_)[0]->R = w1.R;
69  (*mcwc_)[1]->R = w2.R;
70 
72 
73  sfnb.setEstimatorManager(std::move(emb_));
74 
76 
77  // WalkerController is created as a side effect.
78  sfnb.initWalkerController(*mcwc_, false, false);
79 
80  sfnb.checkParameters(*mcwc_);
81 
82  sfnb.branch(0, *mcwc_);
83 
84  return sfnb;
85  }
86 
87 
88 private:
89 
90  void createMyNode(SimpleFixedNodeBranch& sfnb, const char* xml)
91  {
92  doc_ = std::make_unique<Libxml2Document>();
93  doc_->parseFromString(xml);
94  sfnb.myNode = doc_->getRoot();
95  }
96 
101 
102  RealType tau_ = 1.0;
104 
105  //Legacy
107 };
108 
109 }
110 
111 TEST_CASE("SimpleFixedNodeBranch::branch(MCWC...)", "[drivers][legacy]")
112 {
113  using namespace testing;
116 
117  // \todo: check walker ID's here. might need more walkers to make this significant.
118 
119 }
120 
121 } // namespace qmcplusplus
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
TEST_CASE("complex_helper", "[type_traits]")
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
constexpr int valid_dmc_input_dmc_index
Wrapping information on parallelism.
Definition: Communicate.h:68
Manages the state of QMC sections and handles population control for DMCs.
void createMyNode(SimpleFixedNodeBranch &sfnb, const char *xml)
std::unique_ptr< T > UPtr
Manager class of scalar estimators.
std::unique_ptr< SFNBranch > sfnb
QMCTraits::RealType RealType
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker
Definition: test_walker.cpp:31
constexpr std::array< const char *, 3 > valid_dmc_input_sections
declare a handler of DMC branching
Declaration of a MCWalkerConfiguration.
A container class to represent a walker.
Definition: Walker.h:49
avoids many repeated xml heredoc sections
SetupSimpleFixedNodeBranch setup_sfnb
ParticlePos R
The configuration vector (3N-dimensional vector to store the positions of all the particles for a sin...
Definition: Walker.h:114