Coverage for gpaw/test/exx/test_exx_scf.py: 48%
27 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 selfconsistent RSF calculation with Yukawa potential including vc."""
2import pytest
3from gpaw.mpi import world
4from ase import Atoms
5from gpaw import GPAW, KohnShamConvergenceError
6from gpaw.xc.hybrid import HybridXC
7from gpaw.poisson import PoissonSolver
8from gpaw.occupations import FermiDirac
9from gpaw.test import gen
10from gpaw.eigensolvers import RMMDIIS
11from gpaw.utilities.adjust_cell import adjust_cell
13pytestmark = pytest.mark.skipif(world.size < 4,
14 reason='world.size < 4')
17@pytest.mark.old_gpaw_only
18def test_exx_exx_scf(in_tmp_dir, add_cwd_to_setup_paths):
19 h = 0.3
21 # No energies - simpley convergence test, esp. for 3d TM
23 # for atom in ['F', 'Cl', 'Br', 'Cu', 'Ag']:
24 for atom in ['Ti']:
25 gen(atom, xcname='PBE', scalarrel=False, exx=True)
26 work_atom = Atoms(atom, [(0, 0, 0)])
27 adjust_cell(work_atom, 4, h=h)
28 work_atom.translate([0.01, 0.02, 0.03])
29 work_atom.set_initial_magnetic_moments([2.0])
30 calculator = GPAW(mode='fd',
31 convergence={'energy': 0.01,
32 'eigenstates': 3,
33 'density': 3},
34 eigensolver=RMMDIIS(),
35 poissonsolver=PoissonSolver(use_charge_center=True),
36 occupations=FermiDirac(width=0.0, fixmagmom=True),
37 h=h, maxiter=35, # Up to 24 are needed by now
38 xc=HybridXC('PBE0'),
39 txt=atom + '-PBE0.txt')
40 work_atom.calc = calculator
41 try:
42 work_atom.get_potential_energy()
43 except KohnShamConvergenceError:
44 pass
45 assert calculator.scf.converged, 'Calculation not converged'