Coverage for gpaw/test/pathological/test_LDA_unstable.py: 100%

15 statements  

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

1# listserv.fysik.dtu.dk/pipermail/gpaw-developers/2014-February/004374.html 

2from gpaw import GPAW 

3import pytest 

4from ase.build import molecule 

5 

6 

7def test_pathological_LDA_unstable(): 

8 for i in range(12): 

9 mol = molecule('H2') 

10 mol.center(vacuum=1.5) 

11 calc = GPAW(h=0.3, nbands=2, mode='lcao', txt=None, basis='sz(dzp)', 

12 xc='oldLDA', 

13 convergence={'maximum iterations': 1}) 

14 mol.calc = calc 

15 e = mol.get_potential_energy() 

16 if i == 0: 

17 eref = e 

18 if calc.wfs.world.rank == 0: 

19 print(repr(e)) 

20 assert e - eref == pytest.approx(0, abs=1.e-12)