Coverage for gpaw/test/response/test_hubbard.py: 92%
13 statements
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-14 00:18 +0000
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-14 00:18 +0000
1import numpy as np
2import pytest
4from gpaw.mpi import world
5from gpaw.response.g0w0 import G0W0
7reference_kn = [[0.69806561, 2.58472004, 2.58472066,
8 2.58469313, 3.60859825, 3.60859883],
9 [0.87642735, 1.02930988, 4.52049808,
10 4.85337269, 4.85355968, 9.60323838],
11 [0.96375991, 2.57490687, 2.57494555,
12 4.59771405, 4.59774543, 8.67625318]]
15@pytest.mark.response
16def test_hubbard_GW(in_tmp_dir, gpw_files, gpaw_new):
17 # This tests checks the actual numerical accuracy which is asserted below
18 if gpaw_new and world.size > 1:
19 pytest.skip('Parallelization bug for new-gpaw')
20 gw = G0W0(gpw_files['ag_plusU_pw'], 'gw',
21 integrate_gamma='sphere',
22 frequencies={'type': 'nonlinear',
23 'domega0': 0.1, 'omegamax': None},
24 nbands=19, # Carefully selected to avoid slicing degenerate band
25 ecut=52.8, # This too
26 eta=0.2)
27 results = gw.calculate()
29 qp_kn = results['qp'][0]
31 assert np.allclose(qp_kn, reference_kn, atol=1e-4, rtol=1e-4)