Learn to Use ITensor

main / classes / lattice_functions C++v3 | C++v2 | Julia

Functions for Making Lattices

ITensor provides functions which return a vector of LatticeBond objects for conveniently working with various lattices such as the square lattice or triangular lattice.

The source code for these functions can be found in the folder itensor/mps/lattice and are meant to be written in a straightforward style that can be used to develop similar functions for other lattices. If you would like to contribute a lattice function (such as kagome, or next-neighbor triangular) which is currently missing, we would be happy to receive a pull request from you.


int Nx = 10;
int Ny = 10;

auto square_latt = squareLattice(Nx,Ny,{"YPeriodic=",true});
for(auto& bnd : square_latt)
    printfln("Bond from site %d -> %d",bnd.s1,bnd.s2);

auto square_latt_nn = squareNextNeighbor(Nx,Ny,{"YPeriodic=",true});
for(auto& bnd : square_latt_nn)
    if(bnd.type == "1")
        printfln("First-neighbor bond from site %d -> %d",bnd.s1,bnd.s2);
    else if(bnd.type == "2")
        printfln("Second-neighbor bond from site %d -> %d",bnd.s1,bnd.s2);

//Make a Hamiltonian on the triangular lattice using AutoMPO
auto sites = SpinHalf(Nx*Ny);
auto ampo = AutoMPO(sites);
auto tri_latt = triangularLattice(Nx,Ny);
for(auto& bnd : tri_latt)
    ampo += "Sz",bnd.s1,"Sz",bnd.s2;
    ampo += 0.5,"S+",bnd.s1,"S-",bnd.s2;
    ampo += 0.5,"S-",bnd.s1,"S+",bnd.s2;
auto H = toMPO(ampo);

Lattice Functions

Back to Classes
Back to Main