Skip to content

Commit bdb140a

Browse files
committed
Fix 2d heisenberg and add warning
1 parent 1356db4 commit bdb140a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

examples/vumps/vumps_2d_heisenberg.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ function ITensorInfiniteMPS.unit_cell_terms(::Model"heisenberg2D"; width)
3434
opsum = OpSum()
3535
for i in 1:width
3636
# Vertical
37-
opsum += -0.5, "S+", i, "S-", mod(i + 1, width)
38-
opsum += -0.5, "S-", i, "S+", mod(i + 1, width)
39-
opsum += "Sz", i, "Sz", mod(i + 1, width)
37+
opsum += -0.5, "S+", i, "S-", mod(i, width) + 1
38+
opsum += -0.5, "S-", i, "S+", mod(i, width) + 1
39+
opsum += "Sz", i, "Sz", mod(i, width) + 1
4040
# Horizontal
4141
opsum += -0.5, "S+", i, "S-", i + width
4242
opsum += -0.5, "S-", i, "S+", i + width

src/models/models.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ function infinite_terms(opsum::OpSum; kwargs...)
245245
# stores all terms starting on site `i`.
246246
opsum_cell_dict = groupreduce(minimum ITensors.sites, +, opsum)
247247
nsites = maximum(keys(opsum_cell_dict))
248+
# check that we don't have terms we will ignore
249+
dropped = filter(x -> x <= 0, keys(opsum_cell_dict))
250+
if length(dropped) > 0
251+
@warn "The input unit cell terms include terms that are being ignored on sites: $([d for d in dropped])"
252+
end
253+
248254
# Assumes each site in the unit cell has a term
249255
for j in 1:nsites
250256
if !haskey(opsum_cell_dict, j)

0 commit comments

Comments
 (0)