MPS winding for 'new' lattice

How do I use this algorithm? What does that parameter do?
Post Reply
xaver
Posts: 7
Joined: 23 Apr 2021, 07:51

MPS winding for 'new' lattice

Post by xaver »

Hi,
I am trying to implement a 2D lattice not available yet. I am fine up until the ordering function in lattice.py. The way how this function works, or if at all I need to tweak this particular function, or something else in order to set up my own winding for a new 2D lattice is unclear to me.
I've tried to get something out of https://tenpy.readthedocs.io/en/latest/ ... -the-order. But it did not really help me.
Is there any additional documentation on what to do to achieve ones own winding in a new 2D lattice?
xaver
Posts: 7
Joined: 23 Apr 2021, 07:51

Re: MPS winding for 'new' lattice

Post by xaver »

Ok., so I may have come a little step further, but I'd still be glad if 'some higher power' would kick in to let me know if I'm at least heading into the right direction.
To be more specific, the 2D lattice I'm looking at has more than 2 sites per unit cell and I want to have my own way of traversing them. This does not happen with the default or Cstyle ordering and this is what I want to change.
Now in lattice.py there is a function get_order_grouped, for which it seems one can use it like so

Code: Select all

grp = [(i1, i2, ..., iU)]  # The order of winding through the unit cell of U sites 
pri = None                  # default. This does C-style among the unit cells. Others?
lat = PhantasicLattice(Lx, Ly, sites=None, bc='periodic')
lat.order =  lattice.get_order_grouped(lat.shape, grp, pri) # Set the order
Is this all I need to do? Or will something backfire once I start using this with an MPS?
User avatar
Johannes
Site Admin
Posts: 324
Joined: 21 Jul 2018, 12:52
Location: TU Munich

Re: MPS winding for 'new' lattice

Post by Johannes »

I think you're on the right track.
I presume your PhtantasticLattice is derived from the base lattice class.
What you should do is override the ordering method, similar as is done in the the tenpy.models.lattice.Honeycomb lattice - take a look at the source there.
You want the structure

Code: Select all

def ordering(self, order):
    if isinstance(order, str) and order == "my_new_order":
        order = ...
        return order
    return super().ordering(order)
Here, the order defines the ordering of the lattice sites, as a 2D numpy array of shape (N_sites, 3), each row specifying a site by indices (x,y,u).
In most cases, you will probably want to do a permutation of another order, or use the functions tenpy.models.lattice.get_order or tenpy.models.lattice.get_order_grouped.
Try looking at the example in the doc string of the latter, I think this is what you want. You can copy-paste the source-code for the example figure into a jupyter notebook, it's fully self-contained including imports. Try out setting the options interactively. When you understood what it does, try using your lattice instead, and you'll get the right ordering eventually!

PS: I realized that a better example for Kagome would be [(0, 2), (1,)] instead of [(0, 1), (2,)]; correcting this right now...
Post Reply