From 9ab7ae8f072354b8bb7520b3a498e08b4ecbcf2b Mon Sep 17 00:00:00 2001 From: Nico Date: Tue, 28 Nov 2023 15:28:12 +0100 Subject: [PATCH] gradient no backflow --- tests/wavefunction/base_test_cases.py | 7 ++++++- .../jastrows/elec_elec/base_elec_elec_jastrow_test.py | 7 ++++++- tests/wavefunction/orbitals/base_test_ao.py | 6 +++++- tests/wavefunction/test_slater_mgcn_graph_jastrow.py | 4 ++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/tests/wavefunction/base_test_cases.py b/tests/wavefunction/base_test_cases.py index 5f7d39b3..3a62bc19 100644 --- a/tests/wavefunction/base_test_cases.py +++ b/tests/wavefunction/base_test_cases.py @@ -34,8 +34,13 @@ class WaveFunctionBaseTest(unittest.TestCase): def setUp(self): """Init the base test""" + + def wf_placeholder(pos): + """Callable for wf""" + return None + self.pos = None - self.wf = None + self.wf = wf_placeholder self.nbatch = None def test_forward(self): diff --git a/tests/wavefunction/jastrows/elec_elec/base_elec_elec_jastrow_test.py b/tests/wavefunction/jastrows/elec_elec/base_elec_elec_jastrow_test.py index 9d96445f..58709350 100644 --- a/tests/wavefunction/jastrows/elec_elec/base_elec_elec_jastrow_test.py +++ b/tests/wavefunction/jastrows/elec_elec/base_elec_elec_jastrow_test.py @@ -34,7 +34,12 @@ class ElecElecJastrowBaseTest(unittest.TestCase): def setUp(self) -> None: """Init the test case""" - self.jastrow = None + + def jastrow_callable(pos): + """Empty callable for jastrow""" + return None + + self.jastrow = jastrow_callable self.nbatch = None self.pos = None diff --git a/tests/wavefunction/orbitals/base_test_ao.py b/tests/wavefunction/orbitals/base_test_ao.py index dd06a9fc..fa1c9f8f 100644 --- a/tests/wavefunction/orbitals/base_test_ao.py +++ b/tests/wavefunction/orbitals/base_test_ao.py @@ -72,7 +72,11 @@ class BaseTestAO: class BaseTestAOderivatives(unittest.TestCase): def setUp(self): - self.ao = None + + def ao_callable(pos): + """Callable for the AO""" + return None + self.ao = ao_callable self.pos = None def test_ao_deriv(self): diff --git a/tests/wavefunction/test_slater_mgcn_graph_jastrow.py b/tests/wavefunction/test_slater_mgcn_graph_jastrow.py index 6f899ae4..2b29baa8 100644 --- a/tests/wavefunction/test_slater_mgcn_graph_jastrow.py +++ b/tests/wavefunction/test_slater_mgcn_graph_jastrow.py @@ -169,7 +169,7 @@ def test_kinetic_energy(self): def test_gradients_wf(self): - grads = self.wf.gradients_jacobi( + grads = self.wf.gradients_jacobi_no_backflow( self.pos, sum_grad=False).squeeze() grad_auto = self.wf.gradients_autograd(self.pos) @@ -181,7 +181,7 @@ def test_gradients_wf(self): def test_gradients_pdf(self): - grads_pdf = self.wf.gradients_jacobi(self.pos, pdf=True) + grads_pdf = self.wf.gradients_jacobi_no_backflow(self.pos, pdf=True) grads_auto = self.wf.gradients_autograd(self.pos, pdf=True) assert torch.allclose(grads_pdf.sum(), grads_auto.sum())