Skip to content

Commit 61972ce

Browse files
committed
Fix yperiodic term
1 parent 33c38cf commit 61972ce

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

examples/vumps/vumps_2d_heisenberg.jl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,16 @@ function ITensorInfiniteMPS.unit_cell_terms(::Model"heisenberg2D"; width, yperio
3535
opsum = OpSum()
3636
for i in 1:width
3737
# Vertical
38-
opsum -= 0.5, "S+", i, "S-", i + 1
39-
opsum -= 0.5, "S-", i, "S+", i + 1
40-
opsum += "Sz", i, "Sz", i + 1
38+
if i < width || yperiodic
39+
opsum -= 0.5, "S+", i, "S-", mod(i, width) + 1
40+
opsum -= 0.5, "S-", i, "S+", mod(i, width) + 1
41+
opsum += "Sz", i, "Sz", mod(i, width) + 1
42+
end
4143
# Horizontal
4244
opsum -= 0.5, "S+", i, "S-", i + width
4345
opsum -= 0.5, "S-", i, "S+", i + width
4446
opsum += "Sz", i, "Sz", i + width
4547
end
46-
if yperiodic
47-
opsum -= 0.5, "S+", 1, "S-", width
48-
opsum -= 0.5, "S-", 1, "S+", width
49-
opsum += "Sz", 1, "Sz", width
50-
end
5148
return opsum
5249
end
5350
model = Model("heisenberg2D")

0 commit comments

Comments
 (0)