Skip to content

Commit

Permalink
time evaluation in windowtdvp
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanMaertens committed Sep 8, 2023
1 parent fbea218 commit 5d5d7bd
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/algorithms/timestep/windowtdvp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,23 @@ function timestep!(Ψ::WindowMPS, H::Window, t::Number, dt::Number,alg::TDVP,env
end

# some Notes
# - at what time do we evaluate h_ac and c? at t, t+dt/4 ? do we take both at the same time?
# - at what time do we evaluate h_ac and c? at t, t+dt/4 ? do we take both at the same time? integrate itself already evaluates at t+dt/2 I think

#left to right sweep on window
for i in 1:(length(Ψ)-1)
h_ac = ∂∂AC(i,Ψ,H.middle,env.middle);
Ψ.AC[i], converged, convhist = integrate(h_ac,Ψ.AC[i],t+dt/2,-1im,dt/2,alg.integrator)
Ψ.AC[i], converged, convhist = integrate(h_ac,Ψ.AC[i],t,-1im,dt/2,alg.integrator)
converged == 0 &&
@info "time evolving ac($i) failed $(convhist.normres)"

h_c = ∂∂C(i,Ψ,H.middle,env.middle);
Ψ.CR[i], converged, convhist = integrate(h_c,Ψ.CR[i],t+dt/2,-1im,-dt/2,alg.integrator)
Ψ.CR[i], converged, convhist = integrate(h_c,Ψ.CR[i],t,-1im,-dt/2,alg.integrator)
converged == 0 &&
@info "time evolving c($i) failed $(convhist.normres)"
end

h_ac = ∂∂AC(length(Ψ),Ψ,H.middle,env.middle);
Ψ.AC[end], converged, convhist = integrate(h_ac,Ψ.AC[end],t+dt/2,-1im,dt/2,alg.integrator)
Ψ.AC[end], converged, convhist = integrate(h_ac,Ψ.AC[end],t,-1im,dt/2,alg.integrator)
converged == 0 &&
@info "time evolving ac($(length(Ψ))) failed $(convhist.normres)"

Expand All @@ -123,18 +123,18 @@ function timestep!(Ψ::WindowMPS, H::Window, t::Number, dt::Number,alg::TDVP,env
#right to left sweep on window
for i in length(Ψ):-1:2
h_ac = ∂∂AC(i,Ψ,H.middle,env.middle);
Ψ.AC[i], converged, convhist = integrate(h_ac,Ψ.AC[i],t+dt/2,-1im,dt/2,alg.integrator)
Ψ.AC[i], converged, convhist = integrate(h_ac,Ψ.AC[i],t,-1im,dt/2,alg.integrator)
converged == 0 &&
@info "time evolving ac($i) failed $(convhist.normres)"

h_c = ∂∂C(i-1,Ψ,H.middle,env.middle);
Ψ.CR[i-1], converged, convhist = integrate(h_c,Ψ.CR[i-1],t+dt/2,-1im,-dt/2,alg.integrator)
Ψ.CR[i-1], converged, convhist = integrate(h_c,Ψ.CR[i-1],t,-1im,-dt/2,alg.integrator)
converged == 0 &&
@info "time evolving c($(i-1)) failed $(convhist.normres)"
end

h_ac = ∂∂AC(1,Ψ,H.middle,env.middle);
Ψ.AC[1], converged, convhist = integrate(h_ac,Ψ.AC[1],t+dt/2,-1im,dt/2,alg.integrator)
Ψ.AC[1], converged, convhist = integrate(h_ac,Ψ.AC[1],t,-1im,dt/2,alg.integrator)
converged == 0 &&
@info "time evolving ac(1) failed $(convhist.normres)"

Expand All @@ -159,7 +159,7 @@ function timestep!(Ψ::WindowMPS, H::Window, t::Number, dt::Number,alg::TDVP2,en
for i in 1:(length(Ψ)-1)
h_ac2 = ∂∂AC2(i,Ψ,H.middle,env.middle);
ac2 = Ψ.AC[i]*_transpose_tail.AR[i+1]);
ac2, converged, convhist = integrate(h_ac2,ac2,t+dt/2,-1im,dt/2,alg.integrator)
ac2, converged, convhist = integrate(h_ac2,ac2,t,-1im,dt/2,alg.integrator)
converged == 0 &&
@info "time evolving ac2($i) failed $(convhist.normres)"
(U,S,V) = tsvd(ac2, alg = TensorKit.SVD(), trunc = alg.trscheme);
Expand All @@ -169,7 +169,7 @@ function timestep!(Ψ::WindowMPS, H::Window, t::Number, dt::Number,alg::TDVP2,en

if i < length(Ψ) - 1
h_ac = ∂∂AC(i+1,Ψ,H.middle,env.middle);
Ψ.AC[i+1], converged, convhist = integrate(h_ac,Ψ.AC[i+1],t+dt/2,-1im,-dt/2,alg.integrator)
Ψ.AC[i+1], converged, convhist = integrate(h_ac,Ψ.AC[i+1],t,-1im,-dt/2,alg.integrator)
converged == 0 &&
@info "time evolving ac($i) failed $(convhist.normres)"
end
Expand All @@ -189,7 +189,7 @@ function timestep!(Ψ::WindowMPS, H::Window, t::Number, dt::Number,alg::TDVP2,en
for i in length(Ψ):-1:2
h_ac2 = ∂∂AC2(i-1,Ψ,H.middle,env.middle);
ac2 = Ψ.AL[i-1]*_transpose_tail.AC[i]);
ac2, converged, convhist = integrate(h_ac2,ac2, t+dt/2,-1im,dt/2,alg.integrator)
ac2, converged, convhist = integrate(h_ac2,ac2, t,-1im,dt/2,alg.integrator)
converged == 0 &&
@info "time evolving ac2($i) failed $(convhist.normres)"
(U,S,V) = tsvd(ac2, alg = TensorKit.SVD(), trunc = alg.trscheme);
Expand All @@ -199,7 +199,7 @@ function timestep!(Ψ::WindowMPS, H::Window, t::Number, dt::Number,alg::TDVP2,en

if i > 2
h_ac = ∂∂AC(i-1,Ψ,H.middle,env.middle);
Ψ.AC[i-1], converged, convhist = integrate(h_ac,Ψ.AC[i-1],t+dt/2,-1im,-dt/2,alg.integrator)
Ψ.AC[i-1], converged, convhist = integrate(h_ac,Ψ.AC[i-1],t,-1im,-dt/2,alg.integrator)
converged == 0 &&
@info "time evolving ac($i) failed $(convhist.normres)"
end
Expand Down

0 comments on commit 5d5d7bd

Please sign in to comment.