Avoid dirty trick if unnecessary

This commit is contained in:
Nuwan Yapa 2025-04-16 17:00:48 -04:00
parent 1311db53f7
commit 797f6f0cd4
1 changed files with 4 additions and 2 deletions

View File

@ -177,7 +177,9 @@ function calculateNucleonDensity(p::Bool, s::system)::Tuple{Vector{Float64}, Vec
r2s = s.r_mesh.r .^ 2
ρ = ρr2 ./ transpose(r2s)
if !all(isfinite.(ρ[:, 1]))
ρ[:, 1] .= ρ[:, 2] # dirty fix for NaN at r=0
end
ρ_s = ρ[1, :] - ρ[2, :] # g^2 - f^2
ρ_v = ρ[1, :] + ρ[2, :] # g^2 + f^2