Export wave function as HDF5

This commit is contained in:
Nuwan Yapa 2024-07-24 15:41:07 -04:00
parent 325e5bd7e5
commit c520717fdb
1 changed files with 27 additions and 0 deletions

27
ho_basis_3body_wf.jl Normal file
View File

@ -0,0 +1,27 @@
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, "μ1ω1", μ1ω1)
write_attribute(fid, "μ2ω2", μ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