diff --git a/src/QMCWaveFunctions/tests/FakeSPO.cpp b/src/QMCWaveFunctions/tests/FakeSPO.cpp index 5d572dd7f0..52a1ae02bf 100644 --- a/src/QMCWaveFunctions/tests/FakeSPO.cpp +++ b/src/QMCWaveFunctions/tests/FakeSPO.cpp @@ -15,7 +15,8 @@ namespace qmcplusplus { -FakeSPO::FakeSPO() : SPOSet("one_FakeSPO") +template +FakeSPO::FakeSPO() : SPOSet("one_FakeSPO") { a.resize(3, 3); @@ -78,11 +79,20 @@ FakeSPO::FakeSPO() : SPOSet("one_FakeSPO") gv[3] = TinyVector(0.4, 0.3, 0.1); } -std::unique_ptr FakeSPO::makeClone() const { return std::make_unique(*this); } +template +std::unique_ptr> FakeSPO::makeClone() const +{ + return std::make_unique(*this); +} -void FakeSPO::setOrbitalSetSize(int norbs) { OrbitalSetSize = norbs; } +template +void FakeSPO::setOrbitalSetSize(int norbs) +{ + OrbitalSetSize = norbs; +} -void FakeSPO::evaluateValue(const ParticleSet& P, int iat, ValueVector& psi) +template +void FakeSPO::evaluateValue(const ParticleSet& P, int iat, ValueVector& psi) { if (iat < 0) for (int i = 0; i < psi.size(); i++) @@ -95,7 +105,8 @@ void FakeSPO::evaluateValue(const ParticleSet& P, int iat, ValueVector& psi) psi[i] = a2(iat, i); } -void FakeSPO::evaluateVGL(const ParticleSet& P, int iat, ValueVector& psi, GradVector& dpsi, ValueVector& d2psi) +template +void FakeSPO::evaluateVGL(const ParticleSet& P, int iat, ValueVector& psi, GradVector& dpsi, ValueVector& d2psi) { if (OrbitalSetSize == 3) { @@ -115,12 +126,13 @@ void FakeSPO::evaluateVGL(const ParticleSet& P, int iat, ValueVector& psi, GradV } } -void FakeSPO::evaluate_notranspose(const ParticleSet& P, - int first, - int last, - ValueMatrix& logdet, - GradMatrix& dlogdet, - ValueMatrix& d2logdet) +template +void FakeSPO::evaluate_notranspose(const ParticleSet& P, + int first, + int last, + ValueMatrix& logdet, + GradMatrix& dlogdet, + ValueMatrix& d2logdet) { if (OrbitalSetSize == 3) { @@ -142,4 +154,7 @@ void FakeSPO::evaluate_notranspose(const ParticleSet& P, } } +template class FakeSPO; +template class FakeSPO; + } // namespace qmcplusplus diff --git a/src/QMCWaveFunctions/tests/FakeSPO.h b/src/QMCWaveFunctions/tests/FakeSPO.h index 5f8a328284..c6a8d3c766 100644 --- a/src/QMCWaveFunctions/tests/FakeSPO.h +++ b/src/QMCWaveFunctions/tests/FakeSPO.h @@ -18,15 +18,28 @@ namespace qmcplusplus { -class FakeSPO : public SPOSet +template +class FakeSPO : public SPOSetT { public: + enum + { + DIM = OHMMS_DIM, + }; + using SPOSet = SPOSetT; + using ValueType = typename SPOSet::ValueType; + using GradType = typename SPOSet::GradType; + using ValueVector = typename SPOSet::ValueVector; + using GradVector = typename SPOSet::GradVector; + using ValueMatrix = typename SPOSet::ValueMatrix; + using GradMatrix = typename SPOSet::GradMatrix; + Matrix a; Matrix a2; Vector v; Matrix v2; - SPOSet::GradVector gv; + GradVector gv; FakeSPO(); ~FakeSPO() override {} @@ -47,7 +60,13 @@ class FakeSPO : public SPOSet ValueMatrix& logdet, GradMatrix& dlogdet, ValueMatrix& d2logdet) override; + +private: + using SPOSet::OrbitalSetSize; }; +extern template class FakeSPO; +extern template class FakeSPO; + } // namespace qmcplusplus #endif diff --git a/src/QMCWaveFunctions/tests/test_DiracDeterminant.cpp b/src/QMCWaveFunctions/tests/test_DiracDeterminant.cpp index 7a4de1225a..fa0de4cfeb 100644 --- a/src/QMCWaveFunctions/tests/test_DiracDeterminant.cpp +++ b/src/QMCWaveFunctions/tests/test_DiracDeterminant.cpp @@ -51,11 +51,11 @@ void check_matrix(Matrix& a, Matrix& b) template void test_DiracDeterminant_first(const DetMatInvertor inverter_kind) { - auto spo_init = std::make_unique(); + auto spo_init = std::make_unique>(); const int norb = 3; spo_init->setOrbitalSetSize(norb); DET ddb(std::move(spo_init), 0, norb, 1, inverter_kind); - auto spo = dynamic_cast(ddb.getPhi()); + auto spo = dynamic_cast*>(ddb.getPhi()); // occurs in call to registerData ddb.dpsiV.resize(norb); @@ -159,11 +159,11 @@ TEST_CASE("DiracDeterminant_first", "[wavefunction][fermion]") template void test_DiracDeterminant_second(const DetMatInvertor inverter_kind) { - auto spo_init = std::make_unique(); + auto spo_init = std::make_unique>(); const int norb = 4; spo_init->setOrbitalSetSize(norb); DET ddb(std::move(spo_init), 0, norb, 1, inverter_kind); - auto spo = dynamic_cast(ddb.getPhi()); + auto spo = dynamic_cast*>(ddb.getPhi()); // occurs in call to registerData ddb.dpsiV.resize(norb); @@ -300,12 +300,12 @@ TEST_CASE("DiracDeterminant_second", "[wavefunction][fermion]") template void test_DiracDeterminant_delayed_update(const DetMatInvertor inverter_kind) { - auto spo_init = std::make_unique(); + auto spo_init = std::make_unique>(); const int norb = 4; spo_init->setOrbitalSetSize(norb); // maximum delay 2 DET ddc(std::move(spo_init), 0, norb, 2, inverter_kind); - auto spo = dynamic_cast(ddc.getPhi()); + auto spo = dynamic_cast*>(ddc.getPhi()); // occurs in call to registerData ddc.dpsiV.resize(norb); diff --git a/src/QMCWaveFunctions/tests/test_DiracDeterminantBatched.cpp b/src/QMCWaveFunctions/tests/test_DiracDeterminantBatched.cpp index 4ce591df94..c53130dc38 100644 --- a/src/QMCWaveFunctions/tests/test_DiracDeterminantBatched.cpp +++ b/src/QMCWaveFunctions/tests/test_DiracDeterminantBatched.cpp @@ -37,11 +37,11 @@ template void test_DiracDeterminantBatched_first() { using DetType = DiracDeterminantBatched; - auto spo_init = std::make_unique(); + auto spo_init = std::make_unique>(); const int norb = 3; spo_init->setOrbitalSetSize(norb); DetType ddb(std::move(spo_init), 0, norb); - auto spo = dynamic_cast(ddb.getPhi()); + auto spo = dynamic_cast*>(ddb.getPhi()); // occurs in call to registerData ddb.dpsiV.resize(norb); @@ -141,11 +141,11 @@ template void test_DiracDeterminantBatched_second() { using DetType = DiracDeterminantBatched; - auto spo_init = std::make_unique(); + auto spo_init = std::make_unique>(); const int norb = 4; spo_init->setOrbitalSetSize(norb); DetType ddb(std::move(spo_init), 0, norb); - auto spo = dynamic_cast(ddb.getPhi()); + auto spo = dynamic_cast*>(ddb.getPhi()); // occurs in call to registerData ddb.dpsiV.resize(norb); @@ -277,11 +277,11 @@ template void test_DiracDeterminantBatched_delayed_update(int delay_rank, DetMatInvertor matrix_inverter_kind) { using DetType = DiracDeterminantBatched; - auto spo_init = std::make_unique(); + auto spo_init = std::make_unique>(); const int norb = 4; spo_init->setOrbitalSetSize(norb); DetType ddc(std::move(spo_init), 0, norb, delay_rank, matrix_inverter_kind); - auto spo = dynamic_cast(ddc.getPhi()); + auto spo = dynamic_cast*>(ddc.getPhi()); // occurs in call to registerData ddc.dpsiV.resize(norb); diff --git a/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp b/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp index b3e67d24b5..8b9065badc 100644 --- a/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp +++ b/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp @@ -653,7 +653,7 @@ std::vector>& getHistoryParams(RotatedSPOs& rot // Test using global rotation TEST_CASE("RotatedSPOs read and write parameters", "[wavefunction]") { - auto fake_spo = std::make_unique(); + auto fake_spo = std::make_unique>(); fake_spo->setOrbitalSetSize(4); RotatedSPOs rot("fake_rot", std::move(fake_spo)); int nel = 2; @@ -674,7 +674,7 @@ TEST_CASE("RotatedSPOs read and write parameters", "[wavefunction]") rot.writeVariationalParameters(hout); } - auto fake_spo2 = std::make_unique(); + auto fake_spo2 = std::make_unique>(); fake_spo2->setOrbitalSetSize(4); RotatedSPOs rot2("fake_rot", std::move(fake_spo2)); @@ -705,7 +705,7 @@ TEST_CASE("RotatedSPOs read and write parameters", "[wavefunction]") // Test using history list. TEST_CASE("RotatedSPOs read and write parameters history", "[wavefunction]") { - auto fake_spo = std::make_unique(); + auto fake_spo = std::make_unique>(); fake_spo->setOrbitalSetSize(4); RotatedSPOs rot("fake_rot", std::move(fake_spo)); rot.set_use_global_rotation(false); @@ -727,7 +727,7 @@ TEST_CASE("RotatedSPOs read and write parameters history", "[wavefunction]") rot.writeVariationalParameters(hout); } - auto fake_spo2 = std::make_unique(); + auto fake_spo2 = std::make_unique>(); fake_spo2->setOrbitalSetSize(4); RotatedSPOs rot2("fake_rot", std::move(fake_spo2));