Coverage for gpaw/test/xc/test_lxc_fhc.py: 74%

19 statements  

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

1"""check if fhc can be disabled for libxc >= 7.x.x (needed for mggas).""" 

2import pytest 

3import gpaw.cgpaw as cgpaw 

4from ase.build import molecule 

5from gpaw import GPAW 

6from gpaw.utilities.adjust_cell import adjust_cell 

7 

8vacuum = 4.0 

9h = 0.3 

10 

11 

12@pytest.mark.mgga 

13@pytest.mark.libxc 

14def test_mgga_lxc_fhc(): 

15 libxc_version = getattr(cgpaw, 'libxc_version', '2.x.y') 

16 if int(libxc_version.split('.')[0]) < 7: 

17 from unittest import SkipTest 

18 raise SkipTest 

19 cluster = molecule('CO') 

20 adjust_cell(cluster, border=vacuum, h=h) 

21 calc = GPAW(xc='MGGA_X_TPSS+MGGA_C_TPSS', 

22 mode='fd', 

23 h=h, 

24 maxiter=14, 

25 convergence={ 

26 'energy': 0.5, 

27 'density': 1.0e-1, 

28 'eigenstates': 4.0e-1}) 

29 cluster.calc = calc 

30 cluster.get_potential_energy()