Coverage for gpaw/test/fileio/test_parallel.py: 35%

23 statements  

« prev     ^ index     » next       coverage.py v7.7.1, created at 2025-07-19 00:19 +0000

1import pytest 

2from gpaw.mpi import world 

3from gpaw import GPAW, ConvergenceError, restart 

4from gpaw.mixer import MixerSum 

5from ase.build import bulk 

6 

7# bulk Fe with k-point, band, and domain parallelization 

8pytestmark = pytest.mark.skipif(world.size < 4, 

9 reason='world.size < 4') 

10 

11 

12@pytest.mark.old_gpaw_only 

13def test_fileio_parallel(in_tmp_dir): 

14 a = 2.87 

15 atoms = bulk('Fe', 'bcc', a=a) 

16 atoms.set_initial_magnetic_moments([2.2]) 

17 calc = GPAW(mode='fd', 

18 h=0.20, 

19 eigensolver='rmm-diis', 

20 mixer=MixerSum(0.1, 3), 

21 nbands=6, 

22 kpts=(4, 4, 4), 

23 parallel={'band': 2, 'domain': (2, 1, 1)}, 

24 maxiter=4) 

25 atoms.calc = calc 

26 try: 

27 atoms.get_potential_energy() 

28 except ConvergenceError: 

29 pass 

30 calc.write('tmp.gpw', mode='all') 

31 

32 # Continue calculation for few iterations 

33 atoms, calc = restart('tmp.gpw', 

34 eigensolver='rmm-diis', 

35 mixer=MixerSum(0.1, 3), 

36 parallel={'band': 2, 'domain': (1, 1, 2)}, 

37 maxiter=4) 

38 try: 

39 atoms.get_potential_energy() 

40 except ConvergenceError: 

41 pass