Hey all,
I am trying to implement the TDVP function, and I get some weird error that I couldn’t figure out what is the reason.
Basically, I am trying the develop in imaginary time the following wave function
And for some reason I am getting a “InexactError”.
Can someone help me out understand this ?
some example:
n=3
site=siteinds("Qubit",n)
psi=MPS(site, n->"Up")
tau=0.1
for I=1:20
psi=tdvp(H_bath,psi,-τ;cutoff=1e-28)
normalize!(psi)
end
H is some Hamiltonian that describes long-ranged interactions.
For local Hamiltonian there is no error.
I will also add the error in case it will help…
Thanks a lot in advance!
The error is:
ERROR: LoadError: InexactError: Float64(0.5734939687060105 + 2.90389650522495e-17im)
Stacktrace:
[1] Real
@ ./complex.jl:44 [inlined]
[2] convert
@ ./number.jl:7 [inlined]
[3] setindex!(::Matrix{Float64}, ::ComplexF64, ::Int64, ::Int64)
@ Base ./array.jl:905
[4] applyexp(H::ProjMPO, tau::Float64, x0::ITensor; kwargs::Base.Pairs{Symbol, Real, NTuple{4, Symbol}, NamedTuple{(:tol, :maxiter, :outputlevel, :current_time), Tuple{Float64, Int64, Int64, Float64}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/c3OYY/src/applyexp.jl:54
[5] (::ITensorTDVP.var"#solver#38"{ITensorTDVP.var"#solver#37#39"{Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:cutoff,), Tuple{Float64}}}}})(H::ProjMPO, t::Float64, psi0::ITensor; kws::Base.Pairs{Symbol, Real, Tuple{Symbol, Symbol}, NamedTuple{(:current_time, :outputlevel), Tuple{Float64, Int64}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/c3OYY/src/tdvp.jl:27
[6] tdvp_site_update!(nsite_val::Val{2}, reverse_step_val::Val{true}, solver::ITensorTDVP.var"#solver#38"{ITensorTDVP.var"#solver#37#39"{Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:cutoff,), Tuple{Float64}}}}}, PH::ProjMPO, psi::MPS, b::Int64; current_time::Float64, outputlevel::Int64, time_step::Float64, normalize::Bool, direction::Base.Order.ForwardOrdering, noise::Float64, which_decomp::Nothing, svd_alg::String, cutoff::Float64, maxdim::Int64, mindim::Int64, maxtruncerr::Float64)
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/c3OYY/src/tdvp_step.jl:356
[7] tdvp_site_update!(solver::ITensorTDVP.var"#solver#38"{ITensorTDVP.var"#solver#37#39"{Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:cutoff,), Tuple{Float64}}}}}, PH::ProjMPO, psi::MPS, b::Int64; nsite::Int64, reverse_step::Bool, current_time::Float64, outputlevel::Int64, time_step::Float64, normalize::Bool, direction::Base.Order.ForwardOrdering, noise::Float64, which_decomp::Nothing, svd_alg::String, cutoff::Float64, maxdim::Int64, mindim::Int64, maxtruncerr::Float64)
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/c3OYY/src/tdvp_step.jl:157
[8] tdvp_sweep(direction::Base.Order.ForwardOrdering, solver::Function, PH::ProjMPO, time_step::Float64, psi::MPS; kwargs::Base.Pairs{Symbol, Real, NTuple{7, Symbol}, NamedTuple{(:current_time, :cutoff, :reverse_step, :sweep, :maxdim, :mindim, :noise), Tuple{Float64, Float64, Bool, Int64, Int64, Int64, Float64}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/c3OYY/src/tdvp_step.jl:80
[9] tdvp_step(order::ITensorTDVP.TDVPOrder{2, Base.Order.ForwardOrdering()}, solver::Function, PH::ProjMPO, time_step::Float64, psi::MPS; current_time::Float64, kwargs::Base.Pairs{Symbol, Real, NTuple{6, Symbol}, NamedTuple{(:cutoff, :reverse_step, :sweep, :maxdim, :mindim, :noise), Tuple{Float64, Bool, Int64, Int64, Int64, Float64}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/c3OYY/src/tdvp_step.jl:9
[10] macro expansion
@ ~/.julia/packages/ITensorTDVP/c3OYY/src/tdvp_generic.jl:84 [inlined]
[11] macro expansion
@ ./timing.jl:299 [inlined]
[12] tdvp(solver::Function, PH::ProjMPO, t::Float64, psi0::MPS; kwargs::Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:cutoff,), Tuple{Float64}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/c3OYY/src/tdvp_generic.jl:83
[13] tdvp(solver::Function, H::MPO, t::Float64, psi0::MPS; kwargs::Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:cutoff,), Tuple{Float64}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/c3OYY/src/tdvp_generic.jl:150
[14] tdvp(H::MPO, t::Float64, psi0::MPS; kwargs::Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:cutoff,), Tuple{Float64}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/c3OYY/src/tdvp.jl:47
[15] #tdvp#43
@ ~/.julia/packages/ITensorTDVP/c3OYY/src/tdvp.jl:55 [inlined]
[16] top-level scope
@ ~/Desktop/projects/Density_matrix/Decoherence/Energy_density.jl:72
in expression starting at /home/Tomer/Desktop/projects/Density_matrix/Decoherence/Energy_density.jl:70