-- the potentials of the Kr atom in LDA, as r V(r) G, F, Atom = CalculateAtomicBasisFunctions(36, {{"Configuration", "[Ar] 3d10 4s2 4p6"}, {"Method", "LDA"}}) V = Atom.Potential print(V.rVN.type, V.rVN.degree, #V.rVN.x == #G[1].x) -- the charge an electron sees: the nucleus, screened by the electrons ZNH = -(V.rVN + V.rVH) ZKS = -(V.rVN + V.rVH + V.rVxc) print(" r -r(V_N+V_H) -r V_KS") for _, r in ipairs({0.001, 0.01, 0.1, 0.5, 1, 2, 4, 8}) do print(string.format("%6.3f %10.5f %10.5f", r, ZNH(r), ZKS(r))) end eV = 27.211386 for _, o in ipairs(Atom.Orbitals) do if o.Label == "4p3/2" then print(string.format("energy of the 4p3/2 orbital %.3f eV", o.Energy*eV)) end end -- the plot on a logarithmic r axis function Curve(f) local c = {} for i = 0, 500 do local t = -3 + i*4.5/500; c[i+1] = {t, f(10^t)} end return c end pl = Graphics.Plot({Curve(ZNH), Curve(ZKS), {{-3, 1}, {1.5, 1}}}, {{"plotIm", false}, {"Frame", {{"Xmin", -3}, {"Xmax", 1.5}, {"Ymin", 0}, {"Ymax", 37}, {"FirstXTick", -3}, {"dXTick", 1}, {"FirstYTick", 0}, {"dYTick", 5}, {"XFormat", "%.0f"}, {"YFormat", "%.0f"}, {"XLabel", "log10(r/bohr)"}, {"YLabel", "-r V(r)"}, {"XLMargin", 0.1}, {"YAxis", -10}}}}) file = io.open("atomic_potentials.svg", "w") file:write(Graphics.ToSVG(pl, {{"RelativeSize", true}})) file:close()