Coverage for gpaw/test/lcao/test_wf_restart.py: 95%
21 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
1# Test that LCAO wavefunctions are available and equal after restarts
2# in normal as well as 'all' mode
4import pytest
5from ase.build import molecule
6from gpaw import GPAW
7from gpaw.mpi import world
10def test_restart(in_tmp_dir, gpaw_new):
11 if gpaw_new and world.size > 1:
12 pytest.skip('LCAO get_ps_w_f() not parallelized')
13 system = molecule('H2')
14 system.center(vacuum=2.5)
16 calc = GPAW(mode='lcao', basis='sz(dzp)', h=0.3, nbands=1, txt=None)
17 system.calc = calc
18 system.get_potential_energy()
19 wf = calc.get_pseudo_wave_function(0)
21 for mode in ['all', 'normal']:
22 fname = 'lcao-restart.%s.gpw' % mode
23 calc.write(fname, mode=dict(normal='', all='all')[mode])
25 calc2 = GPAW(fname, txt=None)
26 if mode == 'normal':
27 continue
28 wf2 = calc2.get_pseudo_wave_function(0)
29 assert wf2 == pytest.approx(wf, abs=1e-14)