QMCPACK
test_NESpaceGrid.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) 2023 QMCPACK developers.
6 //
7 // File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Lab
8 //////////////////////////////////////////////////////////////////////////////////////
9 
10 #include "catch.hpp"
11 
12 #include "NESpaceGrid.h"
13 #include "SpaceGridInput.h"
14 #include "NEReferencePoints.h"
15 #include "ReferencePointsInput.h"
17 #include "ValidSpaceGridInput.h"
18 #include "OhmmsData/Libxml2Doc.h"
19 #include "EstimatorTesting.h"
22 /** \file
23  * This is a postfacto unit testing written for NESpaceGrid during porting of EnergyDensity
24  * to the batched version of the estimators.
25  */
26 
27 namespace qmcplusplus
28 {
29 
30 namespace testing
31 {
32 template<typename REAL>
33 class NESpaceGridTests
34 {
35 public:
36  static const auto& getData(const NESpaceGrid<REAL>& nesg) { return nesg.data_; }
37  static int getBufferStart(const NESpaceGrid<REAL>& nesg) { return nesg.buffer_start_; }
38  static int getBufferEnd(const NESpaceGrid<REAL>& nesg) { return nesg.buffer_end_; }
39  static auto* getOdu(const NESpaceGrid<REAL>& nesg) { return nesg.odu_; }
40 };
41 
42 template<ValidSpaceGridInput::valid VALID>
44 {
45 public:
48  : particle_pool_(MinimalParticlePool::make_diamondC_1x1x1(comm)),
49  pset_elec_(*(particle_pool_.getParticleSet("e"))),
50  pset_ions_(*(particle_pool_.getParticleSet("ion")))
51  {
52  // Setup particleset
53  // particle positions must be inside the unit cell
54  pset_elec_.R =
55  ParticleSet::ParticlePos{{1.451870349, 1.381521229, 1.165202269}, {1.244515371, 1.382273176, 1.21105285},
56  {0.000459944, 1.329603408, 1.265030556}, {0.748660329, 1.63420622, 1.393637791},
57  {0.033228526, 1.391869137, 0.654413566}, {1.114198787, 1.654334594, 0.231075822},
58  {1.657151589, 0.883870516, 1.201243939}, {0.97317591, 1.245644974, 0.284564732}};
59 
61  bool okay = doc.parseFromString(Input::xml[VALID]);
62  xmlNodePtr node = doc.getRoot();
63  sgi_ = std::make_unique<SpaceGridInput>(node);
64 
65  using RPInput = ValidReferencePointsInputs;
66  Libxml2Document doc2;
67  bool okay2 = doc.parseFromString(RPInput::xml[RPInput::CELL]);
68  xmlNodePtr node2 = doc.getRoot();
69  rpi_ = std::make_unique<ReferencePointsInput>(node2);
70  ref_psets_.push_back(pset_ions_);
71  ref_points_ = std::make_unique<NEReferencePoints>(*rpi_, pset_elec_, ref_psets_);
72  }
80 };
81 
82 template<>
83 class SpaceGridEnv<ValidSpaceGridInput::valid::CYLINDRICAL>
84 {
85 public:
89  pset_elec_(*(particle_pool_.getParticleSet("e"))),
90  pset_ions_(*(particle_pool_.getParticleSet("ion")))
91  {
93  bool okay = doc.parseFromString(Input::xml[ValidSpaceGridInput::valid::CYLINDRICAL]);
94  xmlNodePtr node = doc.getRoot();
95  sgi_ = std::make_unique<SpaceGridInput>(node);
96 
97  using RPInput = ValidReferencePointsInputs;
98  Libxml2Document doc2;
99  bool okay2 = doc.parseFromString(RPInput::xml[RPInput::CELL]);
100  xmlNodePtr node2 = doc.getRoot();
101  rpi_ = std::make_unique<ReferencePointsInput>(node2);
102  ref_psets_.push_back(pset_ions_);
103  ref_points_ = std::make_unique<NEReferencePoints>(*rpi_, pset_elec_, ref_psets_);
104  }
112 };
113 
114 } // namespace testing
115 
116 constexpr bool generate_test_data = false;
117 using Real = double;
118 
119 TEST_CASE("SpaceGrid::Construction", "[estimators]")
120 {
122  Communicate* comm;
124 
126 
127  // EnergyDensityEstimator gets this from an enum giving indexes into each offset of SOA buffer.
128  // It is a smell.
129  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), 1, false);
130 
132  auto buffer_start = NES::getBufferStart(space_grid);
133  auto buffer_end = NES::getBufferEnd(space_grid);
134  space_grid.write_description(std::cout, std::string(""));
135  auto& sgi = *(sge.sgi_);
136  auto& agr = sgi.get_axis_grids();
137  for (int id = 0; id < OHMMS_DIM; ++id)
138  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
139 
140  // CHECK(buffer_start == 0);
141  // CHECK(buffer_end == 7999);
142 }
143 
144 TEST_CASE("SpaceGrid::CYLINDRICAL", "[estimators]")
145 {
147  Communicate* comm;
149 
151 
152  // EnergyDensityEstimator gets this from an enum giving indexes into each offset of SOA buffer.
153  // It is a smell.
154  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), 1, false);
155 
157  auto buffer_start = NES::getBufferStart(space_grid);
158  auto buffer_end = NES::getBufferEnd(space_grid);
159  space_grid.write_description(std::cout, std::string(""));
160  auto& sgi = *(sge.sgi_);
161  auto& agr = sgi.get_axis_grids();
162  for (int id = 0; id < OHMMS_DIM; ++id)
163  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
164 }
165 
166 TEST_CASE("SpaceGrid::SPHERICAL", "[estimators]")
167 {
169  Communicate* comm;
171 
173 
174  // EnergyDensityEstimator gets this from an enum giving indexes into each offset of SOA buffer.
175  // It is a smell.
176  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), 1, false);
177 
179  auto buffer_start = NES::getBufferStart(space_grid);
180  auto buffer_end = NES::getBufferEnd(space_grid);
181  space_grid.write_description(std::cout, std::string(""));
182  auto& sgi = *(sge.sgi_);
183  auto& agr = sgi.get_axis_grids();
184  for (int id = 0; id < OHMMS_DIM; ++id)
185  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
186 }
187 
188 TEST_CASE("SpaceGrid::Basic", "[estimators]")
189 {
191  Communicate* comm;
194  int num_values = 3;
195  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), num_values, true);
197  auto buffer_start = NES::getBufferStart(space_grid);
198  auto buffer_end = NES::getBufferEnd(space_grid);
199  space_grid.write_description(std::cout, std::string(""));
200  auto& sgi = *(sge.sgi_);
201  auto& agr = sgi.get_axis_grids();
202  for (int id = 0; id < OHMMS_DIM; ++id)
203  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
204  //CHECK(buffer_start == 0);
205  //CHECK(buffer_end == 23999);
206 
207  CHECK(space_grid.nDomains() == 8000);
208 
209  CHECK(space_grid.getDataVector().size() == 24000);
210 
211  Matrix<Real> values;
212  values.resize(sge.pset_elec_.getTotalNum(), num_values);
213 
214  for (int ip = 0; ip < sge.pset_elec_.getTotalNum(); ++ip)
215  for (int iv = 0; iv < num_values; ++iv)
216  values(ip, iv) = ip + 0.1 * iv;
217 
218  const int ei_tid = sge.pset_elec_.addTable(sge.pset_ions_);
219  sge.pset_elec_.update();
220  sge.pset_ions_.update();
221 
222  std::vector<bool> p_outside(8, false);
223  space_grid.accumulate(sge.pset_elec_.R, values, p_outside, sge.pset_elec_.getDistTableAB(ei_tid));
224 
225  // check that what's in data_pool is what is expected.
226  const auto& grid_data = NES::getData(space_grid);
227 
228  auto tensorAccessor = [](const auto& grid_data, int i, int j, int k, int iv) {
229  return grid_data[1200 * i + 60 * j + 3 * k + iv];
230  };
231 
232  CHECK(tensorAccessor(grid_data, 10, 17, 9, 0) == Approx(2.0));
233  CHECK(tensorAccessor(grid_data, 10, 17, 9, 1) == Approx(2.1));
234  CHECK(tensorAccessor(grid_data, 10, 17, 9, 2) == Approx(2.2));
235  CHECK(tensorAccessor(grid_data, 12, 15, 7, 0) == Approx(4.0));
236  CHECK(tensorAccessor(grid_data, 12, 15, 7, 1) == Approx(4.1));
237  CHECK(tensorAccessor(grid_data, 12, 15, 7, 2) == Approx(4.2));
238  CHECK(tensorAccessor(grid_data, 12, 16, 11, 0) == Approx(3.0));
239  CHECK(tensorAccessor(grid_data, 12, 16, 11, 1) == Approx(3.1));
240  CHECK(tensorAccessor(grid_data, 12, 16, 11, 2) == Approx(3.2));
241  CHECK(tensorAccessor(grid_data, 13, 11, 15, 0) == Approx(6.0));
242  CHECK(tensorAccessor(grid_data, 13, 11, 15, 1) == Approx(6.1));
243  CHECK(tensorAccessor(grid_data, 13, 11, 15, 2) == Approx(6.2));
244  CHECK(tensorAccessor(grid_data, 14, 13, 13, 0) == Approx(1.0));
245  CHECK(tensorAccessor(grid_data, 14, 13, 13, 1) == Approx(1.2));
246  CHECK(tensorAccessor(grid_data, 14, 13, 13, 2) == Approx(1.4));
247  CHECK(tensorAccessor(grid_data, 15, 11, 10, 0) == Approx(7.0));
248  CHECK(tensorAccessor(grid_data, 15, 11, 10, 1) == Approx(7.1));
249  CHECK(tensorAccessor(grid_data, 15, 11, 10, 2) == Approx(7.2));
250  CHECK(tensorAccessor(grid_data, 17, 12, 9, 0) == Approx(5.0));
251  CHECK(tensorAccessor(grid_data, 17, 12, 9, 1) == Approx(5.1));
252  CHECK(tensorAccessor(grid_data, 17, 12, 9, 2) == Approx(5.2));
253  // new pset R's
254  // check again
255  auto min_R =
256  ParticleSet::ParticlePos{{-0.6759092808, 0.835668385, 1.985307097}, {0.09710352868, -0.76751858, -1.89306891},
257  {-0.5605484247, -0.9578875303, 1.476860642}, {2.585144997, 1.862680197, 3.282609463},
258  {-0.1961335093, 1.111888766, -0.578481257}, {1.794641614, 1.6000278, -0.9474347234},
259  {2.157717228, 0.9254754186, 2.263158321}, {1.883366346, 2.136350632, 3.188981533}};
260  sge.pset_elec_.applyMinimumImage(min_R);
261  sge.pset_elec_.R = min_R;
262 
263  sge.pset_elec_.update();
264 
265  std::vector<bool> p_outside_2(8, false);
266  space_grid.accumulate(sge.pset_elec_.R, values, p_outside_2, sge.pset_elec_.getDistTableAB(ei_tid));
267 
268  CHECK(tensorAccessor(grid_data, 1, 13, 15, 0) == Approx(2.0));
269  CHECK(tensorAccessor(grid_data, 1, 13, 15, 1) == Approx(2.1));
270  CHECK(tensorAccessor(grid_data, 1, 13, 15, 2) == Approx(2.2));
271  CHECK(tensorAccessor(grid_data, 2, 6, 7, 0) == Approx(5.0));
272  CHECK(tensorAccessor(grid_data, 2, 6, 7, 1) == Approx(5.1));
273  CHECK(tensorAccessor(grid_data, 2, 6, 7, 2) == Approx(5.2));
274  CHECK(tensorAccessor(grid_data, 4, 0, 11, 1) == Approx(0.1));
275  CHECK(tensorAccessor(grid_data, 4, 0, 11, 2) == Approx(0.2));
276  CHECK(tensorAccessor(grid_data, 10, 17, 9, 0) == Approx(2.0));
277  CHECK(tensorAccessor(grid_data, 10, 17, 9, 1) == Approx(2.1));
278  CHECK(tensorAccessor(grid_data, 10, 17, 9, 2) == Approx(2.2));
279  CHECK(tensorAccessor(grid_data, 12, 0, 18, 0) == Approx(7.0));
280  CHECK(tensorAccessor(grid_data, 12, 0, 18, 1) == Approx(7.1));
281  CHECK(tensorAccessor(grid_data, 12, 0, 18, 2) == Approx(7.2));
282  CHECK(tensorAccessor(grid_data, 12, 13, 0, 0) == Approx(6.0));
283  CHECK(tensorAccessor(grid_data, 12, 13, 0, 1) == Approx(6.1));
284  CHECK(tensorAccessor(grid_data, 12, 13, 0, 2) == Approx(6.2));
285  CHECK(tensorAccessor(grid_data, 12, 15, 7, 0) == Approx(4.0));
286  CHECK(tensorAccessor(grid_data, 12, 15, 7, 1) == Approx(4.1));
287  CHECK(tensorAccessor(grid_data, 12, 15, 7, 2) == Approx(4.2));
288  CHECK(tensorAccessor(grid_data, 12, 16, 11, 0) == Approx(3.0));
289  CHECK(tensorAccessor(grid_data, 12, 16, 11, 1) == Approx(3.1));
290  CHECK(tensorAccessor(grid_data, 12, 16, 11, 2) == Approx(3.2));
291  CHECK(tensorAccessor(grid_data, 13, 1, 6, 0) == Approx(1.0));
292  CHECK(tensorAccessor(grid_data, 13, 1, 6, 1) == Approx(1.1));
293  CHECK(tensorAccessor(grid_data, 13, 1, 6, 2) == Approx(1.2));
294  CHECK(tensorAccessor(grid_data, 13, 11, 15, 0) == Approx(6.0));
295  CHECK(tensorAccessor(grid_data, 13, 11, 15, 1) == Approx(6.1));
296  CHECK(tensorAccessor(grid_data, 13, 11, 15, 2) == Approx(6.2));
297  CHECK(tensorAccessor(grid_data, 13, 17, 1, 0) == Approx(3.0));
298  CHECK(tensorAccessor(grid_data, 13, 17, 1, 1) == Approx(3.1));
299  CHECK(tensorAccessor(grid_data, 13, 17, 1, 2) == Approx(3.2));
300  CHECK(tensorAccessor(grid_data, 14, 12, 4, 0) == Approx(4.0));
301  CHECK(tensorAccessor(grid_data, 14, 12, 4, 1) == Approx(4.1));
302  CHECK(tensorAccessor(grid_data, 14, 12, 4, 2) == Approx(4.2));
303  CHECK(tensorAccessor(grid_data, 14, 13, 13, 0) == Approx(1.0));
304  CHECK(tensorAccessor(grid_data, 14, 13, 13, 1) == Approx(1.2));
305  CHECK(tensorAccessor(grid_data, 14, 13, 13, 2) == Approx(1.4));
306  CHECK(tensorAccessor(grid_data, 15, 11, 10, 0) == Approx(7.0));
307  CHECK(tensorAccessor(grid_data, 15, 11, 10, 1) == Approx(7.1));
308  CHECK(tensorAccessor(grid_data, 15, 11, 10, 2) == Approx(7.2));
309  CHECK(tensorAccessor(grid_data, 17, 12, 9, 0) == Approx(5.0));
310  CHECK(tensorAccessor(grid_data, 17, 12, 9, 1) == Approx(5.1));
311  CHECK(tensorAccessor(grid_data, 17, 12, 9, 2) == Approx(5.2));
312 }
313 
314 TEST_CASE("SpaceGrid::Accumulate::outside", "[estimators]")
315 {
317  Communicate* comm;
320  int num_values = 3;
321  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), num_values, false);
323  auto buffer_start = NES::getBufferStart(space_grid);
324  auto buffer_end = NES::getBufferEnd(space_grid);
325  space_grid.write_description(std::cout, std::string(""));
326  auto& sgi = *(sge.sgi_);
327  auto& agr = sgi.get_axis_grids();
328  for (int id = 0; id < OHMMS_DIM; ++id)
329  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
330 
331  CHECK(space_grid.nDomains() == 2000);
332  CHECK(space_grid.getDataVector().size() == 6000);
333 
334  Matrix<Real> values;
335  values.resize(sge.pset_elec_.getTotalNum(), num_values);
336 
337  for (int ip = 0; ip < sge.pset_elec_.getTotalNum(); ++ip)
338  for (int iv = 0; iv < num_values; ++iv)
339  values(ip, iv) = ip + 0.1 * iv;
340 
341  const int ei_tid = sge.pset_elec_.addTable(sge.pset_ions_);
342  sge.pset_elec_.update();
343  sge.pset_ions_.update();
344 
345  std::vector<bool> p_outside(8, false);
346  space_grid.accumulate(sge.pset_elec_.R, values, p_outside, sge.pset_elec_.getDistTableAB(ei_tid));
347 
348  // new pset R's
349  // check again
350  auto min_R =
351  ParticleSet::ParticlePos{{1.883366346, 2.136350632, 3.188981533}, {0.09710352868, -0.76751858, -1.89306891}};
352  sge.pset_elec_.applyMinimumImage(min_R);
353  sge.pset_elec_.R = min_R;
354 
355  sge.pset_elec_.update();
356  std::cout << NativePrint(p_outside) << '\n';
357 
358  std::vector<bool> p_outside_2(8, false);
359  space_grid.accumulate(sge.pset_elec_.R, values, p_outside_2, sge.pset_elec_.getDistTableAB(ei_tid));
360 
361  std::cout << NativePrint(p_outside_2) << '\n';
362 
363 }
364 
365 TEST_CASE("SpaceGrid::BadPeriodic", "[estimators]")
366 {
368  Communicate* comm;
371  int num_values = 3;
372  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), num_values, false);
373 
375  auto buffer_start = NES::getBufferStart(space_grid);
376  auto buffer_end = NES::getBufferEnd(space_grid);
377  space_grid.write_description(std::cout, std::string(""));
378  auto& sgi = *(sge.sgi_);
379  auto& agr = sgi.get_axis_grids();
380  for (int id = 0; id < OHMMS_DIM; ++id)
381  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
382  // CHECK(buffer_start == Approx(0));
383  // CHECK(buffer_end == Approx(23999));
384 
385  Matrix<Real> values;
386  values.resize(sge.pset_elec_.getTotalNum(), num_values);
387 
388  for (int ip = 0; ip < sge.pset_elec_.getTotalNum(); ++ip)
389  for (int iv = 0; iv < num_values; ++iv)
390  values(ip, iv) = ip + 0.1 * iv;
391 
392  const int ei_tid = sge.pset_elec_.addTable(sge.pset_ions_);
393  sge.pset_elec_.update();
394  sge.pset_ions_.update();
395 
396  // set a position outside of the cell
397  sge.pset_elec_.R[2] = {1.451870349, 4.381521229, 1.165202269};
398 
399  std::vector<bool> p_outside(8, false);
400 
401  CHECK_THROWS_AS(space_grid.accumulate(sge.pset_elec_.R, values, p_outside, sge.pset_elec_.getDistTableAB(ei_tid)),
402  std::runtime_error);
403 }
404 
405 TEST_CASE("SpaceGrid::hdf5", "[estimators]")
406 {
408  Communicate* comm;
411  int num_values = 3;
412  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), num_values, false);
414  auto buffer_start = NES::getBufferStart(space_grid);
415  auto buffer_end = NES::getBufferEnd(space_grid);
416  space_grid.write_description(std::cout, std::string(""));
417  auto& sgi = *(sge.sgi_);
418  auto& agr = sgi.get_axis_grids();
419  for (int id = 0; id < OHMMS_DIM; ++id)
420  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
421  //CHECK(buffer_start == 0);
422  //CHECK(buffer_end == 23999);
423 
424  Matrix<Real> values;
425  values.resize(sge.pset_elec_.getTotalNum(), num_values);
426 
427  for (int ip = 0; ip < sge.pset_elec_.getTotalNum(); ++ip)
428  for (int iv = 0; iv < num_values; ++iv)
429  values(ip, iv) = ip + 0.1 * iv;
430 
431  const int ei_tid = sge.pset_elec_.addTable(sge.pset_ions_);
432  sge.pset_elec_.update();
433  sge.pset_ions_.update();
434 
435  std::vector<bool> p_outside(8, false);
436  space_grid.accumulate(sge.pset_elec_.R, values, p_outside, sge.pset_elec_.getDistTableAB(ei_tid));
437 
438  hdf_archive hd;
439  std::string test_file{"spacegrid_test.hdf"};
440  bool okay = hd.create(test_file);
441  REQUIRE(okay);
442 
443  std::vector<ObservableHelper> h5desc;
444  space_grid.registerGrid(hd, 0);
445 
446  space_grid.write(hd);
447 
448  hd.close();
449 
450  hdf_archive hd_read;
451  bool okay_read = hd.open(test_file);
452  hd.push("spacegrid1");
453  //hdf5 values always end up as doubles
454  Matrix<double> read_values(1, 24000);
455  hd.readEntry(read_values, "value");
456 
457  auto tensorAccessor = [](const auto& grid_data, int i, int j, int k, int iv) -> double {
458  return grid_data.data()[1200 * i + 60 * j + 3 * k + iv];
459  };
460 
461  auto value = tensorAccessor(read_values, 10, 17, 9, 0);
462 
463  CHECK(tensorAccessor(read_values, 10, 17, 9, 0) == Approx(2.0));
464  CHECK(tensorAccessor(read_values, 10, 17, 9, 1) == Approx(2.1));
465  CHECK(tensorAccessor(read_values, 10, 17, 9, 2) == Approx(2.2));
466  CHECK(tensorAccessor(read_values, 12, 15, 7, 0) == Approx(4.0));
467  CHECK(tensorAccessor(read_values, 12, 15, 7, 1) == Approx(4.1));
468  CHECK(tensorAccessor(read_values, 12, 15, 7, 2) == Approx(4.2));
469  CHECK(tensorAccessor(read_values, 12, 16, 11, 0) == Approx(3.0));
470  CHECK(tensorAccessor(read_values, 12, 16, 11, 1) == Approx(3.1));
471  CHECK(tensorAccessor(read_values, 12, 16, 11, 2) == Approx(3.2));
472  CHECK(tensorAccessor(read_values, 13, 11, 15, 0) == Approx(6.0));
473  CHECK(tensorAccessor(read_values, 13, 11, 15, 1) == Approx(6.1));
474  CHECK(tensorAccessor(read_values, 13, 11, 15, 2) == Approx(6.2));
475  CHECK(tensorAccessor(read_values, 14, 13, 13, 0) == Approx(1.0));
476  CHECK(tensorAccessor(read_values, 14, 13, 13, 1) == Approx(1.2));
477  CHECK(tensorAccessor(read_values, 14, 13, 13, 2) == Approx(1.4));
478  CHECK(tensorAccessor(read_values, 15, 11, 10, 0) == Approx(7.0));
479  CHECK(tensorAccessor(read_values, 15, 11, 10, 1) == Approx(7.1));
480  CHECK(tensorAccessor(read_values, 15, 11, 10, 2) == Approx(7.2));
481  CHECK(tensorAccessor(read_values, 17, 12, 9, 0) == Approx(5.0));
482  CHECK(tensorAccessor(read_values, 17, 12, 9, 1) == Approx(5.1));
483  CHECK(tensorAccessor(read_values, 17, 12, 9, 2) == Approx(5.2));
484 
485  /// \todo add additional hdf5 output checks
486 }
487 } // namespace qmcplusplus
class that handles xmlDoc
Definition: Libxml2Doc.h:76
bool open(const std::filesystem::path &fname, unsigned flags=H5F_ACC_RDWR)
open a file
The operator<< functions provide output for data structures that can be used to directly initialize t...
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
void applyMinimumImage(ParticlePos &pinout) const
if(!okay) throw std xmlNodePtr node
size_t getTotalNum() const
Definition: ParticleSet.h:493
TEST_CASE("complex_helper", "[type_traits]")
void close()
close all the open groups and file
Definition: hdf_archive.cpp:38
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
This should be the minimal ParticleSetPool for integration tests.
constexpr bool generate_test_data
set to true to generate new random R for particles.
class to handle hdf file
Definition: hdf_archive.h:51
void resize(size_type n, size_type m)
Resize the container.
Definition: OhmmsMatrix.h:99
void update(bool skipSK=false)
update the internal data
Attaches a unit to a Vector for IO.
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
This wrapper is to allow us to leave the user facing operator<< for classes alone.
This is the port of QMCHamiltonian/SpaceGrid to the new Estimator design.
#define OHMMS_DIM
Definition: config.h:64
ForceBase::Real Real
Definition: ForceBase.cpp:26
static const auto & getData(const NESpaceGrid< REAL > &nesg)
const DistanceTableAB & getDistTableAB(int table_ID) const
get a distance table by table_ID and dyanmic_cast to DistanceTableAB
Wrapping information on parallelism.
Definition: Communicate.h:68
int addTable(const ParticleSet &psrc, DTModes modes=DTModes::ALL_OFF)
add a distance table
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
static auto * getOdu(const NESpaceGrid< REAL > &nesg)
REQUIRE(std::filesystem::exists(filename))
Manage a collection of ParticleSet objects.
ParticlePos R
Position.
Definition: ParticleSet.h:79
std::unique_ptr< T > UPtr
void push(const std::string &gname, bool createit=true)
push a group to the group stack
Real odu_[OHMMS_DIM]
Definition: NESpaceGrid.h:251
std::vector< std::reference_wrapper< T > > RefVector
bool create(const std::filesystem::path &fname, unsigned flags=H5F_ACC_TRUNC)
create a file
static constexpr std::array< std::string_view, NUM_CASES > xml
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
static int getBufferEnd(const NESpaceGrid< REAL > &nesg)
bool readEntry(T &data, const std::string &aname)
read the data from the group aname and return status use read() for inbuilt error checking ...
Definition: hdf_archive.h:293
RefVector< ParticleSet > ref_psets_
UPtr< ReferencePointsInput > rpi_
UPtr< NEReferencePoints > ref_points_
static int getBufferStart(const NESpaceGrid< REAL > &nesg)
std::vector< Real > data_
Definition: NESpaceGrid.h:256