Coverage for gpaw/test/vdw/test_H_Hirshfeld.py: 100%
19 statements
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-20 00:19 +0000
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-20 00:19 +0000
1"""Test Hirshfeld for spin/no spin consistency."""
2import pytest
3from ase import Atoms
4from ase.parallel import parprint
6from gpaw import GPAW, FermiDirac
7from gpaw.analyse.hirshfeld import HirshfeldPartitioning
10@pytest.mark.old_gpaw_only
11def test_vdw_H_Hirshfeld():
12 h = 0.25
13 box = 3
15 atoms = Atoms('H')
16 atoms.center(vacuum=box)
18 volumes = []
19 for spinpol in [False, True]:
20 calc = GPAW(mode='fd',
21 h=h,
22 occupations=FermiDirac(0.1, fixmagmom=spinpol),
23 spinpol=spinpol)
24 calc.calculate(atoms)
25 vol = HirshfeldPartitioning(calc).get_effective_volume_ratios()
26 volumes.append(vol)
27 parprint(volumes)
28 assert volumes[0][0] == pytest.approx(volumes[1][0], abs=4e-9)