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, setup_paths, 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.cluster import Cluster 12 13pytestmark = pytest.mark.skipif(world.size < 4, 14 reason='world.size < 4') 15 16 17def test_exx_exx_scf(in_tmp_dir): 18 if setup_paths[0] != '.': 19 setup_paths.insert(0, '.') 20 21 h = 0.3 22 23 # No energies - simpley convergence test, esp. for 3d TM 24 25 # for atom in ['F', 'Cl', 'Br', 'Cu', 'Ag']: 26 for atom in ['Ti']: 27 gen(atom, xcname='PBE', scalarrel=False, exx=True) 28 work_atom = Cluster(Atoms(atom, [(0, 0, 0)])) 29 work_atom.minimal_box(4, h=h) 30 work_atom.translate([0.01, 0.02, 0.03]) 31 work_atom.set_initial_magnetic_moments([2.0]) 32 calculator = GPAW(convergence={'energy': 0.01, 33 'eigenstates': 3, 34 'density': 3}, 35 eigensolver=RMMDIIS(), 36 poissonsolver=PoissonSolver(use_charge_center=True), 37 occupations=FermiDirac(width=0.0, fixmagmom=True), 38 h=h, maxiter=35) # Up to 24 are needed by now 39 calculator.set(xc=HybridXC('PBE0')) 40 calculator.set(txt=atom + '-PBE0.txt') 41 work_atom.calc = calculator 42 try: 43 work_atom.get_potential_energy() 44 except KohnShamConvergenceError: 45 pass 46 assert calculator.scf.converged, 'Calculation not converged' 47