Accounted for multiplicity when filling orbitals

This commit is contained in:
Nuwan Yapa 2024-07-01 14:40:27 -04:00
parent 0ca19921e1
commit 0bc4083978
2 changed files with 29 additions and 10 deletions

View File

@ -39,9 +39,9 @@ function findEs(κ, p, Φ0, W0, B0, A0, r_max, E_min=0, E_max=(p ? M_p : M_n))
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 "Find all orbitals and return two lists containing κ values and corresponding energies for a single species where
the other parameters are defined above" 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)) function findAllOrbitals(p, Φ0, W0, B0, A0, r_max, E_min=0, E_max=(p ? M_p : M_n))
κs = Int[] κs = Int[]
Es = Float64[] Es = Float64[]
# start from κ=-1 and go both up and down # start from κ=-1 and go both up and down
@ -53,11 +53,28 @@ function fillNucleons(N, p, Φ0, W0, B0, A0, r_max, E_min=0, E_max=(p ? M_p : M_
append!(κs, fill(κ, length(new_Es))) append!(κs, fill(κ, length(new_Es)))
end end
end end
if length(Es) < N
@warn "Only found $(length(Es)) orbitals for $N nucleons"
return (κs, Es) return (κs, Es)
else
idxs = sortperm(Es)[1:N]
return (κs[idxs], Es[idxs])
end
end end
"For a given list of κ values with corresponding energies, attempt to fill N lowest lying orbitals and return occupancy numbers"
function fillNucleons(N::Int, κs, Es)
sort_i = sortperm(Es)
occ = zeros(Int, length(κs))
for i in sort_i
if N 0; break; end;
max_occ = 2 * j_κ(κs[i]) + 1
occ[i] = min(max_occ, N)
N -= occ[i]
end
N == 0 || @warn "All orbitals could not be filled"
return occ
end
"Total angular momentum j for a given κ value"
j_κ(κ::Int) = abs(κ) - 1/2
"Orbital angular momentum l for a given κ value"
l_κ(κ::Int) = abs(κ) - (κ < 0) # since true = 1 and false = 0

View File

@ -21,8 +21,10 @@ r_max = maximum(xs)
E_min = 880 E_min = 880
E_max = 939 E_max = 939
κs, Es = fillNucleons(N, p, S_interp, V_interp, R_interp, A_interp, r_max, E_min, E_max) κs, Es = findAllOrbitals(p, S_interp, V_interp, R_interp, A_interp, r_max, E_min, E_max)
occ = fillNucleons(N, κs, Es)
scatter(κs, Es, label=(p ? "proton" : "neutron") * " spectrum") scatter(κs, Es, label=(p ? "proton" : "neutron") * " spectrum")
annotate!(κs .+ 0.3, Es, occ)
xlabel!("κ") xlabel!("κ")
ylabel!("E (MeV)") ylabel!("E (MeV)")