QMCPACK
test_rng_control.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) 2017 Jeongnim Kim and 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 "catch.hpp"
14 
15 
16 //#include "Utilities/RandomGenerator.h"
17 #include "Message/Communicate.h"
18 #include "OhmmsData/Libxml2Doc.h"
19 #include "RandomNumberControl.h"
20 
21 
22 #include <stdio.h>
23 #include <string>
24 
25 
26 namespace qmcplusplus
27 {
28 TEST_CASE("RandomNumberControl make_seeds", "[ohmmsapp]")
29 {
31 
33 }
34 
35 TEST_CASE("RandomNumberControl no random in xml", "[ohmmsapp]")
36 {
37  const char* xml_input = R"(<tmp></tmp>)";
38 
40  bool okay = doc.parseFromString(xml_input);
41  REQUIRE(okay);
42 
44 
45  xmlXPathContextPtr context = doc.getXPathContext();
46  rnc.initialize(context);
47 }
48 
49 TEST_CASE("RandomNumberControl random in xml", "[ohmmsapp]")
50 {
51  Communicate* c;
53 
54  const char* xml_input = R"(<tmp><random seed="0"></random></tmp>)";
55 
57  bool okay = doc.parseFromString(xml_input);
58  REQUIRE(okay);
59 
61 
62  xmlXPathContextPtr context = doc.getXPathContext();
63  rnc.initialize(context);
64 
65 
66  rnc.write("rng_out", c);
67 
69  rnc2.read("rng_out", c);
70  // not sure what to test here - for now make sure it doesn't crash.
71 }
72 } // namespace qmcplusplus
static void read(const std::string &fname, Communicate *comm)
read in parallel or serial
class that handles xmlDoc
Definition: Libxml2Doc.h:76
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
TEST_CASE("complex_helper", "[type_traits]")
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
static void write(const std::string &fname, Communicate *comm)
write in parallel or serial
xmlNodePtr initialize(xmlXPathContextPtr)
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
class RandomNumberControl
static UPtrVector< RandomBase< FullPrecRealType > > Children
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
static void make_seeds()
reset the generator