I have a simple question. Let’s say I make a 2D hamiltonian for DMRG using triangular_lattice function and get a ground state after running the code. How can I know what index of the returned MPS corresponds to which x and y coordinates of the 2D system?
In essence, I’m asking how is the ordering of sites done for triangular lattices in ITensor?

I used the code below to understand

using ITensors
Lx=5
Ly=3
lattice = triangular_lattice(Lx, Ly;yperiodic = false)
for bnd in lattice
println("site",bnd.s1,"to",bnd.s2)
println("xy",bnd.x1,bnd.y1,"to",bnd.x2,bnd.y2)
println(" type",bnd.type)
end

but this is giving the output as

site1to4
xy0.00.0to0.00.0
type
site1to2
xy0.00.0to0.00.0
type
site1to5
xy0.00.0to0.00.0
type
site2to5
xy0.00.0to0.00.0
type
site2to3
xy0.00.0to0.00.0
type
site2to6
xy0.00.0to0.00.0
type
site3to6
xy0.00.0to0.00.0
type
site4to7
xy0.00.0to0.00.0
type
site4to5
xy0.00.0to0.00.0
type
site4to8
xy0.00.0to0.00.0
type
site5to8
xy0.00.0to0.00.0
type
site5to6
xy0.00.0to0.00.0
type
site5to9
xy0.00.0to0.00.0
type
site6to9
xy0.00.0to0.00.0
type
site7to10
xy0.00.0to0.00.0
type
site7to8
xy0.00.0to0.00.0
type
site7to11
xy0.00.0to0.00.0
type
site8to11
xy0.00.0to0.00.0
type
site8to9
xy0.00.0to0.00.0
type
site8to12
xy0.00.0to0.00.0
type
site9to12
xy0.00.0to0.00.0
type
site10to13
xy0.00.0to0.00.0
type
site10to11
xy0.00.0to0.00.0
type
site10to14
xy0.00.0to0.00.0
type
site11to14
xy0.00.0to0.00.0
type
site11to12
xy0.00.0to0.00.0
type
site11to15
xy0.00.0to0.00.0
type
site12to15
xy0.00.0to0.00.0
type
site13to14
xy0.00.0to0.00.0
type
site14to15
xy0.00.0to0.00.0
type

i.e. it’s returning x and y coordinates of all sites as (0,0)

Forgive me for the basic question but it’ll be helpful if someone could reply.

It’s a good question, thanks for asking. First of all, the coordinates x1,x2,y1,y2 are unfortunately not implemented for trianguar_lattice which was just an oversight or missing thing we need to add. So we should add that in the future.

But really the important thing anyway isn’t the spatial layout of a 2D lattice but really its topology. (As I think you’d agree, the spatial location doesn’t affect the physics but actually the strength of the interaction J on each bond and the connectivity of the bonds.)

Here is a drawing of the site numbering and bonds which are output by the triangular_lattice function with yperiodic=false and Nx=4,Ny=4. If you have a question about the yperiodic=true case or a different size please let me know.

As you can see above, I like to think of the triangular lattice in a so-called “squarized” form which is the square lattice but just with extra diagonal bonds crossing each plaquette. But again, this is just one possible way to embed it into 2D space and there could be others, yet the important thing is just which sites connect to which other sites.

You can verify the above site ordering and pattern of bonds by printing out all the of LatticeBond objects contained in the lattice array returned by triangular_lattice.

Thanks a lot for the answer. It solves my query well. I now understand how the triangular_lattice works. I tried working this out for yperiodic=true and am just posting my understanding here for completeness’ sake so that others who may have similar doubts in the future can get help.

If we use triangular_lattice with Nx=5, Ny=3 with yperiodic=true, we can understand the resultant lattice and bonds using the figure below:

Yes, your understanding of it is correct. Note that one can verify drawings like this by printing out all of the bonds returned by triangular_lattice(5,3; yperiodic=true).

Thanks for sharing that drawing - it will be a help to others!