50 template<
class DiracDet,
class SPO_precision>
53 #if defined(MIXED_PRECISION) 54 const double grad_precision = 1.3e-4;
55 const double ratio_precision = 2
e-4;
57 const double grad_precision = std::is_same<SPO_precision, float_tag>::value ? 1.3e-4 : 1
e-8;
58 const double ratio_precision = std::is_same<SPO_precision, float_tag>::value ? 2
e-4 : 1
e-5;
67 lattice.R = {6.7463223, 6.7463223, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
73 auto ions_uptr = std::make_unique<ParticleSet>(ptcl.
getSimulationCell(), kind_selected);
74 auto elec_uptr = std::make_unique<ParticleSet>(ptcl.
getSimulationCell(), kind_selected);
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};
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};
100 tspecies(chargeIdx, upIdx) = -1;
101 tspecies(chargeIdx, downIdx) = -1;
103 const int ei_table_index = elec_.
addTable(ions_);
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"/> \ 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"/> \ 117 #ifndef MIXED_PRECISION 118 if (std::is_same<SPO_precision, double_tag>::value)
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");
129 xmlNodePtr ein1 = xmlFirstElementChild(spo_root);
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));
141 auto slater_det = std::make_unique<SlaterDet>(elec_, std::move(dets));
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> 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> 168 xmlNodePtr jas1 = xmlFirstElementChild(jas_root); 179 #if defined(QMC_COMPLEX) 180 CHECK(logpsi == Approx(-4.546410485374186));
182 CHECK(logpsi == Approx(-5.932711221043984));
185 auto logpsi_cplx = psi.
evaluateGL(elec_,
false);
186 #if defined(QMC_COMPLEX) 193 #if defined(QMC_COMPLEX) 200 std::unique_ptr<TrialWaveFunction> psi_clone(psi.
makeClone(elec_clone));
203 double logpsi_clone = psi_clone->evaluateLog(elec_clone);
204 #if defined(QMC_COMPLEX) 205 CHECK(logpsi_clone == Approx(-4.546410485374186));
207 CHECK(logpsi_clone == Approx(-5.932711221043984));
210 const int moved_elec_id = 0;
217 elec_.makeMove(moved_elec_id, delta);
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(2
e-5));
228 CHECK(r_fermionic_val == ComplexApprox(std::complex<RealType>(0.1362181543980086, 0)).epsilon(2
e-5));
230 CHECK(r_all_val == Approx(0.1248738460469678));
231 CHECK(r_fermionic_val == ValueApprox(0.1362181543982075));
233 CHECK(r_bosonic_val == ValueApprox(0.9167195562048454));
236 elec_.acceptMove(moved_elec_id);
239 #if defined(QMC_COMPLEX) 247 #if defined(QMC_COMPLEX) 257 elec_.createResource(pset_res);
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)));
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)));
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);
297 #if defined(QMC_COMPLEX) 299 ComplexApprox(
ValueType(713.71203320653, 0.020838031926441)).epsilon(grad_precision));
301 ComplexApprox(
ValueType(713.71203320654, 0.020838031928415)).epsilon(grad_precision));
303 ComplexApprox(
ValueType(-768.42842826889, -0.020838032018344)).epsilon(grad_precision));
305 ComplexApprox(
ValueType(118.02653358655, -0.0022419843505538)).epsilon(grad_precision));
307 ComplexApprox(
ValueType(118.02653358655, -0.0022419843498631)).epsilon(grad_precision));
309 ComplexApprox(
ValueType(-118.46325895634, 0.0022419843493758)).epsilon(grad_precision));
318 PosType delta_sign_changed(0.1, 0.1, -0.2);
319 std::vector<PosType> displs{delta_sign_changed, delta_sign_changed};
324 ValueType r_0 = wf_ref_list[0].calcRatio(p_ref_list[0], moved_elec_id);
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(1
e-4));
331 CHECK(r_1 == ComplexApprox(
ValueType(36.915636007059, -6.4240180082292
e-05)).epsilon(1
e-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)));
336 CHECK(r_0 == Approx(253.71904054638).epsilon(2
e-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));
345 displs = {delta_zero, delta};
348 std::vector<PsiValue> ratios(2);
350 app_log() <<
"mixed move calcRatio " << std::setprecision(14) << ratios[0] <<
" " << ratios[1] << std::endl;
352 #if defined(QMC_COMPLEX) 354 CHECK(ratios[1] == ComplexApprox(
PsiValue(0.12487384604679, 0)).epsilon(5
e-5));
356 CHECK(ratios[0] == Approx(1).epsilon(5
e-5));
357 #if defined(MIXED_PRECISION) 358 CHECK(ratios[1] == Approx(0.12487384604697).epsilon(5
e-5));
360 CHECK(ratios[1] == Approx(0.12487384604697));
364 std::fill(ratios.begin(), ratios.end(), 0);
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]);
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;
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) 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(5
e-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));
400 CHECK(ratios[0] == Approx(1).epsilon(5
e-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(5
e-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));
410 std::vector<bool> isAccepted(2,
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)));
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)));
430 const int moved_elec_id_next = 1;
436 #if defined(QMC_COMPLEX) 438 ComplexApprox(
ValueType(-114.82740072726, -7.605305979232
e-05)).epsilon(grad_precision));
440 ComplexApprox(
ValueType(-93.980772428401, -7.605302517238
e-05)).epsilon(grad_precision));
442 ComplexApprox(
ValueType(64.050803536571, 7.6052975324197
e-05)).epsilon(grad_precision));
444 ComplexApprox(
ValueType(-114.82740072726, -7.605305979232
e-05)).epsilon(grad_precision));
446 ComplexApprox(
ValueType(-93.980772428401, -7.605302517238
e-05)).epsilon(grad_precision));
448 ComplexApprox(
ValueType(64.050803536571, 7.6052975324197
e-05)).epsilon(grad_precision));
458 std::vector<PosType> displ(2);
459 displ[0] = displ[1] = {0.1, 0.2, 0.3};
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.4375146770852
e-05)).epsilon(8
e-5));
470 CHECK(grad_new.grads_positions[0][1] ==
471 ComplexApprox(
ValueType(6.3111018321898, -1.4375146510386
e-05)).epsilon(8
e-5));
472 CHECK(grad_new.grads_positions[0][2] ==
473 ComplexApprox(
ValueType(-3.2027658046121, 1.4375146020225
e-05)).epsilon(8
e-5));
474 CHECK(grad_new.grads_positions[1][0] ==
475 ComplexApprox(
ValueType(9.6073058494562, -1.4375146770852
e-05)).epsilon(8
e-5));
476 CHECK(grad_new.grads_positions[1][1] ==
477 ComplexApprox(
ValueType(6.3111018321898, -1.4375146510386
e-05)).epsilon(8
e-5));
478 CHECK(grad_new.grads_positions[1][2] ==
479 ComplexApprox(
ValueType(-3.2027658046121, 1.4375146020225
e-05)).epsilon(8
e-5));
481 CHECK(grad_new.grads_positions[0][0] == Approx(9.607320224603).epsilon(1
e-4));
482 CHECK(grad_new.grads_positions[0][1] == Approx(6.3111162073363).epsilon(1
e-4));
483 CHECK(grad_new.grads_positions[0][2] == Approx(-3.2027801797581).epsilon(1
e-4));
484 CHECK(grad_new.grads_positions[1][0] == Approx(9.607320224603).epsilon(1
e-4));
485 CHECK(grad_new.grads_positions[1][1] == Approx(6.3111162073363).epsilon(1
e-4));
486 CHECK(grad_new.grads_positions[1][2] == Approx(-3.2027801797581).epsilon(1
e-4));
489 isAccepted[0] =
true;
490 isAccepted[1] =
false;
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]
500 #if defined(QMC_COMPLEX) 501 CHECK(det_up->getPsiMinv()[0][0] == ComplexApprox(
ValueType(38.503358805635, -38.503358805645)).epsilon(1
e-4));
502 CHECK(det_up->getPsiMinv()[0][1] == ComplexApprox(
ValueType(-31.465077529568, 31.465077529576)).epsilon(1
e-4));
503 CHECK(det_up->getPsiMinv()[1][0] == ComplexApprox(
ValueType(-27.188228530061, 27.188228530068)).epsilon(1
e-4));
504 CHECK(det_up->getPsiMinv()[1][1] == ComplexApprox(
ValueType(22.759962501254, -22.75996250126)).epsilon(1
e-4));
506 CHECK(det_up->getPsiMinv()[0][0] == Approx(77.0067176113).epsilon(1
e-4));
507 CHECK(det_up->getPsiMinv()[0][1] == Approx(-62.9301550592).epsilon(1
e-4));
508 CHECK(det_up->getPsiMinv()[1][0] == Approx(-54.376457060136).epsilon(1
e-4));
509 CHECK(det_up->getPsiMinv()[1][1] == Approx(45.51992500251).epsilon(1
e-4));
512 std::vector<LogValue>
log_values(wf_ref_list.size());
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) 529 for (
int iw = 0; iw <
log_values.size(); iw++)
537 vp.createResource(vp_res);
540 const auto& ei_table1 = elec_.getDistTableAB(ei_table_index);
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);
545 NLPPJob<RealType> job2(3, 1, ei_table2.getDistances()[1][3], -ei_table2.getDisplacements()[1][3]);
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}};
552 std::vector<ValueType> nlpp1_ratios(nknot), nlpp2_ratios(nknot);
554 {nlpp1_ratios, nlpp2_ratios});
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));
564 TEST_CASE(
"TrialWaveFunction_diamondC_2x1x1",
"[wavefunction]")
569 #if defined(ENABLE_CUDA) && defined(ENABLE_OFFLOAD) 570 SECTION(
"DiracDeterminantBatched<DelayedUpdateBatched<CUDA>>")
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});
578 SECTION(
"DiracDeterminantBatched<DelayedUpdateBatched<CUDA>>_offload_spo")
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});
586 SECTION(
"DiracDeterminantBatched<DelayedUpdateBatched<CUDA>>_offload_jas")
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});
594 SECTION(
"DiracDeterminantBatched<DelayedUpdateBatched<CUDA>>_offload_spo_jas")
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});
605 SECTION(
"DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>")
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});
613 SECTION(
"DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>_offload_spo")
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});
621 SECTION(
"DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>_offload_jas")
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});
629 SECTION(
"DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>_offload_spo_jas")
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});
639 SECTION(
"DiracDeterminant<DelayedUpdate>")
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});
647 SECTION(
"DiracDeterminant<DelayedUpdate>_offload_spo")
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});
655 SECTION(
"DiracDeterminant<DelayedUpdate>_offload_Jas")
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});
663 SECTION(
"DiracDeterminant<DelayedUpdate>_offload_spo_jas")
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});
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)
WaveFunctionComponent::PsiValue PsiValue
void setSimulationCell(const SimulationCell &simulation_cell)
set simulation cell
class that handles xmlDoc
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
int addSpecies(const std::string &aname)
When a name species does not exist, add a new species.
helper functions for EinsplineSetBuilder
WaveFunctionComponent::GradType GradType
void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to a collection
QTBase::RealType RealType
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
TEST_CASE("complex_helper", "[type_traits]")
std::unique_ptr< WaveFunctionComponent > buildComponent(xmlNodePtr cur) override
process a xml node at cur
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...
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.
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 ...
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.
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.
std::vector< QMCTraits::GradType > grads_positions
QTBase::ValueType ValueType
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
RealType getLogPsi() const
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
void create(const std::vector< int > &agroup)
create grouped particles
Declaration of a TrialWaveFunction.
RealType getPhase() const
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)
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.
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.