Fix the duplicated Es issue

This commit is contained in:
Nuwan Yapa 2025-02-04 12:21:31 -05:00
parent 7deb7cf507
commit 6722a917fe
2 changed files with 5 additions and 3 deletions

View File

@ -69,10 +69,12 @@ function boundaryValue(κ, p, E, Φ0, W0, B0, A0, r_max; dtype=Float64, algo=RK4
end
"Find all bound energies between E_min (=0) and E_max (=mass) where
tol_digits determines the precision for root finding and the threshold for identifying duplicates,
the other parameters are the same from dirac!(...)."
function findEs(κ, p, Φ0, W0, B0, A0, r_max, E_min=0, E_max=(p ? M_p : M_n))
function findEs(κ, p, Φ0, W0, B0, A0, r_max, E_min=0, E_max=(p ? M_p : M_n), tol_digits=5)
f(E) = boundaryValue(κ, p, E, Φ0, W0, B0, A0, r_max)
return find_zeros(f, (E_min, E_max))
Es = find_zeros(f, (E_min, E_max); xatol=1/10^tol_digits)
return unique(E -> round(E; digits=tol_digits), Es)
end
"Find all orbitals and return two lists containing κ values and corresponding energies for a single species where

View File

@ -23,7 +23,7 @@ E_max = 939
boundEs = findEs(κ, p, S_interp, V_interp, R_interp, A_interp, r_max, E_min, E_max)
binding_Es = round.((p ? M_p : M_n) .- boundEs; digits=3) |> unique
binding_Es = (p ? M_p : M_n) .- boundEs
println("binding energies = $binding_Es")
Es = collect(E_min:0.5:E_max)