Skip to content

Commit

Permalink
I need to stop undoing my bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanMaertens committed Aug 30, 2023
1 parent c22ef92 commit fbea218
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/algorithms/expval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,19 @@ expectation_value(Ψ::WindowMPS,windowH::Window, at::Int64) = expectation_value(
expectation_value::WindowMPS,windowH::Window, windowEnvs=environments(Ψ,windowH)) = expectation_value(Ψ,windowH, 0., windowEnvs)

# with time argument
function expectation_value::WindowMPS,windowH::Window,t::Number,at::Int64)
function expectation_value::WindowMPS,windowOp::Window,t::Number,at::Int64)
if at < 1
return expectation_value.left_gs,windowH.left,t,at)
return expectation_value.left_gs,windowOp.left,t,at)
elseif 1 <= at <= length.window)
return expectation_value(Ψ,windowH.middle,t,at)
return expectation_value(Ψ,windowOp.middle,t,at)
else
return expectation_value.right_gs,windowH.right,t,at)
return expectation_value.right_gs,windowOp.right,t,at)
end
end

function expectation_value::WindowMPS,windowH::Window,t::Number,windowEnvs::Window{C,D,C}=environments(Ψ,windowH)) where {C <: Union{MultipleEnvironments,Cache}, D <: Union{MultipleEnvironments,Cache}}
left = expectation_value.left_gs,windowH.left,t,windowEnvs.left)
middle = expectation_value(Ψ,windowH.middle,t,windowEnvs.middle)
middle = expectation_value.window,windowH.middle,t,windowEnvs.middle)
right = expectation_value.right_gs,windowH.right,t,windowEnvs.right)
return [left.data...,middle...,right.data...]
end
10 changes: 5 additions & 5 deletions src/algorithms/timestep/windowtdvp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,18 @@ function timestep!(Ψ::WindowMPS, H::Window, t::Number, dt::Number,alg::TDVP,env
#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,-1im,dt/2,alg.integrator)
Ψ.AC[i], converged, convhist = integrate(h_ac,Ψ.AC[i],t+dt/2,-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,-1im,-dt/2,alg.integrator)
Ψ.CR[i], converged, convhist = integrate(h_c,Ψ.CR[i],t+dt/2,-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,-1im,dt/2,alg.integrator)
Ψ.AC[end], converged, convhist = integrate(h_ac,Ψ.AC[end],t+dt/2,-1im,dt/2,alg.integrator)
converged == 0 &&
@info "time evolving ac($(length(Ψ))) failed $(convhist.normres)"

Expand Down Expand Up @@ -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,-1im,dt/2,alg.integrator)
ac2, converged, convhist = integrate(h_ac2,ac2,t+dt/2,-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,-1im,-dt/2,alg.integrator)
Ψ.AC[i+1], converged, convhist = integrate(h_ac,Ψ.AC[i+1],t+dt/2,-1im,-dt/2,alg.integrator)
converged == 0 &&
@info "time evolving ac($i) failed $(convhist.normres)"
end
Expand Down

0 comments on commit fbea218

Please sign in to comment.