Coverage for gpaw/test/pathological/test_lcao_spos_derivative.py: 100%
11 statements
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-08 00:17 +0000
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-08 00:17 +0000
1import numpy as np
2from ase.build import bulk
4from gpaw import GPAW, FermiDirac, Mixer
7def test_pathological_lcao_spos_derivative(in_tmp_dir):
8 atoms = bulk('Si', 'diamond', a=5.4834322363595565)
9 atoms *= (3, 3, 3)
10 atoms.calc = GPAW(
11 gpts=(32, 32, 32),
12 mixer=Mixer(0.5, 5, 50.0),
13 txt='grumble.txt',
14 kpts=(2, 1, 1),
15 mode='lcao',
16 basis='sz(dzp)',
17 xc='oldLDA',
18 occupations=FermiDirac(0.01))
19 f = atoms.get_forces()
20 fmax = np.abs(f).max()
21 print('maxforce', fmax)
22 assert fmax < 0.05 # 0.03 normally, 2.7 with bug
23 # fmax can be converged much closer to 0 with better grid/SCF convergence.