Coverage for gpaw/test/hubbard/test_hubbard_U_Zn.py: 100%
21 statements
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-19 00:19 +0000
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-19 00:19 +0000
1import pytest
2from ase import Atoms
3from gpaw import GPAW, FermiDirac
4from gpaw.utilities.adjust_cell import adjust_cell
7def test_Hubbard_U_Zn():
8 h = .35
9 box = 3.
10 energy_tolerance = 0.0004
12 s = Atoms('Zn')
13 adjust_cell(s, box, h=h)
15 E = {}
16 E_U = {}
17 for spin in [0, 1]:
18 params = dict(h=h,
19 spinpol=spin,
20 mode='lcao',
21 basis='sz(dzp)',
22 parallel=dict(kpt=1),
23 charge=1,
24 occupations=FermiDirac(width=0.1, fixmagmom=spin))
25 s.calc = GPAW(**params)
26 E[spin] = s.get_potential_energy()
27 s.calc = GPAW(**params, setups=':d,3.0,1')
28 E_U[spin] = s.get_potential_energy()
30 assert E[0] == pytest.approx(E[1], abs=energy_tolerance)
31 assert E_U[0] == pytest.approx(E_U[1], abs=energy_tolerance)
32 assert E_U[0] - E[0] == pytest.approx(-0.167, abs=0.002)