Coverage for gpaw/test/response/test_chi0_cylindrical.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
3from ase.units import Hartree
4from gpaw.response.df import DielectricFunction
5from gpaw.response.qpd import SingleCylQPWDescriptor
8@pytest.mark.response
9def test_response_gw_MoS2_cut(gpw_files):
10 ecut_sphere = 50.0
12 DFs = DielectricFunction(calc=gpw_files['mos2_pw'],
13 frequencies={'type': 'nonlinear',
14 'domega0': 0.5},
15 ecut=ecut_sphere,
16 truncation='2D',
17 hilbert=False)
18 dfs1, dfs2 = DFs.get_dielectric_function()
20 ecut_cyl = {
21 'class': SingleCylQPWDescriptor,
22 'kwargs': {'ecut_xy': ecut_sphere / Hartree,
23 'ecut_z': 0.5 * ecut_sphere / Hartree}
24 }
26 DFc = DielectricFunction(calc=gpw_files['mos2_pw'],
27 frequencies={'type': 'nonlinear',
28 'domega0': 0.5},
29 ecut=ecut_cyl,
30 truncation='2D',
31 hilbert=False)
32 dfc1, dfc2 = DFc.get_dielectric_function()
34 assert dfc1 == pytest.approx(dfs1, rel=1e-6)
35 assert dfc2 == pytest.approx(dfs2, rel=5e-2)