Skip to content

Commit

Permalink
Merge pull request #2602 from markdewing/fix_2600
Browse files Browse the repository at this point in the history
Fix test_TrialWaveFunction_He unit test segfault
  • Loading branch information
prckent committed Jul 25, 2020
2 parents 840aa1b + 3145df4 commit 67d7b15
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/QMCWaveFunctions/tests/test_TrialWaveFunction_He.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ namespace qmcplusplus
void setup_He_wavefunction(Communicate* c,
ParticleSet& elec,
ParticleSet& ions,
std::unique_ptr<WaveFunctionFactory>& wff)
std::unique_ptr<WaveFunctionFactory>& wff,
WaveFunctionFactory::PtclPoolType& particle_set_map)
{
std::vector<int> agroup(2);
int nelec = 2;
Expand Down Expand Up @@ -56,7 +57,6 @@ void setup_He_wavefunction(Communicate* c,
tspecies(e_chargeIdx, downIdx) = -1.0;
elec.resetGroups();

WaveFunctionFactory::PtclPoolType particle_set_map;
particle_set_map["e"] = &elec;

ions.setName("ion0");
Expand Down Expand Up @@ -126,7 +126,8 @@ TEST_CASE("TrialWaveFunction flex_evaluateParameterDerivatives", "[wavefunction]
ParticleSet elec;
ParticleSet ions;
std::unique_ptr<WaveFunctionFactory> wff;
setup_He_wavefunction(c, elec, ions, wff);
WaveFunctionFactory::PtclPoolType particle_set_map;
setup_He_wavefunction(c, elec, ions, wff, particle_set_map);
TrialWaveFunction& psi(*(wff->targetPsi));

ions.update();
Expand Down Expand Up @@ -184,6 +185,8 @@ TEST_CASE("TrialWaveFunction flex_evaluateParameterDerivatives", "[wavefunction]

CHECK(dlogpsi2[0] == ValueApprox(dlogpsi_list.getValue(0, 1)));
CHECK(dhpsioverpsi2[0] == ValueApprox(dhpsi_over_psi_list.getValue(0, 1)));

SPOSetBuilderFactory::clear();
}


Expand Down Expand Up @@ -215,10 +218,11 @@ TEST_CASE("TrialWaveFunction flex_evaluateDeltaLogSetup", "[wavefunction]")
ParticleSet elec;
ParticleSet ions;
std::unique_ptr<WaveFunctionFactory> wff;
WaveFunctionFactory::PtclPoolType particle_set_map;
// This He wavefunction has two components
// The orbitals are fixed and have not optimizable parameters.
// The Jastrow factor does have an optimizable parameter.
setup_He_wavefunction(c, elec, ions, wff);
setup_He_wavefunction(c, elec, ions, wff, particle_set_map);
TrialWaveFunction& psi(*(wff->targetPsi));
ions.update();
elec.update();
Expand All @@ -229,7 +233,6 @@ TEST_CASE("TrialWaveFunction flex_evaluateDeltaLogSetup", "[wavefunction]")

TrialWaveFunction psi2(c);
WaveFunctionComponent* orb1 = psi.getOrbitals()[0]->makeClone(elec2);

psi2.addComponent(orb1, "orb1");
WaveFunctionComponent* orb2 = psi.getOrbitals()[1]->makeClone(elec2);
psi2.addComponent(orb2, "orb2");
Expand Down Expand Up @@ -364,6 +367,8 @@ TEST_CASE("TrialWaveFunction flex_evaluateDeltaLogSetup", "[wavefunction]")
CHECK(fixedG2[1][0] == ValueApprox(fixedG_list2[1].get()[1][0]));
CHECK(fixedG2[1][1] == ValueApprox(fixedG_list2[1].get()[1][1]));
CHECK(fixedG2[1][2] == ValueApprox(fixedG_list2[1].get()[1][2]));

SPOSetBuilderFactory::clear();
}


Expand Down

0 comments on commit 67d7b15

Please sign in to comment.