Coverage for gpaw/test/setups/test_generator2.py: 100%
28 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
1import numpy as np
2import pytest
4from gpaw.atom.generator2 import generate
5from gpaw.setup import Setup
6from gpaw.xc import XC
9@pytest.mark.serial
10def test_lithium(in_tmp_dir):
11 G = generate('Li', 3, '2s,2p,s', [2.1, 2.1], 2.0, None, 2, 'PBE', True)
12 assert G.check_all()
13 basis = G.create_basis_set()
14 basis.write_xml()
15 setup = G.make_paw_setup('test')
16 setup.write_xml()
19@pytest.mark.serial
20def test_pseudo_h(in_tmp_dir):
21 G = generate('H', 1.25, '1s,s', [0.9], 0.7, None, 2, 'PBE', True)
22 assert G.check_all()
23 basis = G.create_basis_set()
24 basis.write_xml()
25 setup_data = G.make_paw_setup('test')
26 setup_data.write_xml()
28 xc = XC('PBE')
29 setup = Setup(setup_data, xc, lmax=2)
30 T_Lqp = setup.calculate_T_Lqp(1, 3, 2,
31 jlL_i=[(0, 0, 0), (1, 0, 0)])
32 assert (T_Lqp[1:] == 0.0).all()
33 assert T_Lqp[0] == pytest.approx(np.eye(3) / (4 * np.pi)**0.5)
34 B_pqL = setup.xc_correction.B_pqL
35 assert B_pqL == pytest.approx(T_Lqp.T)