-- the spin-orbit coupling of the Ni 3d shell from the derivative of the potential G, F, Atom = CalculateAtomicBasisFunctions(28, {{"Configuration", "[Ar] 3d8 4s2"}, {"Method", "LDA"}, {"Relativistic", false}}) x = G[1].x c = Atom.c rV = Atom.Potential.rVN + Atom.Potential.rVH + Atom.Potential.rVxc for i, label in ipairs(Atom.Labels) do if label == "3d" then d = i end end -- zeta = 1/(2c^2) int P^2 (1/r) dV/dr dr, with (1/r) dV/dr = (f'(r) - f(r)/r)/r^2 for f = r V P, f, df = G[d](x), rV(x), rV(x, 1) y = {} for i = 1, #x do y[i] = P[i]^2*(df[i] - f[i]/x[i])/x[i]^2/(2*c*c) end zeta = InterpolatingFunction.Integrate(InterpolatingFunction.BSpline(x, y, 8)) G, F, Dirac = CalculateAtomicBasisFunctions(28, {{"Configuration", "[Ar] 3d8 4s2"}, {"Method", "LDA"}}) eV = 27.211386 print(string.format("zeta(3d) = %.4f eV from the Schroedinger potential, %.4f eV from the Dirac calculation", zeta*eV, Dirac.Zeta["3d"]*eV))