Compare commits

..

1 Commits
main ... V3b

Author SHA1 Message Date
Nuwan Yapa 15b39ca8f5 Temp commit 2026-06-04 17:52:17 -04:00
3 changed files with 69 additions and 74 deletions

View File

@ -1,74 +0,0 @@
using Roots, LinearAlgebra, Plots
include("../ho_basis.jl")
include("../EC.jl")
include("../common.jl")
V_of_r(r) = 2 * exp(-(r-3)^2 / (1.5)^2)
Λ = 0
m = 1.0
ϕ = 0.0
μω_global = 0.5 * exp(-2im * ϕ)
E_max = 40
H0 = get_3b_H_matrix(jacobi, V_of_r, μω_global, E_max, Λ, m, true, true)
# Vp = perturbation to make the state artificially bound
Vp_of_r(r) = -exp(-(r/3)^2)
@time "Vp" Vp = get_3b_H_matrix(jacobi, Vp_of_r, μω_global, E_max, Λ, m, false, true)
ref_E = -2.22
training_c = [3.0, 2.6, 2.2, 1.8]
EC = affine_EC(H0, Vp)
train!(EC, training_c; ref_eval=ref_E, CAEC=false)
training_E = EC.training_E
quick_extrapolate(c) = argmin(real, get_extrapolated_evals(EC.H0_EC, EC.H1_EC, EC.N_EC, c, 0))
n_EC = 30
EC_c = (1.8 .+ rand(n_EC)) .+ 0.001im .* (-2 .+ 4 * rand(n_EC))
target_c = 0.0 : 0.2 : 1.2
exact_E = [4.076662025307587-0.012709842443350328im,
3.613318119833891-0.007335804709990623im,
3.1453431847006783-0.004030580410326795im,
2.672967129943755-0.00211498327461944im,
2.196542557810288-0.0010719835443437104im,
1.7164583929199813-0.0005455212208182736im,
1.233088227541505-0.0003070320106485624im]
EC_E = [quick_extrapolate(c) for c in EC_c]
# determining c0 with EC
c0 = find_zero(c -> abs2(quick_extrapolate(c)), 0.85)
println("Estimated c0 = ", c0)
EC_k = alt_sqrt.(EC_E)
order::Int = 5 # order of the Pade approximant
# Solve coefficients as a linear system
M_left_element(c, i) = alt_sqrt(c - c0)^i
M_left = M_left_element.(EC_c, (0:order)')
M_right = -EC_k .* M_left[:, 2:end] # remove the first column
M = hcat(M_left, M_right) # M = [M_left | M_right]
sol = M \ EC_k
a = sol[1:order+1]
b = [1; sol[order+2:end]]
# Pade approximant
polynomial(a, c) = sum(i -> a[i+1] * alt_sqrt(c - c0)^i, 0:order)
pade_approx(c) = polynomial(a, c) / polynomial(b, c)
# Extrapolate
extrapolated_k = pade_approx.([EC_c; target_c])
extrapolated_E = (extrapolated_k .^ 2)
# Plotting
scatter(real.(training_E), imag.(training_E), label="training")
scatter!(real.(exact_E), imag.(exact_E), label="exact")
scatter!(real.(EC_E), imag.(EC_E), label="EC", m=:star5)
scatter!(real.(extrapolated_E), imag.(extrapolated_E), label="ACCC", m=:x)
savefig("temp/EC+ACCC.pdf")

View File

@ -0,0 +1,38 @@
using Arpack
include("../ho_basis.jl")
coord_system = jacobi
atol = 10 ^ -5
maxevals = 10 ^ 5
Λ = 0
m = 1.0 / 43.281307
V_of_r(r) = -1.2343566 * exp(-r^2 / 100)
# three-body potential V3b = V3b_of_r(r12) * V3b_of_r(r23) * V3b_of_r(r31)
V3b_of_r(r) = 0.43 * exp(-(2/3) * r^2 / 100)
E_max = 30
μω_global = 0.1
μ1ω1 = μω_global * 1/2
basis = ho_basis_2B(E_max, Λ)
V1_elem(l, n1, n2) = V_numerical(V3b_of_r, l, n1, n2; μω_gen=μ1ω1, atol=atol, maxevals=maxevals)
@time "V1" V1 = get_sp_V_matrix(V1_elem, basis.n1s, basis.l1s, [basis.n2s, basis.l2s]; dtype=ComplexF64, E_max=basis.E_max)
V_relative_elem(l, n1, n2) = V_numerical(V3b_of_r, l, n1, n2; μω_gen=μω_global, atol=atol, maxevals=maxevals)
V_relative_cache = prealloc_V_cache(basis.E_max, ComplexF64)
V_relative_1 = get_sp_V_matrix(V_relative_elem, basis.n1s, basis.l1s, [basis.n2s, basis.l2s]; dtype=ComplexF64, cache=V_relative_cache)
V_relative_2 = get_sp_V_matrix(V_relative_elem, basis.n2s, basis.l2s, [basis.n1s, basis.l1s]; dtype=ComplexF64, cache=V_relative_cache)
@time "V_relative" V_relative = V_relative_1 * V_relative_2 # commutative?
U = Moshinsky_transform(basis)
@time "V2" V2 = transpose(U) * V_relative * U
@time "V3b" V3b = V2 * V1 # commutative?
H = get_3b_H_matrix(coord_system, V_of_r, μω_global, E_max, Λ, m) + V3b
@time "Eigenvalues" evals, _ = eigs(H, nev=3, ncv=30, which=:SR, maxiter=5000, tol=1e-5, ritzvec=false, check=1)
display(evals)

31
ho_space_3body_V3b.jl Normal file
View File

@ -0,0 +1,31 @@
using Arpack
include("ho_basis.jl")
coord_system = src
atol = 10 ^ -5
maxevals = 10 ^ 5
Λ = 0
m = 1.0
V_of_r(r) = -2 * exp(-r^2 / 4)
# three-body potential V3b = V3b_of_r(r12) * V3b_of_r(r23) * V3b_of_r(r31)
V3b_of_r(r) = -1 * exp(-r^2 / 4)
E_max = 40
μω_global = 0.3
# compute three-body potential matrix elements
μω = μω_global * 2
basis = ho_basis_2B(E_max, Λ)
V3b_elem(l, n1, n2) = V_numerical(V3b_of_r, l, n1, n2; μω_gen=μω, atol=atol, maxevals=maxevals)
V_cache = prealloc_V_cache(basis.E_max, ComplexF64)
@time "V1" V1 = get_sp_V_matrix(V3b_elem, basis.n1s, basis.l1s, [basis.n2s, basis.l2s]; dtype=ComplexF64, cache=V_cache)
@time "V2" V2 = get_sp_V_matrix(V3b_elem, basis.n2s, basis.l2s, [basis.n1s, basis.l1s]; dtype=ComplexF64, cache=V_cache)
@time "V12" V12 = get_src_V12_matrix(V3b_of_r, basis, μω_global; atol=atol, maxevals=maxevals)
@time "V3b" V3b = (V1 * V2) * V12 # commutative?
H = get_3b_H_matrix(coord_system, V_of_r, μω_global, E_max, Λ, m) + V3b
@time "Eigenvalues" evals, _ = eigs(H, nev=3, ncv=30, which=:SR, maxiter=5000, tol=1e-5, ritzvec=false, check=1)
display(evals)