Skip to content

Commit 1008814

Browse files
committed
improve WII coverage and fix
1 parent 9fcd381 commit 1008814

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/algorithms/timestep/wii.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ function make_time_mpo(
2828
WC = H.C
2929
WD = H.D
3030

31-
δ = imaginary_evolution ? -dt : (-1im * dt)
31+
# needs to be complex if negative because of square root
32+
δ = imaginary_evolution ? -complex(dt) : (-1im * dt)
3233
exp_alg = Arnoldi(; alg.tol, alg.maxiter)
3334

3435
Wnew = map(1:length(H)) do i
@@ -109,9 +110,9 @@ function make_time_mpo(
109110
H′[1][end, 1, 1, end] = H′[1][1, 1, 1, 1]
110111
H′[end][1, 1, 1, 1] = H′[end][end, 1, 1, end]
111112

112-
mpo = make_time_mpo(InfiniteMPOHamiltonian(H′), dt, alg; tol, imaginary_evolution)
113+
mpo = make_time_mpo(InfiniteMPOHamiltonian(H′), dt, alg; imaginary_evolution)
113114

114115
# Impose boundary conditions
115116
mpo_fin = open_boundary_conditions(mpo, length(H))
116-
return remove_orphans!(mpo_fin; tol)
117+
return remove_orphans!(mpo_fin; alg.tol)
117118
end

test/algorithms.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,13 @@ module TestAlgorithms
971971
E_x_taylor = @constinferred expectation_value(rho_taylor_1, 1 => S_x())
972972
E_xx_taylor = @constinferred expectation_value(rho_taylor_1, (1, 2) => S_xx())
973973

974+
# WII
975+
rho_wii = make_time_mpo(H, beta, WII(); imaginary_evolution = true)
976+
Z_wii = tr(rho_wii)^(1 / L)
977+
@test Z_wii Z_dense_1 atol = 1.0e-2
978+
@test expectation_value(rho_wii, 1 => S_x()) E_x_taylor atol = 1.0e-2
979+
@test expectation_value(rho_wii, (1, 2) => S_xx()) E_xx_taylor atol = 1.0e-2
980+
974981
# MPO multiplication
975982
rho_mps = convert(FiniteMPS, rho_taylor_1)
976983
rho_mps, = approximate(rho_mps, (rho_taylor_1, rho_mps), DMRG2(; trscheme, verbosity))

0 commit comments

Comments
 (0)