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...