Small comment, from Please Read: Make It Easier to Help You
- Please do not attach a screenshot of your code, it makes it much more difficult for us to help you since then we cannot easily run your code to reproduce your issue. Instead, copy the text of your code directly into your post and format it properly so that we can easily read it.
- Note that when you make a unit cell, you need to include all connections to the next unit cell. This means that because you have U in 1-4, you’ll need whatever hops that are in 5,6,7,8
An example of the Hubbard model for 2 sites in this way:
function ITensorInfiniteMPS.unit_cell_terms(::Model"hubbard1d_2"; t,U)
op = OpSum()
op += -t, "Cdagup", 1, "Cup", 2
op += -t, "Cdagup", 2, "Cup", 1
op += -t, "Cdagdn", 1, "Cdn", 2
op += -t, "Cdagdn", 2, "Cdn", 1
# these connect to the next unit cell
op += -t, "Cdagup", 2, "Cup", 3
op += -t, "Cdagup", 3, "Cup", 2
op += -t, "Cdagdn", 2, "Cdn", 3
op += -t, "Cdagdn", 3, "Cdn", 2
op += U, "Nupdn", 1
op += U, "Nupdn", 2
return op
end
- The “energy” is the energy per site for each site in your unit cell. You can average these together to create an overall “energy per site” of your model. To calculate the energy (which is also displayed during optimization), you can use
expect(ψ,H)
which will produce a vector of N
elements (4 for your case). I would suggest playing around with the examples that have exact energy references to see how the final wave functions and their energy compare to the exact answers