diff --git a/ho_basis.jl b/ho_basis.jl index c956845..c8a6e93 100644 --- a/ho_basis.jl +++ b/ho_basis.jl @@ -157,8 +157,8 @@ function get_jacobi_V2_matrix(V_of_r, E_max, Λ, μω_global; atol=10^-6, maxeva return V2 end -function get_2p_p1p2_matrix(n1s, l1s, n2s, l2s, Λ, μ1ω1, μ2ω2) - mat = zeros(Float64, length(n1s), length(n1s)) +function get_2p_p1p2_matrix(n1s, l1s, n2s, l2s, Λ, μ1ω1, μ2ω2; dtype=Float64) + mat = zeros(dtype, length(n1s), length(n1s)) Threads.@threads for idx in CartesianIndices(mat) (i, j) = Tuple(idx) val = racahs_reduction_formula(n1s[i], l1s[i], n2s[i], l2s[i], n1s[j], l1s[j], n2s[j], l2s[j], Λ, μ1ω1, μ2ω2) @@ -166,3 +166,37 @@ function get_2p_p1p2_matrix(n1s, l1s, n2s, l2s, Λ, μ1ω1, μ2ω2) end return sparse(mat) end + +function get_src_V_matrix(V_of_r, E_max, Λ, μω, μω_global; atol=10^-6, maxevals=10^5) + _, n1s, l1s, n2s, l2s = get_2p_basis(E_max, Λ) + l_max = max(maximum(l1s), maximum(l2s)) + n_max = max(maximum(n1s), maximum(n2s)) + mask1 = (n2s .== n2s') .&& (l2s .== l2s') + mask2 = (n1s .== n1s') .&& (l1s .== l1s') + + V_elem(l, n1, n2) = V_numerical(V_of_r, l, n1, n2; μω_gen=μω, atol=atol, maxevals=maxevals) + V_cache = LRU{Tuple{UInt8, UInt8, UInt8}, ComplexF64}(maxsize=(1+l_max)*(1+n_max)^2) + + V1 = get_sp_V_matrix(V_elem, n1s, l1s; mask=mask1, dtype=ComplexF64, cache=V_cache) + V2 = get_sp_V_matrix(V_elem, n2s, l2s; mask=mask2, dtype=ComplexF64, cache=V_cache) + + V12 = get_src_V12_matrix(V_of_r, E_max, Λ, μω_global; atol=atol, maxevals=maxevals) + + return V1 + V2 + V12 +end + +function get_src_V12_matrix(V_of_r, E_max, Λ, μω_global; atol=10^-6, maxevals=10^5) + Es, n1s, l1s, n2s, l2s = get_2p_basis(E_max, Λ) + l_max = max(maximum(l1s), maximum(l2s)) + n_max = max(maximum(n1s), maximum(n2s)) + mask1 = (n2s .== n2s') .&& (l2s .== l2s') + + V_relative_elem(l, n1, n2) = V_numerical(V_of_r, l, n1, n2; μω_gen=μω_global, atol=atol, maxevals=maxevals) + V_relative_cache = LRU{Tuple{UInt8, UInt8, UInt8}, ComplexF64}(maxsize=(1+l_max)*(1+n_max)^2) + + V_relative = get_sp_V_matrix(V_relative_elem, n1s, l1s; mask=mask1, dtype=ComplexF64, cache=V_relative_cache) + U = Moshinsky_transform(Es, n1s, l1s, n2s, l2s, Λ) + V12 = U' * V_relative * U + + return V12 +end \ No newline at end of file diff --git a/ho_basis_3body_resonance.jl b/ho_basis_3body_resonance.jl index d7f73f1..8cf1066 100644 --- a/ho_basis_3body_resonance.jl +++ b/ho_basis_3body_resonance.jl @@ -8,11 +8,9 @@ V_of_r(r) = 2 * exp(-(r-3)^2 / (1.5)^2) E_max = 30 μω_global = 0.5 * exp(-2im * pi / 9) -# due to Jacobi coordinates -μ1ω1 = μω_global * 1/2 -μ2ω2 = μω_global * 2 -μ1 = m * 1/2 -μ2 = m * 2/3 +# due to simple relative coordinates +μω = μω_global * 2 +μ = m/2 println("No of threads = ", Threads.nthreads()) @@ -28,15 +26,16 @@ println("Basis size = ", length(Es)) println("Constructing KE matrices") -@time "T1" T1 = get_sp_T_matrix(n1s, l1s; mask=mask1, μω_gen=μ1ω1, μ=μ1) -@time "T2" T2 = get_sp_T_matrix(n2s, l2s; mask=mask2, μω_gen=μ2ω2, μ=μ2) +@time "T1" T1 = get_sp_T_matrix(n1s, l1s; mask=mask1, μω_gen=μω, μ=μ) +@time "T2" T2 = get_sp_T_matrix(n2s, l2s; mask=mask2, μω_gen=μω, μ=μ) +@time "T_cross" T_cross = get_2p_p1p2_matrix(n1s, l1s, n2s, l2s, Λ, μω, μω; dtype=ComplexF64) ./ (2*μ) println("Constructing PE matrices") -@time "V" V = get_jacobi_V_matrix(V_of_r, E_max, Λ, μ1ω1, μω_global) +@time "V" V = get_src_V_matrix(V_of_r, E_max, Λ, μω, μω_global) println("Calculating spectrum") -@time "H" H = T1 + T2 + V +@time "H" H = T1 + T2 + T_cross + V @time "Eigenvalues" evals, _ = eigs(H, nev=5, ncv=50, which=:LI, maxiter=5000, tol=1e-5, ritzvec=false, check=1) display(evals) \ No newline at end of file