Coverage for gpaw/test/ralda/test_ralda_H2.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.7.1, created at 2025-07-08 00:17 +0000

1import pytest 

2 

3from gpaw.mpi import world 

4from gpaw.xc.fxc import FXCCorrelation 

5 

6 

7@pytest.mark.rpa 

8@pytest.mark.response 

9@pytest.mark.parametrize('gpw, kwargs, ref_energy, abstol', [ 

10 ('h2_pw280_fulldiag', dict(xc='rALDA', nblocks=min(4, world.size)), 

11 -0.8509, 1e-3), 

12 ('h2_pw280_fulldiag', dict(xc='rAPBE'), -0.74555, 1e-3), 

13 ('h_pw280_fulldiag', dict(xc='rALDA'), 0.002757, 1e-4), 

14 ('h_pw280_fulldiag', dict(xc='rAPBE', nblocks=min(4, world.size)), 

15 0.01365, 1e-4)]) 

16def test_ralda_energy_H2(in_tmp_dir, gpw_files, scalapack, gpw, 

17 kwargs, 

18 ref_energy, abstol): 

19 gpw = gpw_files[gpw] 

20 fxc = FXCCorrelation(gpw, **kwargs, ecut=[200]) 

21 

22 energy = fxc.calculate() 

23 assert energy == pytest.approx(ref_energy, abs=abstol)