From 751bfe193e589ad23e2f598efb887638abb6522a Mon Sep 17 00:00:00 2001 From: Nuwan Yapa Date: Thu, 16 Jan 2025 14:33:42 -0500 Subject: [PATCH] Remove useless code --- ho_basis.jl | 28 +-------------------- ho_basis_2body.jl | 30 ----------------------- ho_basis_3body_wf.jl | 30 ----------------------- ho_basis_test.jl => test/ho_basis_test.jl | 2 +- 4 files changed, 2 insertions(+), 88 deletions(-) delete mode 100644 ho_basis_2body.jl delete mode 100644 ho_basis_3body_wf.jl rename ho_basis_test.jl => test/ho_basis_test.jl (90%) diff --git a/ho_basis.jl b/ho_basis.jl index ebbc769..0b555d1 100644 --- a/ho_basis.jl +++ b/ho_basis.jl @@ -4,33 +4,7 @@ using LRUCache include("common.jl") include("math.jl") -"1-body HO basis" -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" +"2-body HO basis (used for 3-body systems without the CM DOF)" struct ho_basis_2B E_max::Int Λ::Int diff --git a/ho_basis_2body.jl b/ho_basis_2body.jl deleted file mode 100644 index 3287d3a..0000000 --- a/ho_basis_2body.jl +++ /dev/null @@ -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) \ No newline at end of file diff --git a/ho_basis_3body_wf.jl b/ho_basis_3body_wf.jl deleted file mode 100644 index 3440199..0000000 --- a/ho_basis_3body_wf.jl +++ /dev/null @@ -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 diff --git a/ho_basis_test.jl b/test/ho_basis_test.jl similarity index 90% rename from ho_basis_test.jl rename to test/ho_basis_test.jl index 5d9e436..4c3dd57 100644 --- a/ho_basis_test.jl +++ b/test/ho_basis_test.jl @@ -1,5 +1,5 @@ using LinearAlgebra -include("ho_basis.jl") +include("../ho_basis.jl") l = 0 V0 = -10