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 #95

Merged
merged 5 commits into from
Nov 5, 2024
Merged

Fix 2D Heisenberg Example #95

merged 5 commits into from
Nov 5, 2024

Conversation

ryanlevy
Copy link
Contributor

(Reported in the discourse) In removing the mod of the previous PR the yperiodic term was incorrect - there are width Horizontal bonds and width-1 vertical and 1 potential wrapping. This should be the correct terms (and looks nicer than the previous version)
With yperiodic=true

opsum = sum(
  -0.5 S+(1,) S-(2,)
  -0.5 S-(1,) S+(2,)
  1.0 Sz(1,) Sz(2,)
  -0.5 S+(1,) S-(5,)
  -0.5 S-(1,) S+(5,)
  1.0 Sz(1,) Sz(5,)
  -0.5 S+(2,) S-(3,)
  -0.5 S-(2,) S+(3,)
  1.0 Sz(2,) Sz(3,)
  -0.5 S+(2,) S-(6,)
  -0.5 S-(2,) S+(6,)
  1.0 Sz(2,) Sz(6,)
  -0.5 S+(3,) S-(4,)
  -0.5 S-(3,) S+(4,)
  1.0 Sz(3,) Sz(4,)
  -0.5 S+(3,) S-(7,)
  -0.5 S-(3,) S+(7,)
  1.0 Sz(3,) Sz(7,)
  -0.5 S+(4,) S-(1,)
  -0.5 S-(4,) S+(1,)
  1.0 Sz(4,) Sz(1,)
  -0.5 S+(4,) S-(8,)
  -0.5 S-(4,) S+(8,)
  1.0 Sz(4,) Sz(8,)

and yperiodic=false

opsum = sum(
  -0.5 S+(1,) S-(2,)
  -0.5 S-(1,) S+(2,)
  1.0 Sz(1,) Sz(2,)
  -0.5 S+(1,) S-(5,)
  -0.5 S-(1,) S+(5,)
  1.0 Sz(1,) Sz(5,)
  -0.5 S+(2,) S-(3,)
  -0.5 S-(2,) S+(3,)
  1.0 Sz(2,) Sz(3,)
  -0.5 S+(2,) S-(6,)
  -0.5 S-(2,) S+(6,)
  1.0 Sz(2,) Sz(6,)
  -0.5 S+(3,) S-(4,)
  -0.5 S-(3,) S+(4,)
  1.0 Sz(3,) Sz(4,)
  -0.5 S+(3,) S-(7,)
  -0.5 S-(3,) S+(7,)
  1.0 Sz(3,) Sz(7,)
  -0.5 S+(4,) S-(8,)
  -0.5 S-(4,) S+(8,)
  1.0 Sz(4,) Sz(8,)
)

@mtfishman
Copy link
Member

Thanks Ryan, can you add a test that it is outputting the correct Hamiltonian?

@ryanlevy
Copy link
Contributor Author

Since this is an example, what sort of test were you thinking of? (As a side note, this has me thinking an ITensorMPS tool that converts a opsum into an adjacency graph matrix might be useful)

@mtfishman
Copy link
Member

Since this is an example, what sort of test were you thinking of?

We could split off the Hamiltonian definition into a separate file and then include it into this example and also into a test.

(As a side note, this has me thinking an ITensorMPS tool that converts a opsum into an adjacency graph matrix might be useful)

That could be useful, though we'd have to think carefully about what it should output (i.e. does it include the operators and weights as well?), how to make it general to handle terms that are beyond 2-site, etc. Maybe better as an external tool. I think the same kind of thing can be accomplished by outputting a dictionary from the set of sites to the corresponding term of the Hamiltonian, which is easy enough to write, say using https://github.com/JuliaData/SplitApplyCombine.jl.

@ryanlevy
Copy link
Contributor Author

ryanlevy commented Nov 1, 2024

I've added the model internally and added a reference. The width=4 with OBC seems to work, but PBC the symmetry breaking in the unit cell is bad and we don't quite reach the correct value.

@mtfishman
Copy link
Member

I've added the model internally and added a reference. The width=4 with OBC seems to work, but PBC the symmetry breaking in the unit cell is bad and we don't quite reach the correct value.

I was picturing that we could just check that some subset of the terms are correct, i.e. check the OpSum itself.

@mtfishman
Copy link
Member

Looks good, thanks!

@mtfishman mtfishman merged commit d0efafc into ITensor:main Nov 5, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants