Remove useless code
This commit is contained in:
parent
027d5a3e3f
commit
751bfe193e
28
ho_basis.jl
28
ho_basis.jl
|
|
@ -4,33 +4,7 @@ using LRUCache
|
||||||
include("common.jl")
|
include("common.jl")
|
||||||
include("math.jl")
|
include("math.jl")
|
||||||
|
|
||||||
"1-body HO basis"
|
"2-body HO basis (used for 3-body systems without the CM DOF)"
|
||||||
struct ho_basis_1B
|
|
||||||
dim::Int # dimensionality of the basis
|
|
||||||
Es::Vector{Int}
|
|
||||||
ns::Vector{Int}
|
|
||||||
ls::Vector{Int}
|
|
||||||
|
|
||||||
function ho_basis_1B(E_max)
|
|
||||||
Es = Int[]
|
|
||||||
ns = Int[]
|
|
||||||
ls = Int[]
|
|
||||||
|
|
||||||
# E = 2*n + l
|
|
||||||
for E in 0 : E_max
|
|
||||||
for n in 0 : E ÷ 2
|
|
||||||
l = E - 2*n
|
|
||||||
push!(Es, E)
|
|
||||||
push!(ns, n)
|
|
||||||
push!(ls, l)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return new(length(Es), Es, ns, ls)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
"2-body HO basis"
|
|
||||||
struct ho_basis_2B
|
struct ho_basis_2B
|
||||||
E_max::Int
|
E_max::Int
|
||||||
Λ::Int
|
Λ::Int
|
||||||
|
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
using Arpack, SparseArrays
|
|
||||||
include("ho_basis.jl")
|
|
||||||
|
|
||||||
E_max = 30
|
|
||||||
μω_gen = 0.2
|
|
||||||
Λ = 0
|
|
||||||
m = 1.0
|
|
||||||
|
|
||||||
Va = -2
|
|
||||||
Ra = 2
|
|
||||||
|
|
||||||
μ1 = m * 1/2
|
|
||||||
|
|
||||||
println("No of threads = ", Threads.nthreads())
|
|
||||||
|
|
||||||
basis = ho_basis_1B(E_max)
|
|
||||||
println("Basis size = ", basis.dim)
|
|
||||||
|
|
||||||
println("Constructing KE matrices")
|
|
||||||
@time "T1" T1 = get_sp_T_matrix(basis.ns, basis.ls; μω_gen=μω_gen, μ=μ1)
|
|
||||||
|
|
||||||
println("Constructing PE matrices")
|
|
||||||
V1_elem(l, n1, n2) = Va * V_Gaussian(Ra, l, n1, n2; μω_gen=μω_gen)
|
|
||||||
@time "V1" V1 = get_sp_V_matrix(V1_elem, basis.ns, basis.ls; E_max=E_max)
|
|
||||||
|
|
||||||
println("Calculating spectrum")
|
|
||||||
@time "H" H = T1 + V1
|
|
||||||
@time "Eigenvalues" evals, _ = eigs(H, nev=3, ncv=30, which=:SR, maxiter=5000, tol=1e-5, ritzvec=false, check=1)
|
|
||||||
|
|
||||||
display(evals)
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
using HDF5
|
|
||||||
|
|
||||||
include("ho_basis_3body.jl")
|
|
||||||
|
|
||||||
@time "Eigenvectors" evals, evecs = eigs(H, nev=1, ncv=10, which=:SR, maxiter=5000, tol=1e-8, ritzvec=true, check=1)
|
|
||||||
|
|
||||||
idx = argmin(real.(evals))
|
|
||||||
|
|
||||||
E = evals[idx]
|
|
||||||
@assert imag(E) ≈ 0 "Energy is not real"
|
|
||||||
E = real(E)
|
|
||||||
println("Exporting E = $E")
|
|
||||||
|
|
||||||
wf = real.(evecs[:, idx])
|
|
||||||
@assert all(imag.(wf) .≈ 0) "Wave function is not real"
|
|
||||||
wf = real.(wf)
|
|
||||||
|
|
||||||
h5open("temp/HO_3b.h5", "w") do fid
|
|
||||||
write_attribute(fid, "E", E)
|
|
||||||
write_attribute(fid, "Λ", Λ)
|
|
||||||
write_attribute(fid, "μ1ω1", μ1ω1)
|
|
||||||
write_attribute(fid, "μ2ω2", μ2ω2)
|
|
||||||
write_attribute(fid, "μ1", μ1)
|
|
||||||
write_attribute(fid, "μ2", μ2)
|
|
||||||
write_dataset(fid, "n1", n1s)
|
|
||||||
write_dataset(fid, "l1", l1s)
|
|
||||||
write_dataset(fid, "n2", n2s)
|
|
||||||
write_dataset(fid, "l2", l2s)
|
|
||||||
write_dataset(fid, "wf", wf)
|
|
||||||
end
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
using LinearAlgebra
|
using LinearAlgebra
|
||||||
include("ho_basis.jl")
|
include("../ho_basis.jl")
|
||||||
|
|
||||||
l = 0
|
l = 0
|
||||||
V0 = -10
|
V0 = -10
|
||||||
Loading…
Reference in New Issue