Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 2d heisenberg example and add error for bad unit cell inputs #88

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
ryanlevy marked this conversation as resolved.
Show resolved Hide resolved
# 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))
mtfishman marked this conversation as resolved.
Show resolved Hide resolved
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
Loading