Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the position specification in tests more compact #4559

Merged
merged 2 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions src/QMCWaveFunctions/tests/test_DiracDeterminant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,25 +480,13 @@ void test_DiracDeterminant_spinor_update(const DetMatInvertor inverter_kind)
ions_.setName("ion");
ions_.create({2});

ions_.R[0][0] = 0.00000000;
ions_.R[0][1] = 0.00000000;
ions_.R[0][2] = 1.08659253;
ions_.R[1][0] = 0.00000000;
ions_.R[1][1] = 0.00000000;
ions_.R[1][2] = -1.08659253;

ions_.R[0] = {0.00000000, 0.00000000, 1.08659253};
ions_.R[1] = {0.00000000, 0.00000000, -1.08659253};
elec_.setName("elec");
elec_.create({3});
elec_.R[0][0] = 0.1;
elec_.R[0][1] = -0.3;
elec_.R[0][2] = 1.0;
elec_.R[1][0] = -0.1;
elec_.R[1][1] = 0.3;
elec_.R[1][2] = 1.0;
elec_.R[2][0] = 0.1;
elec_.R[2][1] = 0.2;
elec_.R[2][2] = 0.3;

elec_.R[0] = {0.1, -0.3, 1.0};
elec_.R[1] = {-0.1, 0.3, 1.0};
elec_.R[2] = {0.1, 0.2, 0.3};
elec_.spins[0] = 0.0;
elec_.spins[1] = 0.2;
elec_.spins[2] = 0.4;
Expand Down
14 changes: 3 additions & 11 deletions src/QMCWaveFunctions/tests/test_J1_bspline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ void test_J1_spline(const DynamicCoordinateKind kind_selected)

ions_.setName("ion");
ions_.create({1});
ions_.R[0][0] = 2.0;
ions_.R[0][1] = 0.0;
ions_.R[0][2] = 0.0;

ions_.R[0] = {2.0, 0.0, 0.0};
SpeciesSet& ispecies = ions_.getSpeciesSet();
int CIdx = ispecies.addSpecies("C");
int ichargeIdx = ispecies.addAttribute("charge");
Expand All @@ -81,13 +78,8 @@ void test_J1_spline(const DynamicCoordinateKind kind_selected)

elec_.setName("elec");
elec_.create({1, 1});
elec_.R[0][0] = 1.00;
elec_.R[0][1] = 0.0;
elec_.R[0][2] = 0.0;
elec_.R[1][0] = 0.0;
elec_.R[1][1] = 0.0;
elec_.R[1][2] = 0.0;

elec_.R[0] = {1.00, 0.0, 0.0};
elec_.R[1] = {0.0, 0.0, 0.0};
SpeciesSet& tspecies = elec_.getSpeciesSet();
int upIdx = tspecies.addSpecies("u");
int downIdx = tspecies.addSpecies("d");
Expand Down
14 changes: 3 additions & 11 deletions src/QMCWaveFunctions/tests/test_J2_bspline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,11 @@ TEST_CASE("BSpline builder Jastrow J2", "[wavefunction]")

ions_.setName("ion");
ions_.create({1});
ions_.R[0][0] = 2.0;
ions_.R[0][1] = 0.0;
ions_.R[0][2] = 0.0;

ions_.R[0] = {2.0, 0.0, 0.0};
elec_.setName("elec");
elec_.create({1, 1});
elec_.R[0][0] = 1.00;
elec_.R[0][1] = 0.0;
elec_.R[0][2] = 0.0;
elec_.R[1][0] = 0.0;
elec_.R[1][1] = 0.0;
elec_.R[1][2] = 0.0;

elec_.R[0] = {1.00, 0.0, 0.0};
elec_.R[1] = {0.0, 0.0, 0.0};
SpeciesSet& tspecies = elec_.getSpeciesSet();
int upIdx = tspecies.addSpecies("u");
int downIdx = tspecies.addSpecies("d");
Expand Down
18 changes: 4 additions & 14 deletions src/QMCWaveFunctions/tests/test_J2_derivatives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,22 +293,12 @@ TEST_CASE("TwoBodyJastrow Jastrow three particles of three types", "[wavefunctio

ions.setName("ion");
ions.create({1});
ions.R[0][0] = 0.0;
ions.R[0][1] = 0.0;
ions.R[0][2] = 0.0;

ions.R[0] = {0.0, 0.0, 0.0};
elec.setName("elec");
elec.create({1, 1, 1});
elec.R[0][0] = -0.28;
elec.R[0][1] = 0.0225;
elec.R[0][2] = -2.709;
elec.R[1][0] = -1.08389;
elec.R[1][1] = 1.9679;
elec.R[1][2] = -0.0128914;
elec.R[2][0] = -2.08389;
elec.R[2][1] = 0.9679;
elec.R[2][2] = 0.0128914;

elec.R[0] = {-0.28, 0.0225, -2.709};
elec.R[1] = {-1.08389, 1.9679, -0.0128914};
elec.R[2] = {-2.08389, 0.9679, 0.0128914};
TwoBodyJastrow<FakeJasFunctor> jorb("J2_fake", elec, false);

// 0 uu (0,0)
Expand Down
12 changes: 3 additions & 9 deletions src/QMCWaveFunctions/tests/test_MO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,7 @@ void test_EtOH_mw(bool transform)
//std::cout << elec.R[0] << std::endl;
//elec.makeMove(0, newpos);
//elec.update();
elec.R[0][0] = 0.0001;
elec.R[0][1] = 0.0;
elec.R[0][2] = 0.0;
elec.R[0] = {0.0001, 0.0, 0.0};
elec.update();
std::cout << elec.R[0] << std::endl;
// set up second walkers
Expand All @@ -381,9 +379,7 @@ void test_EtOH_mw(bool transform)

//ParticleSet::SingleParticlePos newpos2(0.0, 0.04, 0.02);
//elec.makeMove(1, newpos2);
elec.R[1][0] = 0.0;
elec.R[1][1] = 0.04;
elec.R[1][2] = 0.02;
elec.R[1] = {0.0, 0.04, 0.02};
elec.update();
SPOSet::ValueVector psiref_1(n_mo);
SPOSet::GradVector dpsiref_1(n_mo);
Expand Down Expand Up @@ -486,9 +482,7 @@ void test_Ne(bool transform)
auto& ions(*ions_ptr);
ions.setName("ion0");
ions.create({1});
ions.R[0][0] = 0.0;
ions.R[0][1] = 0.0;
ions.R[0][2] = 0.0;
ions.R[0] = {0.0, 0.0, 0.0};
SpeciesSet& ispecies = ions.getSpeciesSet();
int heIdx = ispecies.addSpecies("Ne");
ions.update();
Expand Down
36 changes: 9 additions & 27 deletions src/QMCWaveFunctions/tests/test_MO_spinor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,15 @@ void test_lcao_spinor()
ptcl.addParticleSet(std::move(ions_uptr));
ions_.create({1});

ions_.R[0][0] = 0.00000000;
ions_.R[0][1] = 0.00000000;
ions_.R[0][2] = 0.00000000;
ions_.R[0] = {0.00000000, 0.00000000, 0.00000000};
SpeciesSet& ispecies = ions_.getSpeciesSet();
int hIdx = ispecies.addSpecies("H");
ions_.update();

elec_.setName("elec");
ptcl.addParticleSet(std::move(elec_uptr));
elec_.create({1});
elec_.R[0][0] = 0.1;
elec_.R[0][1] = -0.3;
elec_.R[0][2] = 1.7;
elec_.R[0] = {0.1, -0.3, 1.7};
elec_.spins[0] = 0.6;
elec_.setSpinor(true);

Expand Down Expand Up @@ -227,9 +223,7 @@ void test_lcao_spinor()

//now create second walker
ParticleSet elec_2(elec_);
elec_2.R[0][0] = -0.4;
elec_2.R[0][1] = 1.5;
elec_2.R[0][2] = -0.2;
elec_2.R[0] = {-0.4, 1.5, -0.2};
elec_2.spins[0] = -1.3;

//create new reference values for new positions
Expand Down Expand Up @@ -373,19 +367,15 @@ void test_lcao_spinor_excited()
ptcl.addParticleSet(std::move(ions_uptr));
ions_.create({1});

ions_.R[0][0] = 0.00000000;
ions_.R[0][1] = 0.00000000;
ions_.R[0][2] = 0.00000000;
ions_.R[0] = {0.00000000, 0.00000000, 0.00000000};
SpeciesSet& ispecies = ions_.getSpeciesSet();
int hIdx = ispecies.addSpecies("H");
ions_.update();

elec_.setName("elec");
ptcl.addParticleSet(std::move(elec_uptr));
elec_.create({1});
elec_.R[0][0] = 0.1;
elec_.R[0][1] = -0.3;
elec_.R[0][2] = 1.7;
elec_.R[0] = {0.1, -0.3, 1.7};
elec_.spins[0] = 0.6;
elec_.setSpinor(true);

Expand Down Expand Up @@ -562,9 +552,7 @@ void test_lcao_spinor_excited()

//now create second walker
ParticleSet elec_2(elec_);
elec_2.R[0][0] = -0.4;
elec_2.R[0][1] = 1.5;
elec_2.R[0][2] = -0.2;
elec_2.R[0] = {-0.4, 1.5, -0.2};
elec_2.spins[0] = -1.3;

//create new reference values for new positions
Expand Down Expand Up @@ -702,22 +690,16 @@ void test_lcao_spinor_ion_derivs()
ptcl.addParticleSet(std::move(ions_uptr));
ions_.create({2});

ions_.R[0][0] = 0.10000000;
ions_.R[0][1] = 0.20000000;
ions_.R[0][2] = 0.30000000;
ions_.R[1][0] = -0.30000000;
ions_.R[1][1] = -0.20000000;
ions_.R[1][2] = -0.10000000;
ions_.R[0] = {0.10000000, 0.20000000, 0.30000000};
ions_.R[1] = {-0.30000000, -0.20000000, -0.10000000};
SpeciesSet& ispecies = ions_.getSpeciesSet();
int hIdx = ispecies.addSpecies("H");
ions_.update();

elec_.setName("elec");
ptcl.addParticleSet(std::move(elec_uptr));
elec_.create({1});
elec_.R[0][0] = 0.01;
elec_.R[0][1] = -0.02;
elec_.R[0][2] = 0.03;
elec_.R[0] = {0.01, -0.02, 0.03};
elec_.spins[0] = 0.6;
elec_.setSpinor(true);

Expand Down
19 changes: 4 additions & 15 deletions src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,13 @@ TEST_CASE("RotatedSPOs via SplineR2R", "[wavefunction]")
ions_.setName("ion");
ptcl.addParticleSet(std::move(ions_uptr));
ions_.create({2});
ions_.R[0][0] = 0.0;
ions_.R[0][1] = 0.0;
ions_.R[0][2] = 0.0;
ions_.R[1][0] = 1.68658058;
ions_.R[1][1] = 1.68658058;
ions_.R[1][2] = 1.68658058;


ions_.R[0] = {0.0, 0.0, 0.0};
ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
elec_.setName("elec");
ptcl.addParticleSet(std::move(elec_uptr));
elec_.create({2});
elec_.R[0][0] = 0.0;
elec_.R[0][1] = 0.0;
elec_.R[0][2] = 0.0;
elec_.R[1][0] = 0.0;
elec_.R[1][1] = 1.0;
elec_.R[1][2] = 0.0;

elec_.R[0] = {0.0, 0.0, 0.0};
elec_.R[1] = {0.0, 1.0, 0.0};
SpeciesSet& tspecies = elec_.getSpeciesSet();
int upIdx = tspecies.addSpecies("u");
int chargeIdx = tspecies.addAttribute("charge");
Expand Down
14 changes: 3 additions & 11 deletions src/QMCWaveFunctions/tests/test_TrialWaveFunction_He.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,8 @@ std::unique_ptr<TrialWaveFunction> setup_He_wavefunction(Communicate* c,
agroup[0] = 1;
agroup[1] = 1;
elec.create(agroup);
elec.R[0][0] = 1.0;
elec.R[0][1] = 2.0;
elec.R[0][2] = 3.0;
elec.R[1][0] = 1.0;
elec.R[1][1] = 2.1;
elec.R[1][2] = 2.2;

elec.R[0] = {1.0, 2.0, 3.0};
elec.R[1] = {1.0, 2.1, 2.2};
SpeciesSet& tspecies = elec.getSpeciesSet();
int upIdx = tspecies.addSpecies("u");
int downIdx = tspecies.addSpecies("d");
Expand All @@ -58,10 +53,7 @@ std::unique_ptr<TrialWaveFunction> setup_He_wavefunction(Communicate* c,
elec.resetGroups();

ions.create({1});
ions.R[0][0] = 0.0;
ions.R[0][1] = 0.0;
ions.R[0][2] = 0.0;

ions.R[0] = {0.0, 0.0, 0.0};
SpeciesSet& he_species = ions.getSpeciesSet();
int He_Idx = he_species.addSpecies("He");
int chargeIdx = he_species.addAttribute("charge");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,10 @@ void testTrialWaveFunction_diamondC_2x1x1(const int ndelay, const OffloadSwitche
ions_.setName("ion");
ptcl.addParticleSet(std::move(ions_uptr));
ions_.create({4});
ions_.R[0][0] = 0.0;
ions_.R[0][1] = 0.0;
ions_.R[0][2] = 0.0;
ions_.R[1][0] = 1.68658058;
ions_.R[1][1] = 1.68658058;
ions_.R[1][2] = 1.68658058;
ions_.R[2][0] = 3.37316115;
ions_.R[2][1] = 3.37316115;
ions_.R[2][2] = 0.0;
ions_.R[3][0] = 5.05974173;
ions_.R[3][1] = 5.05974173;
ions_.R[3][2] = 1.68658058;
ions_.R[0] = {0.0, 0.0, 0.0};
ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
ions_.R[2] = {3.37316115, 3.37316115, 0.0};
ions_.R[3] = {5.05974173, 5.05974173, 1.68658058};
ions_.update();


Expand Down
4 changes: 1 addition & 3 deletions src/QMCWaveFunctions/tests/test_einset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,7 @@ TEST_CASE("Einspline SPO from HDF diamond_1x1x1", "[wavefunction]")
double x = 0.1*ix - 1.5;
double y = 0.1*iy - 1.5;
double z = 0.1*iz - 1.5;
elec_.R[0][0] = x;
elec_.R[0][1] = y;
elec_.R[0][2] = z;
elec_.R[0] = {x, y, z};
elec_.update();
SPOSet::ValueVector orbs(orbSize);
spo->evaluate(elec_, 0, orbs);
Expand Down
22 changes: 5 additions & 17 deletions src/QMCWaveFunctions/tests/test_einset_spinor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,14 @@ TEST_CASE("Einspline SpinorSet from HDF", "[wavefunction]")
ptcl.addParticleSet(std::move(ions_uptr));
ions_.create({2});

ions_.R[0][0] = 0.00000000;
ions_.R[0][1] = 0.00000000;
ions_.R[0][2] = 1.08659253;
ions_.R[1][0] = 0.00000000;
ions_.R[1][1] = 0.00000000;
ions_.R[1][2] = -1.08659253;

ions_.R[0] = {0.00000000, 0.00000000, 1.08659253};
ions_.R[1] = {0.00000000, 0.00000000, -1.08659253};
elec_.setName("elec");
ptcl.addParticleSet(std::move(elec_uptr));
elec_.create({3});
elec_.R[0][0] = 0.1;
elec_.R[0][1] = -0.3;
elec_.R[0][2] = 1.0;
elec_.R[1][0] = -0.1;
elec_.R[1][1] = 0.3;
elec_.R[1][2] = 1.0;
elec_.R[2][0] = 0.1;
elec_.R[2][1] = 0.2;
elec_.R[2][2] = 0.3;

elec_.R[0] = {0.1, -0.3, 1.0};
elec_.R[1] = {-0.1, 0.3, 1.0};
elec_.R[2] = {0.1, 0.2, 0.3};
elec_.spins[0] = 0.0;
elec_.spins[1] = 0.2;
elec_.spins[2] = 0.4;
Expand Down
14 changes: 3 additions & 11 deletions src/QMCWaveFunctions/tests/test_example_he.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,8 @@ TEST_CASE("ExampleHe", "[wavefunction]")
agroup[0] = nelec;
elec.setName("e");
elec.create(agroup);
elec.R[0][0] = 1.0;
elec.R[0][1] = 2.0;
elec.R[0][2] = 3.0;
elec.R[1][0] = 0.0;
elec.R[1][1] = 1.1;
elec.R[1][2] = 2.2;

elec.R[0] = {1.0, 2.0, 3.0};
elec.R[1] = {0.0, 1.1, 2.2};
SpeciesSet& tspecies = elec.getSpeciesSet();
int upIdx = tspecies.addSpecies("u");
int downIdx = tspecies.addSpecies("d");
Expand All @@ -60,10 +55,7 @@ TEST_CASE("ExampleHe", "[wavefunction]")

ions.setName("ion0");
ions.create({1});
ions.R[0][0] = 0.0;
ions.R[0][1] = 0.0;
ions.R[0][2] = 0.0;

ions.R[0] = {0.0, 0.0, 0.0};
SpeciesSet& he_species = ions.getSpeciesSet();
int He_Idx = he_species.addSpecies("He");
int chargeIdx = he_species.addAttribute("charge");
Expand Down
Loading