Skip to content

Commit 5cadd59

Browse files
committed
Fix edge logic for AC2_hamiltonian
1 parent beb25e4 commit 5cadd59

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/algorithms/derivatives/hamiltonian_derivatives.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ function AC2_hamiltonian(site::Int, below::_HAM_MPS_TYPES,
245245
end
246246

247247
# finished
248-
if !ismissing(IC)
248+
if isfinite(operator) && site + 1 == length(operator)
249+
II = missing
250+
elseif !ismissing(IC)
249251
I = id(storagetype(GR[1]), physicalspace(W2))
250252
@plansor IC[-1 -2; -3 -4] += I[-1; -3] * removeunit(GR[1], 2)[-4; -2]
251253
II = missing
@@ -258,7 +260,9 @@ function AC2_hamiltonian(site::Int, below::_HAM_MPS_TYPES,
258260
end
259261

260262
# unstarted
261-
if !ismissing(BE)
263+
if isfinite(operator) && site == 1
264+
EE = missing
265+
elseif !ismissing(BE)
262266
I = id(storagetype(GL[end]), physicalspace(W1))
263267
@plansor BE[-1 -2; -3 -4] += removeunit(GL[end], 2)[-1; -3] * I[-2; -4]
264268
EE = missing

0 commit comments

Comments
 (0)