Missed one
This commit is contained in:
parent
29bbceac03
commit
9215bcad05
|
|
@ -1,17 +1,17 @@
|
||||||
using Plots
|
include("../EC.jl")
|
||||||
|
|
||||||
training_c = [2.6, 2.4, 2.2, 2.0, 1.8]
|
training_c = [2.6, 2.4, 2.2, 2.0, 1.8]
|
||||||
extrapolating_c = 0.0 : 0.2 : 1.2
|
extrapolating_c = 0.0 : 0.2 : 1.2
|
||||||
|
|
||||||
training_ref = -2.22 # complete list not needed because identification is simple
|
training_ref = -2.22 # complete list not needed because identification is simple
|
||||||
|
|
||||||
exact_ref = reverse([4.076662025307587-0.012709842443350328im,
|
extrapolating_ref = [4.076662025307587-0.012709842443350328im,
|
||||||
3.613318119833891-0.007335804709990623im,
|
3.613318119833891-0.007335804709990623im,
|
||||||
3.1453431847006783-0.004030580410326795im,
|
3.1453431847006783-0.004030580410326795im,
|
||||||
2.672967129943755-0.00211498327461944im,
|
2.672967129943755-0.00211498327461944im,
|
||||||
2.196542557810288-0.0010719835443437104im,
|
2.196542557810288-0.0010719835443437104im,
|
||||||
1.7164583929199813-0.0005455212208182736im,
|
1.7164583929199813-0.0005455212208182736im,
|
||||||
1.233088227541505-0.0003070320106485624im])
|
1.233088227541505-0.0003070320106485624im]
|
||||||
|
|
||||||
include("../p_space_3body_resonance.jl")
|
include("../p_space_3body_resonance.jl")
|
||||||
H0 = H
|
H0 = H
|
||||||
|
|
@ -29,58 +29,11 @@ end
|
||||||
@time "Vp2" Vp2 = W_left * Vp2_HO * transpose(W_right)
|
@time "Vp2" Vp2 = W_left * Vp2_HO * transpose(W_right)
|
||||||
@time "Vp" Vp = Vpb + Vp2
|
@time "Vp" Vp = Vpb + Vp2
|
||||||
|
|
||||||
# free memory
|
|
||||||
basis = Hb_blocks = Hb = basis_ho = V2_HO = W_right = W_left = V2 = nothing
|
|
||||||
GC.gc()
|
|
||||||
|
|
||||||
exact = ComplexF64[]
|
|
||||||
training = ComplexF64[]
|
|
||||||
extrapolated = ComplexF64[]
|
|
||||||
training_vecs = Vector{ComplexF64}[]
|
|
||||||
|
|
||||||
current_E = training_ref
|
|
||||||
|
|
||||||
for c in training_c
|
|
||||||
println("Training for c = $c")
|
|
||||||
|
|
||||||
local H = H0 + c .* Vp
|
|
||||||
local evals, evecs = eigs(H, sigma=current_E, 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
|
|
||||||
|
|
||||||
weights = repeat(kron(ws, ws), jmax + 1)
|
weights = repeat(kron(ws, ws), jmax + 1)
|
||||||
weights_mat = spdiagm(weights)
|
|
||||||
|
|
||||||
training_vecs = vcat(training_vecs, conj(training_vecs)) # CA-EC
|
EC = affine_EC(H0, Vp, weights)
|
||||||
println("Original EC dimensionality = $(length(training_vecs))")
|
train!(EC, training_c; ref_eval=training_ref, CAEC=true)
|
||||||
@time "Gram-Schmidt" training_vecs = gram_schmidt!(training_vecs, weights; verbose=true) # orthonormalization
|
extrapolate!(EC, extrapolating_c; ref_eval=extrapolating_ref)
|
||||||
|
|
||||||
EC_basis = hcat(training_vecs...)
|
exportCSV(EC, "temp/Berggren_B2R.csv")
|
||||||
H0_EC = transpose(EC_basis) * weights_mat * H0 * EC_basis
|
plot(EC, "temp/Berggren_B2R.pdf")
|
||||||
Vp_EC = transpose(EC_basis) * weights_mat * Vp * EC_basis
|
|
||||||
|
|
||||||
for c in extrapolating_c
|
|
||||||
println("Extrapolating for c = $c")
|
|
||||||
global current_E = pop!(exact_ref)
|
|
||||||
|
|
||||||
local H = H0 + c .* Vp
|
|
||||||
local evals, _ = eigs(H, sigma=current_E, maxiter=5000, tol=1e-5, ritzvec=false, check=1)
|
|
||||||
|
|
||||||
global current_E = nearest(evals, current_E)
|
|
||||||
push!(exact, current_E)
|
|
||||||
|
|
||||||
# extrapolation
|
|
||||||
H_EC = H0_EC + c .* Vp_EC
|
|
||||||
evals = eigvals(H_EC)
|
|
||||||
push!(extrapolated, nearest(evals, current_E))
|
|
||||||
end
|
|
||||||
|
|
||||||
exportCSV("temp/Berggren_B2R.csv", (training, exact, extrapolated), ("training", "exact", "extrapolated"))
|
|
||||||
|
|
||||||
scatter(real.(training),imag.(training), label="training")
|
|
||||||
scatter!(real.(exact),imag.(exact), label="exact")
|
|
||||||
scatter!(real.(extrapolated),imag.(extrapolated), label="extrapolated")
|
|
||||||
savefig("temp/Berggren_B2R.pdf")
|
|
||||||
Loading…
Reference in New Issue