This commit is contained in:
Nuwan Yapa 2025-01-28 12:34:43 -05:00
parent 7822c0f168
commit 77dcd1da7a
6 changed files with 7 additions and 7 deletions

View File

@ -27,7 +27,7 @@ end
divs is the number of mesh divisions so solution would be returned as a 2×(1+divs) matrix, divs is the number of mesh divisions so solution would be returned as a 2×(1+divs) matrix,
shooting method divides the interval into two partitions at r_max/2, ensuring convergence at both r=0 and r=r_max, shooting method divides the interval into two partitions at r_max/2, ensuring convergence at both r=0 and r=r_max,
the other parameters are the same from dirac!(...)." the other parameters are the same from dirac!(...)."
function solveDiracWf(κ, p, E, Φ0, W0, B0, A0, r_max, divs; shooting=true, normalize=true) function solveNucleonWf(κ, p, E, Φ0, W0, B0, A0, r_max, divs; shooting=true, normalize=true)
saveat = r_max / divs saveat = r_max / divs
if shooting if shooting
@ -124,7 +124,7 @@ function calculateNucleonDensity(N, p, Φ0, W0, B0, A0, r_max, divs, E_min=0, E_
ρr2 = zeros(2, divs + 1) # ρ×r² values ρr2 = zeros(2, divs + 1) # ρ×r² values
for (κ, E, occ) in zip(κs, Es, occs) for (κ, E, occ) in zip(κs, Es, occs)
wf = solveDiracWf(κ, p, E, Φ0, W0, B0, A0, r_max, divs; shooting=true, normalize=true) wf = solveNucleonWf(κ, p, E, Φ0, W0, B0, A0, r_max, divs; shooting=true, normalize=true)
wf2 = wf .* wf wf2 = wf .* wf
ρr2 += (occ / (4 * pi)) * wf2 # 2j+1 factor is accounted in the occupancy number ρr2 += (occ / (4 * pi)) * wf2 # 2j+1 factor is accounted in the occupancy number
end end

View File

@ -1,5 +1,5 @@
using DelimitedFiles, Interpolations, Plots using DelimitedFiles, Interpolations, Plots
include("../dirac.jl") include("../nucleons.jl")
# test data generated from Hartree.f # test data generated from Hartree.f
# format: x S(x) V(x) R(x) A(x) # format: x S(x) V(x) R(x) A(x)

View File

@ -1,5 +1,5 @@
using DelimitedFiles, Interpolations, Plots using DelimitedFiles, Interpolations, Plots
include("../dirac.jl") include("../nucleons.jl")
# test data generated from Hartree.f # test data generated from Hartree.f
# format: x S(x) V(x) R(x) A(x) # format: x S(x) V(x) R(x) A(x)

View File

@ -1,5 +1,5 @@
using DelimitedFiles, Interpolations, Plots using DelimitedFiles, Interpolations, Plots
include("../dirac.jl") include("../nucleons.jl")
# test data generated from Hartree.f # test data generated from Hartree.f
# format: x S(x) V(x) R(x) A(x) # format: x S(x) V(x) R(x) A(x)

View File

@ -1,5 +1,5 @@
using DelimitedFiles, Interpolations, Plots using DelimitedFiles, Interpolations, Plots
include("../dirac.jl") include("../nucleons.jl")
# test data generated from Hartree.f # test data generated from Hartree.f
# format: x S(x) V(x) R(x) A(x) # format: x S(x) V(x) R(x) A(x)
@ -25,7 +25,7 @@ groundE = findEs(κ, p, S_interp, V_interp, R_interp, A_interp, r_max, E_min, E_
println("ground state E = $groundE") println("ground state E = $groundE")
divs = 400 divs = 400
wf = solveDiracWf(κ, p, groundE, S_interp, V_interp, R_interp, A_interp, r_max, divs) wf = solveNucleonWf(κ, p, groundE, S_interp, V_interp, R_interp, A_interp, r_max, divs)
rs = range(0, r_max, length=divs+1) rs = range(0, r_max, length=divs+1)
gs = wf[1, :] gs = wf[1, :]
fs = wf[2, :] fs = wf[2, :]