From 5fc9d8022edc1e4ba25d474751ac2644b73ca458 Mon Sep 17 00:00:00 2001 From: Nuwan Yapa Date: Fri, 28 Jun 2024 15:01:11 -0400 Subject: [PATCH] 3b resonance with Berggren basis --- berggren_3body_resonance.jl | 57 +++++++++++++++++++ ...esonance.jl => ho_basis_3body_resonance.jl | 0 2 files changed, 57 insertions(+) create mode 100644 berggren_3body_resonance.jl rename 3body_resonance.jl => ho_basis_3body_resonance.jl (100%) diff --git a/berggren_3body_resonance.jl b/berggren_3body_resonance.jl new file mode 100644 index 0000000..d52cbdd --- /dev/null +++ b/berggren_3body_resonance.jl @@ -0,0 +1,57 @@ +using LinearAlgebra, SparseArrays, Arpack +include("helper.jl") +include("p_space.jl") +include("berggren.jl") + +println("No of threads = ", Threads.nthreads()) +atol = 10^-5 +maxevals = 10^5 + +Λ = 0 +m = 1.0 +μ1 = m * 1/2 +μ2 = m * 2/3 + +target = 4.0766890719636875 - 0.012758927741074495im + +V_of_r(r) = 2 * exp(-(r-3)^2 / (1.5)^2) +V_l(j, k, kp) = Vl_mat_elem(V_of_r, j, k, kp; atol=atol, maxevals=maxevals, R_cutoff=16) + +vertices = [0, 2 - 0.2im, 3, 4] +subdivisions = [15, 10, 10] +ks, ws = get_mesh(vertices, subdivisions) + +jmax = 4 +tri((j1, j2)) = triangle_ineq(j1, j2, Λ) +js = collect(Iterators.filter(tri, iter_prod(0:jmax, 0:jmax))) + +basis = iter_prod(js, zip(ks, ws), zip(ks, ws)) # basis = ((j1, j2), (k1, w1), (k2, w2)) +basis_size = length(js) * length(ks)^2 +@assert length(basis) == basis_size "Something wrong with the basis" +println("Basis size = $basis_size") + +@time "T" begin + T_blocks = [kron_sum(get_T_matrix(ks, μ1), get_T_matrix(ks, μ2)) for _ in js] + T = blockdiag(sparse.(T_blocks)...) +end + +@time "V1" begin + V1_blocks = [kron(get_V_matrix((k, kp) -> V_l(j1, k, kp), ks, ws), I(length(ks))) for (j1, _) in js] + V1 = blockdiag(sparse.(V1_blocks)...) +end + +E_max = 30 +μω_global = 0.5 +μ1ω1 = μω_global * 1/2 +μ2ω2 = μω_global * 2 + +@time "V2_HO" V2_HO = get_jacobi_V2_matrix(V_of_r, E_max, Λ, μω_global) + +@time "W_right" W_right = get_W_matrix(basis, E_max, Λ, μ1ω1, μ2ω2; weights=true) +@time "W_left" W_left = get_W_matrix(basis, E_max, Λ, μ1ω1, μ2ω2; weights=false) + +@time "V2" V2 = W_left * V2_HO * transpose(W_right) +@time "H" H = T + V1 + V2 + +@time "Eigenvalues" evals, _ = eigs(H, sigma=target, maxiter=5000, tol=1e-5, ritzvec=false, check=1) +display(evals) diff --git a/3body_resonance.jl b/ho_basis_3body_resonance.jl similarity index 100% rename from 3body_resonance.jl rename to ho_basis_3body_resonance.jl