def test_rlda(): a = 6.2e7 rmin = 1e-8 rmax = 50 Z = 92 N = 1000 c = 137.0359895 E_tot, ks_energies, n, l, s, f, R, Rp, V_tot, density, orbitals = \ atom_rlda(Z, rmin, rmax, a, N, c, 1e-11, 100, 1e-10, 0.35, 100, True)
def N_study(Z, E_tot_ref, ks_energies_ref): c = 137.0359895 rmax = 50 rmin = 1e-8 a = 6.2e7 Nmax = 20000 Nmin = 100 graph = open("graph2.dat", "w") for N in range(16278, 20000, 100): E_tot, ks_energies, n, l, s, f, R, V_tot, density, orbitals = \ atom_rlda(Z, rmin, rmax, a, N, c, 1e-10, 1e-11, 0.35, 100) E_tot_err = abs(E_tot - E_tot_ref) ks_energies_err = max(abs(ks_energies - ks_energies_ref)) graph.write("%d %.17e %.17e\n" % (N, E_tot_err, ks_energies_err)) print N, E_tot_err, ks_energies_err
def N_study(Z, E_tot_ref, ks_energies_ref): c = 137.0359895 rmax = 50 rmin = 1e-8 a = 6.2e7 Nmax = 20000 Nmin = 100 graph = open("graph2.dat", "w") for N in range(16278, 20000, 100): E_tot, ks_energies, n, l, s, f, R, V_tot, density, orbitals = \ atom_rlda(Z, rmin, rmax, a, N, c, 1e-10, 1e-11, 0.35, 100) E_tot_err = abs(E_tot - E_tot_ref) ks_energies_err = max(abs(ks_energies-ks_energies_ref)) graph.write("%d %.17e %.17e\n" % (N, E_tot_err, ks_energies_err)) print N, E_tot_err, ks_energies_err
def get_energies_N(Z, E_tot_ref, ks_energies_ref, eps): c = 137.0359895 rmax = 50 rmin = 1e-8 a = 6.2e7 Nmax = 20000 Nmin = 100 while 1: N = (Nmax + Nmin) / 2 E_tot, ks_energies, n, l, s, f, R, V_tot, density, orbitals = \ atom_rlda(Z, rmin, rmax, a, N, c, 1e-10, 100, 5e-9, 0.5, 100) E_tot_err = abs(E_tot - E_tot_ref) ks_energies_err = max(abs(ks_energies-ks_energies_ref)) print Nmin, Nmax, E_tot_err, ks_energies_err if E_tot_err < eps and ks_energies_err < eps: Nmax = N E_tot_ok = E_tot ks_energies_ok = ks_energies else: Nmin = N if (Nmax - Nmin <= 1): break return E_tot_ok, ks_energies_ok, Nmax
def get_energies_N(Z, E_tot_ref, ks_energies_ref, eps): c = 137.0359895 rmax = 50 rmin = 1e-8 a = 6.2e7 Nmax = 20000 Nmin = 100 while 1: N = (Nmax + Nmin) / 2 E_tot, ks_energies, n, l, s, f, R, V_tot, density, orbitals = \ atom_rlda(Z, rmin, rmax, a, N, c, 1e-10, 100, 5e-9, 0.5, 100) E_tot_err = abs(E_tot - E_tot_ref) ks_energies_err = max(abs(ks_energies - ks_energies_ref)) print Nmin, Nmax, E_tot_err, ks_energies_err if E_tot_err < eps and ks_energies_err < eps: Nmax = N E_tot_ok = E_tot ks_energies_ok = ks_energies else: Nmin = N if (Nmax - Nmin <= 1): break return E_tot_ok, ks_energies_ok, Nmax
from __future__ import print_function from dftatom import atom_lda, atom_rlda a = 2.7e6 rmin = 1e-7 rmax = 50 Z = 92 N = 5500 E_tot, ks_energies, n, l, f, R, Rp, V_tot, density, orbitals = \ atom_lda(Z, rmin, rmax, a, N, 1e-11, 100, 1e-10, 0.35, 100, True) print("Schroedinger LDA:") print("E_tot = %13.6f" % E_tot) print("n l f E") for n_, l_, f_, E in zip(n, l, f, ks_energies): print("%d %d %5.2f %13.6f" % (n_, l_, f_, E)) print() a = 6.2e7 rmin = 1e-8 c = 137.0359895 E_tot, ks_energies, n, l, s, f, R, Rp, V_tot, density, orbitals = \ atom_rlda(Z, rmin, rmax, a, N, c, 1e-11, 100, 1e-10, 0.35, 100, True) print("Dirac RLDA:") print("E_tot = %13.6f" % E_tot) print("n l s f E") for n_, l_, s_, f_, E in zip(n, l, s, f, ks_energies): print("%d %d %d %5.2f %13.6f" % (n_, l_, s_, f_, E))
from dftatom import atom_lda, atom_rlda a = 2.7e6 rmin = 1e-7 rmax = 50 Z = 5 N = 6000 E_tot, ks_energies, n, l, f, R, Rp, V_tot, density, orbitals = \ atom_lda(Z, rmin, rmax, a, N, 1e-11, 100, 1e-10, 0.35, 100, True) print "Schroedinger LDA:" print "E_tot = %13.6f" % E_tot print "n l f E" for n_, l_, f_, E in zip(n, l, f, ks_energies): print "%d %d %5.2f %13.6f" % (n_, l_, f_, E) print a = 6.2e7 rmin = 1e-8 c = 137.0359895 E_tot, ks_energies, n, l, s, f, R, Rp, V_tot, density, orbitals = \ atom_rlda(Z, rmin, rmax, a, N, c, 1e-11, 100, 1e-10, 0.35, 100, True) print "Dirac RLDA:" print "E_tot = %13.6f" % E_tot print "n l s f E" for n_, l_, s_, f_, E in zip(n, l, s, f, ks_energies): print "%d %d %d %5.2f %13.6f" % (n_, l_, s_, f_, E)