1import pytest 2from gpaw.atom.aeatom import AllElectronAtom, c 3from gpaw.test import equal 4 5 6@pytest.mark.ci 7def test_aeatom(): 8 Z = 79 # gold atom 9 kwargs = dict(ngpts=5000, alpha2=1000 * Z**2, ngauss=200) 10 11 # Test Schroedinger equation: 12 aea = AllElectronAtom(Z, log=None) 13 aea.initialize(**kwargs) 14 15 errors = [] 16 for channel in aea.channels: 17 channel.solve(-Z) 18 for n in range(7): 19 e = channel.e_n[n] 20 e0 = -0.5 * Z**2 / (n + channel.l + 1)**2 21 errors.append(abs(e / e0 - 1)) 22 print(max(errors)) 23 equal(max(errors), 0, 2.0e-5) 24 25 # Test Dirac equation: 26 aea = AllElectronAtom(Z, dirac=True, log=None) 27 aea.initialize(**kwargs) 28 29 errors = [] 30 for channel in aea.channels: 31 channel.solve(-Z) 32 for n in range(7): 33 e = channel.e_n[n] 34 if channel.k > 0: 35 n += 1 36 e0 = (1 + 37 (Z / c)**2 / 38 ((channel.k**2 - (Z / c)**2)**0.5 + n)**2)**-0.5 - 1 39 e0 *= c**2 40 errors.append(abs(e / e0 - 1)) 41 print(max(errors)) 42 equal(max(errors), 0, 4.0e-5) 43