Find all orbitals and plot
This commit is contained in:
parent
ad2b0449ba
commit
0ca19921e1
23
dirac.jl
23
dirac.jl
|
|
@ -38,3 +38,26 @@ function findEs(κ, p, Φ0, W0, B0, A0, r_max, E_min=0, E_max=(p ? M_p : M_n))
|
||||||
f(E) = boundaryValue(κ, p, E, Φ0, W0, B0, A0, r_max)
|
f(E) = boundaryValue(κ, p, E, Φ0, W0, B0, A0, r_max)
|
||||||
return find_zeros(f, (E_min, E_max))
|
return find_zeros(f, (E_min, E_max))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
"Find N lowest lying orbitals and return two lists containing κ values and corresponding energies for a single species where
|
||||||
|
the other parameters are defined above"
|
||||||
|
function fillNucleons(N, p, Φ0, W0, B0, A0, r_max, E_min=0, E_max=(p ? M_p : M_n))
|
||||||
|
κs = Int[]
|
||||||
|
Es = Float64[]
|
||||||
|
# start from κ=-1 and go both up and down
|
||||||
|
for direction in [-1, 1]
|
||||||
|
for κ in direction * (1:100) # cutoff is 100
|
||||||
|
new_Es = findEs(κ, p, Φ0, W0, B0, A0, r_max, E_min, E_max)
|
||||||
|
if isempty(new_Es); break; end
|
||||||
|
append!(Es, new_Es)
|
||||||
|
append!(κs, fill(κ, length(new_Es)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if length(Es) < N
|
||||||
|
@warn "Only found $(length(Es)) orbitals for $N nucleons"
|
||||||
|
return (κs, Es)
|
||||||
|
else
|
||||||
|
idxs = sortperm(Es)[1:N]
|
||||||
|
return (κs[idxs], Es[idxs])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
using DelimitedFiles, Interpolations, Plots
|
||||||
|
include("../dirac.jl")
|
||||||
|
|
||||||
|
# test data generated from Hartree.f
|
||||||
|
# format: x S(x) V(x) R(x) A(x)
|
||||||
|
test_data = readdlm("test/Pb208FldsFSUGarnet.csv")
|
||||||
|
xs = test_data[:, 1]
|
||||||
|
Ss = test_data[:, 2]
|
||||||
|
Vs = test_data[:, 3]
|
||||||
|
Rs = test_data[:, 4]
|
||||||
|
As = test_data[:, 5]
|
||||||
|
|
||||||
|
S_interp = linear_interpolation(xs, Ss)
|
||||||
|
V_interp = linear_interpolation(xs, Vs)
|
||||||
|
R_interp = linear_interpolation(xs, Rs)
|
||||||
|
A_interp = linear_interpolation(xs, As)
|
||||||
|
|
||||||
|
p = true
|
||||||
|
N = 82
|
||||||
|
r_max = maximum(xs)
|
||||||
|
E_min = 880
|
||||||
|
E_max = 939
|
||||||
|
|
||||||
|
κs, Es = fillNucleons(N, p, S_interp, V_interp, R_interp, A_interp, r_max, E_min, E_max)
|
||||||
|
|
||||||
|
scatter(κs, Es, label=(p ? "proton" : "neutron") * " spectrum")
|
||||||
|
xlabel!("κ")
|
||||||
|
ylabel!("E (MeV)")
|
||||||
Loading…
Reference in New Issue