QMCPACK
test_TrialWaveFunction_diamondC_2x1x1.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: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
8 //
9 // File created by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #include "catch.hpp"
14 
15 #include <regex>
16 #include "OhmmsData/Libxml2Doc.h"
17 #include "ParticleSet.h"
18 #include "ParticleSetPool.h"
19 #include "DistanceTable.h"
27 #include "TWFGrads.hpp"
29 #include <ResourceCollection.h>
30 
31 namespace qmcplusplus
32 {
36 
37 struct double_tag
38 {};
39 struct float_tag
40 {};
41 
43 {
44  bool spo;
45  bool jas;
46 };
47 
48 /** Templated test of TrialWF with different DiracDet flavors.
49  */
50 template<class DiracDet, class SPO_precision>
51 void testTrialWaveFunction_diamondC_2x1x1(const int ndelay, const OffloadSwitches& offload_switches)
52 {
53 #if defined(MIXED_PRECISION)
54  const double grad_precision = 1.3e-4;
55  const double ratio_precision = 2e-4;
56 #else
57  const double grad_precision = std::is_same<SPO_precision, float_tag>::value ? 1.3e-4 : 1e-8;
58  const double ratio_precision = std::is_same<SPO_precision, float_tag>::value ? 2e-4 : 1e-5;
59 #endif
61 
62  const DynamicCoordinateKind kind_selected =
64 
65  // diamondC_2x1x1
67  lattice.R = {6.7463223, 6.7463223, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
68  lattice.BoxBConds = {1, 1, 1};
69  lattice.reset();
70 
73  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell(), kind_selected);
74  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell(), kind_selected);
75  ParticleSet& ions_(*ions_uptr);
76  ParticleSet& elec_(*elec_uptr);
77 
78  ions_.setName("ion");
79  ptcl.addParticleSet(std::move(ions_uptr));
80  ions_.create({4});
81  ions_.R[0] = {0.0, 0.0, 0.0};
82  ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
83  ions_.R[2] = {3.37316115, 3.37316115, 0.0};
84  ions_.R[3] = {5.05974173, 5.05974173, 1.68658058};
85  ions_.update();
86 
87 
88  elec_.setName("elec");
89  ptcl.addParticleSet(std::move(elec_uptr));
90  elec_.create({2, 2});
91  elec_.R[0] = {0.0, 0.0, 0.0};
92  elec_.R[1] = {0.0, 1.0, 1.0};
93  elec_.R[2] = {1.0, 1.0, 0.0};
94  elec_.R[3] = {1.0, 0.0, 1.0};
95 
96  SpeciesSet& tspecies = elec_.getSpeciesSet();
97  int upIdx = tspecies.addSpecies("u");
98  int downIdx = tspecies.addSpecies("d");
99  int chargeIdx = tspecies.addAttribute("charge");
100  tspecies(chargeIdx, upIdx) = -1;
101  tspecies(chargeIdx, downIdx) = -1;
102 
103  const int ei_table_index = elec_.addTable(ions_);
104  elec_.resetGroups();
105  elec_.createSK(); // needed by AoS J2 for ChiesaKEcorrection
106 
107  // make a ParticleSet Clone
108  ParticleSet elec_clone(elec_);
109 
110  //diamondC_1x1x1
111  std::string spo_xml = R"XML(<tmp> \
112  <determinantset type="einspline" href="diamondC_2x1x1.pwscf.h5" tilematrix="2 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.5" precision="float" size="2" gpu="no"/> \
113  </tmp>)XML";
114  std::string spo_omp_xml = R"XML(<tmp> \
115  <determinantset type="einspline" href="diamondC_2x1x1.pwscf.h5" tilematrix="2 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.5" precision="float" size="2" gpu="omptarget"/> \
116  </tmp>)XML";
117 #ifndef MIXED_PRECISION
118  if (std::is_same<SPO_precision, double_tag>::value)
119  {
120  spo_xml = std::regex_replace(spo_xml, std::regex("float"), "double");
121  spo_omp_xml = std::regex_replace(spo_omp_xml, std::regex("float"), "double");
122  }
123 #endif
125  bool okay = doc.parseFromString(offload_switches.spo ? spo_omp_xml : spo_xml);
126  REQUIRE(okay);
127 
128  xmlNodePtr spo_root = doc.getRoot();
129  xmlNodePtr ein1 = xmlFirstElementChild(spo_root);
130 
131  EinsplineSetBuilder einSet(elec_, ptcl.getPool(), c, ein1);
132  auto spo = einSet.createSPOSetFromXML(ein1);
133  REQUIRE(spo != nullptr);
134 
135  std::vector<std::unique_ptr<DiracDeterminantBase>> dets;
136  auto det_up_ptr = std::make_unique<DiracDet>(spo->makeClone(), 0, 2, ndelay);
137  auto det_up = det_up_ptr.get();
138  dets.push_back(std::move(det_up_ptr));
139  dets.push_back(std::make_unique<DiracDet>(spo->makeClone(), 2, 4, ndelay));
140 
141  auto slater_det = std::make_unique<SlaterDet>(elec_, std::move(dets));
142 
143  RuntimeOptions runtime_options;
144  TrialWaveFunction psi(runtime_options);
145  psi.addComponent(std::move(slater_det));
146 
147  const char* jas_input = R"XML(<tmp>
148 <jastrow name="J2" type="Two-Body" function="Bspline" print="yes" gpu="no">
149  <correlation size="10" speciesA="u" speciesB="u">
150  <coefficients id="uu" type="Array"> 0.02904699284 -0.1004179 -0.1752703883 -0.2232576505 -0.2728029201 -0.3253286875 -0.3624525145 -0.3958223107 -0.4268582166 -0.4394531176</coefficients>
151  </correlation>
152 </jastrow>
153 </tmp>)XML";
154 
155  const char* jas_omp_input = R"XML(<tmp>
156 <jastrow name="J2" type="Two-Body" function="Bspline" print="yes" gpu="omptarget">
157  <correlation size="10" speciesA="u" speciesB="u">
158  <coefficients id="uu" type="Array"> 0.02904699284 -0.1004179 -0.1752703883 -0.2232576505 -0.2728029201 -0.3253286875 -0.3624525145 -0.3958223107 -0.4268582166 -0.4394531176</coefficients>
159  </correlation>
160 </jastrow>
161 </tmp>)XML";
162 
163  Libxml2Document doc_jas;
164  okay = doc.parseFromString(offload_switches.jas ? jas_omp_input : jas_input);
165  REQUIRE(okay);
166 
167  xmlNodePtr jas_root = doc.getRoot();
168  xmlNodePtr jas1 = xmlFirstElementChild(jas_root);
169 
170  RadialJastrowBuilder jb(c, elec_);
171  psi.addComponent(jb.buildComponent(jas1));
172 
173  // initialize distance tables.
174  elec_.update();
175  double logpsi = psi.evaluateLog(elec_);
176 
177  app_log() << "debug before YYY logpsi " << std::setprecision(16) << psi.getLogPsi() << " " << psi.getPhase()
178  << std::endl;
179 #if defined(QMC_COMPLEX)
180  CHECK(logpsi == Approx(-4.546410485374186));
181 #else
182  CHECK(logpsi == Approx(-5.932711221043984));
183 #endif
184 
185  auto logpsi_cplx = psi.evaluateGL(elec_, false);
186 #if defined(QMC_COMPLEX)
187  CHECK(std::real(logpsi_cplx) == Approx(-4.546410485374186));
188 #else
189  CHECK(std::real(logpsi_cplx) == Approx(-5.932711221043984));
190 #endif
191 
192  logpsi_cplx = psi.evaluateGL(elec_, true);
193 #if defined(QMC_COMPLEX)
194  CHECK(std::real(logpsi_cplx) == Approx(-4.546410485374186));
195 #else
196  CHECK(std::real(logpsi_cplx) == Approx(-5.932711221043984));
197 #endif
198 
199  // make a TrialWaveFunction Clone
200  std::unique_ptr<TrialWaveFunction> psi_clone(psi.makeClone(elec_clone));
201 
202  elec_clone.update();
203  double logpsi_clone = psi_clone->evaluateLog(elec_clone);
204 #if defined(QMC_COMPLEX)
205  CHECK(logpsi_clone == Approx(-4.546410485374186));
206 #else
207  CHECK(logpsi_clone == Approx(-5.932711221043984));
208 #endif
209 
210  const int moved_elec_id = 0;
211 
212  using PosType = QMCTraits::PosType;
215  PosType delta(0.1, 0.1, 0.2);
216 
217  elec_.makeMove(moved_elec_id, delta);
218 
219  ValueType r_all_val = psi.calcRatio(elec_, moved_elec_id);
220  ValueType r_fermionic_val = psi.calcRatio(elec_, moved_elec_id, TrialWaveFunction::ComputeType::FERMIONIC);
221  ValueType r_bosonic_val = psi.calcRatio(elec_, moved_elec_id, TrialWaveFunction::ComputeType::NONFERMIONIC);
222 
223  app_log() << "YYY r_all_val " << std::setprecision(16) << r_all_val << std::endl;
224  app_log() << "YYY r_fermionic_val " << std::setprecision(16) << r_fermionic_val << std::endl;
225  app_log() << "YYY r_bosonic_val " << std::setprecision(16) << r_bosonic_val << std::endl;
226 #if defined(QMC_COMPLEX)
227  CHECK(r_all_val == ComplexApprox(std::complex<RealType>(0.1248738460467855, 0)).epsilon(2e-5));
228  CHECK(r_fermionic_val == ComplexApprox(std::complex<RealType>(0.1362181543980086, 0)).epsilon(2e-5));
229 #else
230  CHECK(r_all_val == Approx(0.1248738460469678));
231  CHECK(r_fermionic_val == ValueApprox(0.1362181543982075));
232 #endif
233  CHECK(r_bosonic_val == ValueApprox(0.9167195562048454));
234 
235  psi.acceptMove(elec_, moved_elec_id);
236  elec_.acceptMove(moved_elec_id);
237  app_log() << "before YYY getLogPsi " << std::setprecision(16) << psi.getLogPsi() << " " << psi.getPhase()
238  << std::endl;
239 #if defined(QMC_COMPLEX)
240  CHECK(psi.getLogPsi() == Approx(-6.626861768296886).epsilon(5e-5));
241 #else
242  CHECK(psi.getLogPsi() == Approx(-8.013162503965223));
243 #endif
244 
245  elec_.update(true);
246  psi.evaluateLog(elec_);
247 #if defined(QMC_COMPLEX)
248  CHECK(psi.getLogPsi() == Approx(-6.626861768296886).epsilon(5e-5));
249 #else
250  CHECK(psi.getLogPsi() == Approx(-8.013162503965223));
251 #endif
252 
253  // testing batched interfaces
254  ResourceCollection pset_res("test_pset_res");
255  ResourceCollection twf_res("test_twf_res");
256 
257  elec_.createResource(pset_res);
258  psi.createResource(twf_res);
259 
260  // testing batched interfaces
261  RefVectorWithLeader<ParticleSet> p_ref_list(elec_, {elec_, elec_clone});
262  RefVectorWithLeader<TrialWaveFunction> wf_ref_list(psi, {psi, *psi_clone});
263 
264  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_ref_list);
265  ResourceCollectionTeamLock<TrialWaveFunction> mw_twf_lock(twf_res, wf_ref_list);
266 
267  ParticleSet::mw_update(p_ref_list);
268  TrialWaveFunction::mw_evaluateLog(wf_ref_list, p_ref_list);
269  app_log() << "before YYY [0] getLogPsi getPhase " << std::setprecision(16) << wf_ref_list[0].getLogPsi() << " "
270  << wf_ref_list[0].getPhase() << std::endl;
271  app_log() << "before YYY [1] getLogPsi getPhase " << std::setprecision(16) << wf_ref_list[1].getLogPsi() << " "
272  << wf_ref_list[1].getPhase() << std::endl;
273 #if defined(QMC_COMPLEX)
274  REQUIRE(std::complex<RealType>(wf_ref_list[0].getLogPsi(), wf_ref_list[0].getPhase()) ==
275  LogComplexApprox(std::complex<RealType>(-6.626861768296848, -3.141586279082042)));
276  REQUIRE(std::complex<RealType>(wf_ref_list[1].getLogPsi(), wf_ref_list[1].getPhase()) ==
277  LogComplexApprox(std::complex<RealType>(-4.546410485374186, -3.141586279080522)));
278 #else
279  REQUIRE(std::complex<RealType>(wf_ref_list[0].getLogPsi(), wf_ref_list[0].getPhase()) ==
280  LogComplexApprox(std::complex<RealType>(-8.013162503965042, 6.283185307179586)));
281  REQUIRE(std::complex<RealType>(wf_ref_list[1].getLogPsi(), wf_ref_list[1].getPhase()) ==
282  LogComplexApprox(std::complex<RealType>(-5.932711221043984, 6.283185307179586)));
283 #endif
284 
285  TWFGrads<CoordsType::POS> grad_old(2);
286 
287  grad_old.grads_positions[0] = wf_ref_list[0].evalGrad(p_ref_list[0], moved_elec_id);
288  grad_old.grads_positions[1] = wf_ref_list[1].evalGrad(p_ref_list[1], moved_elec_id);
289 
290  app_log() << "evalGrad " << std::setprecision(14) << grad_old.grads_positions[0][0] << " "
291  << grad_old.grads_positions[0][1] << " " << grad_old.grads_positions[0][2] << " "
292  << grad_old.grads_positions[1][0] << " " << grad_old.grads_positions[1][1] << " "
293  << grad_old.grads_positions[1][2] << std::endl;
294 
295  TrialWaveFunction::mw_evalGrad(wf_ref_list, p_ref_list, moved_elec_id, grad_old);
296 
297 #if defined(QMC_COMPLEX)
298  CHECK(grad_old.grads_positions[0][0] ==
299  ComplexApprox(ValueType(713.71203320653, 0.020838031926441)).epsilon(grad_precision));
300  CHECK(grad_old.grads_positions[0][1] ==
301  ComplexApprox(ValueType(713.71203320654, 0.020838031928415)).epsilon(grad_precision));
302  CHECK(grad_old.grads_positions[0][2] ==
303  ComplexApprox(ValueType(-768.42842826889, -0.020838032018344)).epsilon(grad_precision));
304  CHECK(grad_old.grads_positions[1][0] ==
305  ComplexApprox(ValueType(118.02653358655, -0.0022419843505538)).epsilon(grad_precision));
306  CHECK(grad_old.grads_positions[1][1] ==
307  ComplexApprox(ValueType(118.02653358655, -0.0022419843498631)).epsilon(grad_precision));
308  CHECK(grad_old.grads_positions[1][2] ==
309  ComplexApprox(ValueType(-118.46325895634, 0.0022419843493758)).epsilon(grad_precision));
310 #else
311  CHECK(grad_old.grads_positions[0][0] == Approx(713.69119517454).epsilon(2. * grad_precision));
312  CHECK(grad_old.grads_positions[0][1] == Approx(713.69119517455).epsilon(2. * grad_precision));
313  CHECK(grad_old.grads_positions[0][2] == Approx(-768.40759023681).epsilon(2. * grad_precision));
314  CHECK(grad_old.grads_positions[1][0] == Approx(118.0287755709).epsilon(grad_precision));
315  CHECK(grad_old.grads_positions[1][1] == Approx(118.0287755709).epsilon(grad_precision));
316  CHECK(grad_old.grads_positions[1][2] == Approx(-118.46550094069).epsilon(grad_precision));
317 #endif
318  PosType delta_sign_changed(0.1, 0.1, -0.2);
319  std::vector<PosType> displs{delta_sign_changed, delta_sign_changed};
320  ParticleSet::mw_makeMove(p_ref_list, moved_elec_id, displs);
321 
322  if (kind_selected != DynamicCoordinateKind::DC_POS_OFFLOAD)
323  {
324  ValueType r_0 = wf_ref_list[0].calcRatio(p_ref_list[0], moved_elec_id);
325  GradType grad_temp;
326  ValueType r_1 = wf_ref_list[1].calcRatioGrad(p_ref_list[1], moved_elec_id, grad_temp);
327  app_log() << "calcRatio calcRatioGrad " << std::setprecision(14) << r_0 << " " << r_1 << " " << grad_temp[0] << " "
328  << grad_temp[1] << " " << grad_temp[2] << std::endl;
329 #if defined(QMC_COMPLEX)
330  CHECK(r_0 == ComplexApprox(ValueType(253.71869245791, -0.00034808849808193)).epsilon(1e-4));
331  CHECK(r_1 == ComplexApprox(ValueType(36.915636007059, -6.4240180082292e-05)).epsilon(1e-5));
332  CHECK(grad_temp[0] == ComplexApprox(ValueType(1.4567170375539, 0.00027263382943948)));
333  CHECK(grad_temp[1] == ComplexApprox(ValueType(1.4567170375539, 0.00027263382945093)));
334  CHECK(grad_temp[2] == ComplexApprox(ValueType(-1.2930978490431, -0.00027378452214318)));
335 #else
336  CHECK(r_0 == Approx(253.71904054638).epsilon(2e-4));
337  CHECK(r_1 == Approx(36.915700247239));
338  CHECK(grad_temp[0] == Approx(1.4564444046733));
339  CHECK(grad_temp[1] == Approx(1.4564444046734));
340  CHECK(grad_temp[2] == Approx(-1.2928240654738));
341 #endif
342  }
343 
344  PosType delta_zero(0, 0, 0);
345  displs = {delta_zero, delta};
346  ParticleSet::mw_makeMove(p_ref_list, moved_elec_id, displs);
347 
348  std::vector<PsiValue> ratios(2);
349  TrialWaveFunction::mw_calcRatio(wf_ref_list, p_ref_list, moved_elec_id, ratios);
350  app_log() << "mixed move calcRatio " << std::setprecision(14) << ratios[0] << " " << ratios[1] << std::endl;
351 
352 #if defined(QMC_COMPLEX)
353  CHECK(ratios[0] == ComplexApprox(PsiValue(1, 0)).epsilon(5e-4));
354  CHECK(ratios[1] == ComplexApprox(PsiValue(0.12487384604679, 0)).epsilon(5e-5));
355 #else
356  CHECK(ratios[0] == Approx(1).epsilon(5e-5));
357 #if defined(MIXED_PRECISION)
358  CHECK(ratios[1] == Approx(0.12487384604697).epsilon(5e-5));
359 #else
360  CHECK(ratios[1] == Approx(0.12487384604697));
361 #endif
362 #endif
363 
364  std::fill(ratios.begin(), ratios.end(), 0);
365  TWFGrads<CoordsType::POS> grad_new(2);
366 
367  if (kind_selected != DynamicCoordinateKind::DC_POS_OFFLOAD)
368  {
369  ratios[0] = wf_ref_list[0].calcRatioGrad(p_ref_list[0], moved_elec_id, grad_new.grads_positions[0]);
370  ratios[1] = wf_ref_list[1].calcRatioGrad(p_ref_list[1], moved_elec_id, grad_new.grads_positions[1]);
371 
372  app_log() << "calcRatioGrad " << std::setprecision(14) << ratios[0] << " " << ratios[1] << std::endl
373  << grad_new.grads_positions[0][0] << " " << grad_new.grads_positions[0][1] << " "
374  << grad_new.grads_positions[0][2] << " " << grad_new.grads_positions[1][0] << " "
375  << grad_new.grads_positions[1][1] << " " << grad_new.grads_positions[1][2] << std::endl;
376  }
377  //Temporary as switch to std::reference_wrapper proceeds
378  // testing batched interfaces
379  TrialWaveFunction::mw_calcRatioGrad(wf_ref_list, p_ref_list, moved_elec_id, ratios, grad_new);
380  app_log() << "flex_calcRatioGrad " << std::setprecision(14) << ratios[0] << " " << ratios[1] << std::endl
381  << grad_new.grads_positions[0][0] << " " << grad_new.grads_positions[0][1] << " "
382  << grad_new.grads_positions[0][2] << " " << grad_new.grads_positions[1][0] << " "
383  << grad_new.grads_positions[1][1] << " " << grad_new.grads_positions[1][2] << std::endl;
384 #if defined(QMC_COMPLEX)
385  CHECK(ratios[0] == ComplexApprox(ValueType(1, 0)).epsilon(5e-5));
386  CHECK(grad_new.grads_positions[0][0] ==
387  ComplexApprox(ValueType(713.71203320653, 0.020838031942702)).epsilon(grad_precision));
388  CHECK(grad_new.grads_positions[0][1] ==
389  ComplexApprox(ValueType(713.71203320654, 0.020838031944677)).epsilon(grad_precision));
390  CHECK(grad_new.grads_positions[0][2] ==
391  ComplexApprox(ValueType(-768.42842826889, -0.020838032035842)).epsilon(grad_precision));
392  CHECK(ratios[1] == ComplexApprox(ValueType(0.12487384604679, 0)).epsilon(5e-5));
393  CHECK(grad_new.grads_positions[1][0] ==
394  ComplexApprox(ValueType(713.71203320656, 0.020838031892613)).epsilon(grad_precision));
395  CHECK(grad_new.grads_positions[1][1] ==
396  ComplexApprox(ValueType(713.71203320657, 0.020838031894628)).epsilon(grad_precision));
397  CHECK(grad_new.grads_positions[1][2] ==
398  ComplexApprox(ValueType(-768.42842826892, -0.020838031981896)).epsilon(grad_precision));
399 #else
400  CHECK(ratios[0] == Approx(1).epsilon(5e-5));
401  CHECK(grad_new.grads_positions[0][0] == Approx(713.69119517463).epsilon(grad_precision));
402  CHECK(grad_new.grads_positions[0][1] == Approx(713.69119517463).epsilon(grad_precision));
403  CHECK(grad_new.grads_positions[0][2] == Approx(-768.40759023689).epsilon(grad_precision));
404  CHECK(ratios[1] == Approx(0.12487384604697).epsilon(5e-5));
405  CHECK(grad_new.grads_positions[1][0] == Approx(713.69119517467).epsilon(grad_precision));
406  CHECK(grad_new.grads_positions[1][1] == Approx(713.69119517468).epsilon(grad_precision));
407  CHECK(grad_new.grads_positions[1][2] == Approx(-768.40759023695).epsilon(grad_precision));
408 #endif
409 
410  std::vector<bool> isAccepted(2, true);
411  TrialWaveFunction::mw_accept_rejectMove(wf_ref_list, p_ref_list, moved_elec_id, isAccepted, true);
412  app_log() << "flex_acceptMove WF_list[0] getLogPsi getPhase " << std::setprecision(16) << wf_ref_list[0].getLogPsi()
413  << " " << wf_ref_list[0].getPhase() << std::endl;
414  app_log() << "flex_acceptMove WF_list[1] getLogPsi getPhase " << std::setprecision(16) << wf_ref_list[1].getLogPsi()
415  << " " << wf_ref_list[1].getPhase() << std::endl;
416 #if defined(QMC_COMPLEX)
417  REQUIRE(std::complex<RealType>(wf_ref_list[0].getLogPsi(), wf_ref_list[0].getPhase()) ==
418  LogComplexApprox(std::complex<RealType>(-6.626861768296848, -3.141586279082065)));
419  REQUIRE(std::complex<RealType>(wf_ref_list[1].getLogPsi(), wf_ref_list[1].getPhase()) ==
420  LogComplexApprox(std::complex<RealType>(-6.626861768296886, -3.141586279081995)));
421 #else
422  REQUIRE(std::complex<RealType>(wf_ref_list[0].getLogPsi(), wf_ref_list[0].getPhase()) ==
423  LogComplexApprox(std::complex<RealType>(-8.013162503965155, 6.283185307179586)));
424  REQUIRE(std::complex<RealType>(wf_ref_list[1].getLogPsi(), wf_ref_list[1].getPhase()) ==
425  LogComplexApprox(std::complex<RealType>(-8.013162503965223, 6.283185307179586)));
426 #endif
427 
428  ParticleSet::mw_accept_rejectMove(p_ref_list, moved_elec_id, isAccepted, true);
429 
430  const int moved_elec_id_next = 1;
431  TrialWaveFunction::mw_evalGrad(wf_ref_list, p_ref_list, moved_elec_id_next, grad_old);
432  app_log() << "evalGrad next electron " << std::setprecision(14) << grad_old.grads_positions[0][0] << " "
433  << grad_old.grads_positions[0][1] << " " << grad_old.grads_positions[0][2] << " "
434  << grad_old.grads_positions[1][0] << " " << grad_old.grads_positions[1][1] << " "
435  << grad_old.grads_positions[1][2] << std::endl;
436 #if defined(QMC_COMPLEX)
437  CHECK(grad_old.grads_positions[0][0] ==
438  ComplexApprox(ValueType(-114.82740072726, -7.605305979232e-05)).epsilon(grad_precision));
439  CHECK(grad_old.grads_positions[0][1] ==
440  ComplexApprox(ValueType(-93.980772428401, -7.605302517238e-05)).epsilon(grad_precision));
441  CHECK(grad_old.grads_positions[0][2] ==
442  ComplexApprox(ValueType(64.050803536571, 7.6052975324197e-05)).epsilon(grad_precision));
443  CHECK(grad_old.grads_positions[1][0] ==
444  ComplexApprox(ValueType(-114.82740072726, -7.605305979232e-05)).epsilon(grad_precision));
445  CHECK(grad_old.grads_positions[1][1] ==
446  ComplexApprox(ValueType(-93.980772428401, -7.605302517238e-05)).epsilon(grad_precision));
447  CHECK(grad_old.grads_positions[1][2] ==
448  ComplexApprox(ValueType(64.050803536571, 7.6052975324197e-05)).epsilon(grad_precision));
449 #else
450  CHECK(grad_old.grads_positions[0][0] == Approx(-114.82732467419).epsilon(grad_precision));
451  CHECK(grad_old.grads_positions[0][1] == Approx(-93.98069637537).epsilon(grad_precision));
452  CHECK(grad_old.grads_positions[0][2] == Approx(64.050727483593).epsilon(grad_precision));
453  CHECK(grad_old.grads_positions[1][0] == Approx(-114.82732467419).epsilon(grad_precision));
454  CHECK(grad_old.grads_positions[1][1] == Approx(-93.98069637537).epsilon(grad_precision));
455  CHECK(grad_old.grads_positions[1][2] == Approx(64.050727483593).epsilon(grad_precision));
456 #endif
457 
458  std::vector<PosType> displ(2);
459  displ[0] = displ[1] = {0.1, 0.2, 0.3};
460 
461  ParticleSet::mw_makeMove(p_ref_list, moved_elec_id_next, displ);
462  TrialWaveFunction::mw_calcRatioGrad(wf_ref_list, p_ref_list, moved_elec_id_next, ratios, grad_new);
463  app_log() << "ratioGrad next electron " << std::setprecision(14) << grad_new.grads_positions[0][0] << " "
464  << grad_new.grads_positions[0][1] << " " << grad_new.grads_positions[0][2] << " "
465  << grad_new.grads_positions[1][0] << " " << grad_new.grads_positions[1][1] << " "
466  << grad_new.grads_positions[1][2] << std::endl;
467 #if defined(QMC_COMPLEX)
468  CHECK(grad_new.grads_positions[0][0] ==
469  ComplexApprox(ValueType(9.6073058494562, -1.4375146770852e-05)).epsilon(8e-5));
470  CHECK(grad_new.grads_positions[0][1] ==
471  ComplexApprox(ValueType(6.3111018321898, -1.4375146510386e-05)).epsilon(8e-5));
472  CHECK(grad_new.grads_positions[0][2] ==
473  ComplexApprox(ValueType(-3.2027658046121, 1.4375146020225e-05)).epsilon(8e-5));
474  CHECK(grad_new.grads_positions[1][0] ==
475  ComplexApprox(ValueType(9.6073058494562, -1.4375146770852e-05)).epsilon(8e-5));
476  CHECK(grad_new.grads_positions[1][1] ==
477  ComplexApprox(ValueType(6.3111018321898, -1.4375146510386e-05)).epsilon(8e-5));
478  CHECK(grad_new.grads_positions[1][2] ==
479  ComplexApprox(ValueType(-3.2027658046121, 1.4375146020225e-05)).epsilon(8e-5));
480 #else
481  CHECK(grad_new.grads_positions[0][0] == Approx(9.607320224603).epsilon(1e-4));
482  CHECK(grad_new.grads_positions[0][1] == Approx(6.3111162073363).epsilon(1e-4));
483  CHECK(grad_new.grads_positions[0][2] == Approx(-3.2027801797581).epsilon(1e-4));
484  CHECK(grad_new.grads_positions[1][0] == Approx(9.607320224603).epsilon(1e-4));
485  CHECK(grad_new.grads_positions[1][1] == Approx(6.3111162073363).epsilon(1e-4));
486  CHECK(grad_new.grads_positions[1][2] == Approx(-3.2027801797581).epsilon(1e-4));
487 #endif
488 
489  isAccepted[0] = true;
490  isAccepted[1] = false;
491  TrialWaveFunction::mw_accept_rejectMove(wf_ref_list, p_ref_list, moved_elec_id_next, isAccepted, true);
492  ParticleSet::mw_accept_rejectMove(p_ref_list, moved_elec_id_next, isAccepted, true);
493 
495  TrialWaveFunction::mw_evaluateGL(wf_ref_list, p_ref_list, false);
496 #ifndef NDEBUG
497  app_log() << "invMat next electron " << std::setprecision(14) << det_up->getPsiMinv()[0][0] << " "
498  << det_up->getPsiMinv()[0][1] << " " << det_up->getPsiMinv()[1][0] << " " << det_up->getPsiMinv()[1][1]
499  << " " << std::endl;
500 #if defined(QMC_COMPLEX)
501  CHECK(det_up->getPsiMinv()[0][0] == ComplexApprox(ValueType(38.503358805635, -38.503358805645)).epsilon(1e-4));
502  CHECK(det_up->getPsiMinv()[0][1] == ComplexApprox(ValueType(-31.465077529568, 31.465077529576)).epsilon(1e-4));
503  CHECK(det_up->getPsiMinv()[1][0] == ComplexApprox(ValueType(-27.188228530061, 27.188228530068)).epsilon(1e-4));
504  CHECK(det_up->getPsiMinv()[1][1] == ComplexApprox(ValueType(22.759962501254, -22.75996250126)).epsilon(1e-4));
505 #else
506  CHECK(det_up->getPsiMinv()[0][0] == Approx(77.0067176113).epsilon(1e-4));
507  CHECK(det_up->getPsiMinv()[0][1] == Approx(-62.9301550592).epsilon(1e-4));
508  CHECK(det_up->getPsiMinv()[1][0] == Approx(-54.376457060136).epsilon(1e-4));
509  CHECK(det_up->getPsiMinv()[1][1] == Approx(45.51992500251).epsilon(1e-4));
510 #endif
511 #endif // NDEBUG
512  std::vector<LogValue> log_values(wf_ref_list.size());
513  TrialWaveFunction::mw_evaluateGL(wf_ref_list, p_ref_list, false);
514  for (int iw = 0; iw < log_values.size(); iw++)
515  log_values[iw] = {wf_ref_list[iw].getLogPsi(), wf_ref_list[iw].getPhase()};
516 #if defined(QMC_COMPLEX)
517  CHECK(LogComplexApprox(log_values[0]) == LogValue{-4.1148130068943, -6.2831779860047});
518  CHECK(LogComplexApprox(log_values[1]) == LogValue{-6.6269077659586, -3.1416312090662});
519 #else
520  CHECK(LogComplexApprox(log_values[0]) == LogValue{-5.5011162672993, 9.4247779607694});
521  CHECK(LogComplexApprox(log_values[1]) == LogValue{-8.0131646238354, 6.2831853071796});
522 #endif
523 
524  // This test has 4 electrons but only 2 particle moves are attempted.
525  // Force update of all distance tables before mw_evaluateGL with recompute
526  // needed as the above ParticleSet::mw_accept_rejectMove calls are in forward mode.
527  ParticleSet::mw_update(p_ref_list);
528  TrialWaveFunction::mw_evaluateGL(wf_ref_list, p_ref_list, true);
529  for (int iw = 0; iw < log_values.size(); iw++)
530  CHECK(LogComplexApprox(log_values[iw]) == LogValue{wf_ref_list[iw].getLogPsi(), wf_ref_list[iw].getPhase()});
531 
532  // test NLPP related APIs
533  const int nknot = 3;
534  VirtualParticleSet vp(elec_, nknot), vp_clone(elec_clone, nknot);
535  RefVectorWithLeader<VirtualParticleSet> vp_list(vp, {vp, vp_clone});
536  ResourceCollection vp_res("test_vp_res");
537  vp.createResource(vp_res);
538  ResourceCollectionTeamLock<VirtualParticleSet> mw_vp_lock(vp_res, vp_list);
539 
540  const auto& ei_table1 = elec_.getDistTableAB(ei_table_index);
541  // make virtual move of elec 0, reference ion 1
542  NLPPJob<RealType> job1(1, 0, ei_table1.getDistances()[0][1], -ei_table1.getDisplacements()[0][1]);
543  const auto& ei_table2 = elec_clone.getDistTableAB(ei_table_index);
544  // make virtual move of elec 1, reference ion 3
545  NLPPJob<RealType> job2(3, 1, ei_table2.getDistances()[1][3], -ei_table2.getDisplacements()[1][3]);
546 
547  std::vector<PosType> deltaV1{{0.1, 0.2, 0.3}, {0.1, 0.3, 0.2}, {0.2, 0.1, 0.3}};
548  std::vector<PosType> deltaV2{{0.02, 0.01, 0.03}, {0.02, 0.03, 0.01}, {0.03, 0.01, 0.02}};
549 
550  VirtualParticleSet::mw_makeMoves(vp_list, p_ref_list, {deltaV1, deltaV2}, {job1, job2}, false);
551 
552  std::vector<ValueType> nlpp1_ratios(nknot), nlpp2_ratios(nknot);
554  {nlpp1_ratios, nlpp2_ratios});
555 
556  CHECK(ValueApprox(nlpp1_ratios[0]).epsilon(ratio_precision) == ValueType(2.4229926733));
557  CHECK(ValueApprox(nlpp1_ratios[1]).epsilon(ratio_precision) == ValueType(-3.2054654296));
558  CHECK(ValueApprox(nlpp1_ratios[2]).epsilon(ratio_precision) == ValueType(2.3982171406));
559  CHECK(ValueApprox(nlpp2_ratios[0]).epsilon(ratio_precision) == ValueType(-0.3505144708));
560  CHECK(ValueApprox(nlpp2_ratios[1]).epsilon(ratio_precision) == ValueType(-3.350712448));
561  CHECK(ValueApprox(nlpp2_ratios[2]).epsilon(ratio_precision) == ValueType(-2.0885822923));
562 }
563 
564 TEST_CASE("TrialWaveFunction_diamondC_2x1x1", "[wavefunction]")
565 {
566  using VT = QMCTraits::ValueType;
567  using FPVT = QMCTraits::QTFull::ValueType;
568 
569 #if defined(ENABLE_CUDA) && defined(ENABLE_OFFLOAD)
570  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<CUDA>>")
571  {
573  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{false, false});
574  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{false, false});
575  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{false, false});
576  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{false, false});
577  }
578  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<CUDA>>_offload_spo")
579  {
581  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{true, false});
582  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{true, false});
583  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{true, false});
584  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{true, false});
585  }
586  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<CUDA>>_offload_jas")
587  {
589  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{false, true});
590  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{false, true});
591  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{false, true});
592  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{false, true});
593  }
594  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<CUDA>>_offload_spo_jas")
595  {
597  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{true, true});
598  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{true, true});
599  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{true, true});
600  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{true, true});
601  }
602 #endif
603 
604  // DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>
605  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>")
606  {
608  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{false, false});
609  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{false, false});
610  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{false, false});
611  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{false, false});
612  }
613  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>_offload_spo")
614  {
616  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{true, false});
617  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{true, false});
618  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{true, false});
619  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{true, false});
620  }
621  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>_offload_jas")
622  {
624  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{false, true});
625  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{false, true});
626  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{false, true});
627  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{false, true});
628  }
629  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>_offload_spo_jas")
630  {
632  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{true, true});
633  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{true, true});
634  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{true, true});
635  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{true, true});
636  }
637 
638  // DiracDeterminant<DelayedUpdate>
639  SECTION("DiracDeterminant<DelayedUpdate>")
640  {
642  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{false, false});
643  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{false, false});
644  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{false, false});
645  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{false, false});
646  }
647  SECTION("DiracDeterminant<DelayedUpdate>_offload_spo")
648  {
650  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{true, false});
651  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{true, false});
652  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{true, false});
653  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{true, false});
654  }
655  SECTION("DiracDeterminant<DelayedUpdate>_offload_Jas")
656  {
658  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{false, true});
659  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{false, true});
660  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{false, true});
661  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{false, true});
662  }
663  SECTION("DiracDeterminant<DelayedUpdate>_offload_spo_jas")
664  {
666  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{true, true});
667  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{true, true});
668  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{true, true});
669  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{true, true});
670  }
671 }
672 
673 } // namespace qmcplusplus
a class that defines a supercell in D-dimensional Euclean space.
RealType evaluateLog(ParticleSet &P)
evalaute the log (internally gradients and laplacian) of the trial wavefunction.
DynamicCoordinateKind
enumerator for DynamicCoordinates kinds
void setName(const std::string &aname)
Definition: ParticleSet.h:237
WaveFunctionComponent::PsiValue PsiValue
void setSimulationCell(const SimulationCell &simulation_cell)
set simulation cell
class that handles xmlDoc
Definition: Libxml2Doc.h:76
ValueType calcRatio(ParticleSet &P, int iat, ComputeType ct=ComputeType::ALL)
compute psi(R_new) / psi(R_current) ratio It returns a complex value if the wavefunction is complex...
static void mw_makeMove(const RefVectorWithLeader< ParticleSet > &p_list, int iat, const MCCoords< CT > &displs)
batched version of makeMove
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
int addSpecies(const std::string &aname)
When a name species does not exist, add a new species.
Definition: SpeciesSet.cpp:33
QMCTraits::RealType real
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
WaveFunctionComponent::GradType GradType
void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to a collection
QTBase::RealType RealType
Definition: Configuration.h:58
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
void acceptMove(ParticleSet &P, int iat, bool safe_to_delay=false)
update the state with the new data
std::ostream & app_log()
Definition: OutputManager.h:65
TEST_CASE("complex_helper", "[type_traits]")
std::unique_ptr< WaveFunctionComponent > buildComponent(xmlNodePtr cur) override
process a xml node at cur
RealType ValueType
Definition: QMCTypes.h:42
static void mw_calcRatioGrad(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, TWFGrads< CT > &grads)
batched version of ratioGrad
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
WaveFunctionComponent::LogValue LogValue
void addParticleSet(std::unique_ptr< ParticleSet > &&p)
add a ParticleSet* to the pool with its ownership transferred ParticleSet built outside the ParticleS...
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Builder class for einspline-based SPOSet objects.
JastrowBuilder using an analytic 1d functor Should be able to eventually handle all one and two body ...
LatticeGaussianProduct::GradType GradType
void update(bool skipSK=false)
update the internal data
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
static void mw_accept_rejectMove(const RefVectorWithLeader< ParticleSet > &p_list, Index_t iat, const std::vector< bool > &isAccepted, bool forward_mode=true)
batched version of acceptMove and rejectMove fused, templated on CoordsType
static void mw_accept_rejectMove(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, const std::vector< bool > &isAccepted, bool safe_to_delay=false)
int addAttribute(const std::string &aname)
for a new attribute, allocate the data, !More often used to get the index of a species ...
Definition: SpeciesSet.cpp:45
std::unique_ptr< TrialWaveFunction > makeClone(ParticleSet &tqp) const
Catch::Detail::LogComplexApprox LogComplexApprox
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
static void mw_evaluateGL(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, bool fromscratch)
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
int addTable(const ParticleSet &psrc, DTModes modes=DTModes::ALL_OFF)
add a distance table
LogValue evaluateGL(ParticleSet &P, bool fromscratch)
compute gradients and laplacian of the TWF with respect to each particle.
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
std::vector< QMCTraits::GradType > grads_positions
Definition: TWFGrads.hpp:31
QTBase::ValueType ValueType
Definition: Configuration.h:60
REQUIRE(std::filesystem::exists(filename))
Manage a collection of ParticleSet objects.
static void mw_calcRatio(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, ComputeType ct=ComputeType::ALL)
batched version of calcRatio
ParticlePos R
Position.
Definition: ParticleSet.h:79
QTBase::PosType PosType
Definition: Configuration.h:61
static void mw_evalGrad(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, TWFGrads< CT > &grads)
batched version of evalGrad
static void mw_makeMoves(const RefVectorWithLeader< VirtualParticleSet > &vp_list, const RefVectorWithLeader< ParticleSet > &p_list, const RefVector< const std::vector< PosType >> &deltaV_list, const RefVector< const NLPPJob< RealType >> &joblist, bool sphere)
static void mw_completeUpdates(const RefVectorWithLeader< TrialWaveFunction > &wf_list)
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
Definition: ParticleSet.h:231
void create(const std::vector< int > &agroup)
create grouped particles
Declaration of a TrialWaveFunction.
void testTrialWaveFunction_diamondC_2x1x1(const int ndelay, const OffloadSwitches &offload_switches)
Templated test of TrialWF with different DiracDet flavors.
Declaration of DiracDeterminantBatched with a S(ingle)P(article)O(rbital)Set.
Class to represent a many-body trial wave function.
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
static void mw_update(const RefVectorWithLeader< ParticleSet > &p_list, bool skipSK=false)
batched version of update
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
handles acquire/release resource by the consumer (RefVectorWithLeader type).
LatticeGaussianProduct::ValueType ValueType
meta data for NLPP calculation of a pair of ion and electron This is not just meta data...
Declaration of DiracDeterminant with a S(ingle)P(article)O(rbital)Set.
void createSK()
create Structure Factor with PBCs
std::complex< double > LogValue
Custom container for set of attributes for a set of species.
Definition: SpeciesSet.h:33
const PoolType & getPool() const
get the Pool object
std::unique_ptr< SPOSet > createSPOSetFromXML(xmlNodePtr cur) override
initialize the Antisymmetric wave function for electrons
static void mw_evaluateRatios(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< const VirtualParticleSet > &Vp_list, const RefVector< std::vector< ValueType >> &ratios_list, ComputeType ct=ComputeType::ALL)
batched version of evaluateRatios Note: unlike other mw_ static functions, *this is the batch leader ...
const auto & getSimulationCell() const
get simulation cell
void addComponent(std::unique_ptr< WaveFunctionComponent > &&aterm)
add a WaveFunctionComponent
static void mw_evaluateLog(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list)
batched version of evaluateLog.
Declaration of ParticleSetPool.