using Roots, DelimitedFiles include("../EC.jl") include("../common.jl") include("../p_space.jl") μ = 0.5 V_system(c) = (p, q) -> c*(-5*g0(sqrt(3), p, q) + 2*g0(sqrt(10), p, q)) # ResonanceEC: Eq. (20) # determining c0 with EC temp_c = range(1.1, 0.9, 3) p, w = get_mesh([0, 8], [256]) H0 = get_T_matrix(p, μ) V = get_V_matrix(V_system(1), p, w) EC = affine_EC(H0, V, w) train!(EC, temp_c; ref_eval=-0.2, CAEC=false, verbose=false) quick_extrapolate(c) = minimum(abs2, get_extrapolated_evals(EC.H0_EC, EC.H1_EC, EC.N_EC, c, 0)) c0 = find_zero(quick_extrapolate, 0.85) training_c = range(1.2, 0.9, 9) # original: range(1.35, 0.9, 5) extrapolating_c = range(0.78, 0.45, 7) # original: range(0.75, 0.40, 8) data_c = vcat(training_c, extrapolating_c) data_E = [quick_pole_E(V_system(c)) for c in data_c] # export to CSV file = "temp/2body_data.csv" delim = ',' open(file, "w") do f writedlm(f, ["c" "re_E" "im_E"], delim) writedlm(f, [c0 0 0], delim) # first entry for the threshold writedlm(f, hcat(data_c, real.(data_E), imag.(data_E)), delim) end