Export wave function as HDF5
This commit is contained in:
parent
325e5bd7e5
commit
c520717fdb
|
|
@ -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
|
||||||
Loading…
Reference in New Issue