Coverage for gpaw/test/pipekmezey/test_pm_lcao_hirshfeld.py: 100%

15 statements  

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

1import pytest 

2from ase import Atoms 

3from gpaw import GPAW 

4from gpaw.pipekmezey.pipek_mezey_wannier import PipekMezey 

5 

6 

7@pytest.mark.pipekmezey 

8def test_pipekmezey_lcao_hirshfeld(in_tmp_dir): 

9 

10 atoms = Atoms('CO', 

11 positions=[[0, 0, 0], 

12 [0, 0, 1.128]]) 

13 atoms.center(vacuum=5) 

14 

15 calc = GPAW(mode='lcao', 

16 h=0.24, 

17 convergence={'density': 1e-4}) 

18 

19 calc.atoms = atoms 

20 calc.calculate() 

21 

22 PM = PipekMezey(calc=calc, 

23 method='H', 

24 seed=42) 

25 PM.localize() 

26 

27 P = PM.get_function_value() 

28 

29 assert P == pytest.approx(3.3263, abs=0.0001)