Currently, there's nothing like that.
I started thinking about it (and even writing the code for the , but then became busy implementing other stuff.
First of all, the algorithms like DMRG don't care about the lattice, but only about the generated MPO and
lat.mps_sites()
defining the Hilbert space. So the only difficulty is how to write down the MPO for such a lattice.
I think the clearest strategy, which I started implementing with the
tenpy.models.lattice.IrregularLattice before I came busy with other stuff, would be the following:
Define the Regular Lattice, and specify somehow that you want to add or remove a few sites (and which ones, probably best in the coordinates of the original lattice).
To remove one or multiple sites, we need to remove the corresponding row(s) from the
_order
array of the lattice.
Adjust the order setter to set the order for the original lattice, remove the rows from the sites to be deleted and put it as
_order
to self.
Check and adjust functions like
lat2mps_idx, mps_idx_fix_u, mps_lat_idx_fix_u, mps2lat_values
whether they work as they should.
E.g for
mps_idx_fix_u
, you need to adjust
self._perm
, which gets defined in the the order setter.
Finally, adjust the functions
possible_couplings
and
possible_multi_couplings
to exclude the cases where the coupling would hit the removed site(s). This will make the Model's
add_coupling
work as expected.
To add a site (which we can implement later), we might need to enlarge the unit cell by the additional site if it is of a different type. Otherwise, the same functions need to be adjusted. You can view it as taking a regular lattice with the unit cell enlarged by the extra site, and removing the extra site from all the lattice unit cells where you don't want it added - I'm not sure if this is the easiest way to implement it.
To summarize, you actually just need to adjust the Lattice. The model is using the functions of the lattice to figure out where to put couplings, so it should still work as expected once the Lattice is adjusted properly.