Coverage for gpaw/test/lcao/test_single_h_atom.py: 100%

10 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 

4 

5 

6def test_h_atom(in_tmp_dir): 

7 """Test lcao with magmom.""" 

8 h = Atoms('H', magmoms=[0.1]) 

9 h.center(vacuum=2) 

10 h.calc = GPAW(txt='h.txt', 

11 mode='lcao', 

12 basis='dz(dzp)', 

13 h=0.2, 

14 nbands=2) 

15 eref = -13.02531 - (-12.128958) # lda spin-polarized - lda spin-paired 

16 assert h.get_potential_energy() == pytest.approx(eref, abs=0.12) 

17 assert h.get_magnetic_moment() == pytest.approx(1.0, abs=1e-4)