86 lines
2.4 KiB
Julia
86 lines
2.4 KiB
Julia
using Arpack, SparseArrays, LRUCache
|
|
using DelimitedFiles, Plots
|
|
include("../ho_basis.jl")
|
|
|
|
Λ = 0
|
|
m = 1.0
|
|
V_of_r(r) = -5 * exp(-r^2 / 3) + 2 * exp(-r^2 / 10)
|
|
|
|
E_max = 40
|
|
μω_global = 0.2 * 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
|
|
|
|
println("No of threads = ", Threads.nthreads())
|
|
|
|
basis = ho_basis_2B(E_max, Λ)
|
|
l_max = max(maximum(basis.l1s), maximum(basis.l2s))
|
|
n_max = max(maximum(basis.n1s), maximum(basis.n2s))
|
|
|
|
println("Basis size = ", basis.dim)
|
|
|
|
@time "T1" T1 = get_sp_T_matrix(basis.n1s, basis.l1s; mask=mask1(basis), μω_gen=μ1ω1, μ=μ1)
|
|
@time "T2" T2 = get_sp_T_matrix(basis.n2s, basis.l2s; mask=mask2(basis), μω_gen=μ2ω2, μ=μ2)
|
|
|
|
@time "V" Vb = get_jacobi_V_matrix(V_of_r, basis, μ1ω1, μω_global)
|
|
|
|
@time "H0" Ha = T1 + T2
|
|
|
|
# free memory
|
|
basis = T1 = T2 = V1_cache = V_relative_cache = V1 = V_relative = U = V2 = nothing
|
|
GC.gc()
|
|
|
|
current_E = -0.26141959851000807
|
|
|
|
training_c = range(1.1, 0.9, 5)
|
|
extrapolating_c = range(0.78, 0.45, 7)
|
|
|
|
exact = ComplexF64[]
|
|
training = ComplexF64[]
|
|
extrapolated = ComplexF64[]
|
|
training_vecs = Vector{ComplexF64}[]
|
|
|
|
for c in training_c
|
|
println("Training for c = $c")
|
|
H = Ha + c .* Vb
|
|
evals, evecs = eigs(H, nev=3, ncv=24, which=:LI, maxiter=5000, tol=1e-5, ritzvec=true, check=1)
|
|
|
|
global current_E = nearest(evals, current_E)
|
|
push!(training, current_E)
|
|
push!(training_vecs, evecs[:, nearestIndex(evals, current_E)])
|
|
end
|
|
|
|
# CA-EC
|
|
training_vecs = vcat(training_vecs, conj(training_vecs))
|
|
|
|
EC_basis = hcat(training_vecs...)
|
|
N_EC = transpose(EC_basis) * EC_basis
|
|
Ha_EC = transpose(EC_basis) * Ha * EC_basis
|
|
Vb_EC = transpose(EC_basis) * Vb * EC_basis
|
|
|
|
current_E = 0.05387926316280764 - 0.008900278183544552im
|
|
|
|
for c in extrapolating_c
|
|
println("Extrapolating for c = $c")
|
|
H = Ha + c .* Vb
|
|
evals, evecs = eigs(H, nev=3, ncv=24, which=:LI, maxiter=5000, tol=1e-5, ritzvec=true, check=1)
|
|
|
|
global current_E = nearest(evals, current_E)
|
|
push!(exact, current_E)
|
|
|
|
# extrapolation
|
|
H_EC = Ha_EC + c .* Vb_EC
|
|
evals = eigvals(H_EC, N_EC)
|
|
push!(extrapolated, nearest(evals, current_E))
|
|
end
|
|
|
|
scatter(real.(training),imag.(training), label="training")
|
|
scatter!(real.(exact),imag.(exact), label="exact")
|
|
scatter!(real.(extrapolated),imag.(extrapolated), label="extrapolated")
|
|
xlims!(-0.3, 0.3)
|
|
ylims!(-0.2, 0)
|
|
savefig("temp/2in3_HO_B2R.pdf") |