Coverage for gpaw/test/generic/test_si_primitive.py: 100%
14 statements
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-09 00:21 +0000
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-09 00:21 +0000
1import pytest
2from ase.build import bulk
3from gpaw import GPAW
6def test_generic_si_primitive(in_tmp_dir):
7 a = 5.475
8 calc = GPAW(mode={'name': 'pw', 'ecut': 200},
9 kpts=(4, 4, 4),
10 occupations={'name': 'tetrahedron-method'},
11 spinpol=True,
12 nbands=5)
13 atoms = bulk('Si', 'diamond', a=a)
14 atoms.calc = calc
15 E = atoms.get_potential_energy()
16 assert E == pytest.approx(-11.8584, abs=0.001)
18 homo, lumo = calc.get_homo_lumo()
19 assert lumo - homo == pytest.approx(1.117, abs=0.002)
21 calc.write('si_primitive.gpw', 'all')
22 calc = GPAW('si_primitive.gpw',
23 parallel={'domain': 1, 'band': 1},
24 txt=None)