Skip to content

Commit

Permalink
Fix 2d heisenberg and add warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanlevy committed Oct 11, 2024
1 parent 1356db4 commit bdb140a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/vumps/vumps_2d_heisenberg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ function ITensorInfiniteMPS.unit_cell_terms(::Model"heisenberg2D"; width)
opsum = OpSum()
for i in 1:width
# Vertical
opsum += -0.5, "S+", i, "S-", mod(i + 1, width)
opsum += -0.5, "S-", i, "S+", mod(i + 1, width)
opsum += "Sz", i, "Sz", mod(i + 1, width)
opsum += -0.5, "S+", i, "S-", mod(i, width) + 1
opsum += -0.5, "S-", i, "S+", mod(i, width) + 1
opsum += "Sz", i, "Sz", mod(i, width) + 1
# Horizontal
opsum += -0.5, "S+", i, "S-", i + width
opsum += -0.5, "S-", i, "S+", i + width
Expand Down
6 changes: 6 additions & 0 deletions src/models/models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ function infinite_terms(opsum::OpSum; kwargs...)
# stores all terms starting on site `i`.
opsum_cell_dict = groupreduce(minimum ITensors.sites, +, opsum)
nsites = maximum(keys(opsum_cell_dict))
# check that we don't have terms we will ignore
dropped = filter(x -> x <= 0, keys(opsum_cell_dict))
if length(dropped) > 0
@warn "The input unit cell terms include terms that are being ignored on sites: $([d for d in dropped])"
end

# Assumes each site in the unit cell has a term
for j in 1:nsites
if !haskey(opsum_cell_dict, j)
Expand Down

0 comments on commit bdb140a

Please sign in to comment.