Problem defining nearest neighbour model
Posted: 08 Feb 2025, 13:23
Hi there -- I have a problem defining nearest neighbor models. I'm still in the discovery phase of TeNPy so please be gentle. Here is my code ..
I have defined a site called Qumode() which seems to work fine. lattice_size is 10. But when I do this ...
I get this ...
There only seems to b one "pair". What am I doing wrong? I thought NearestNeighborModel would automatically include nearest neighbor couplings.
The alternative looks like to
Sorry -- I am bit lost in all the different options. Is there a page that describes how to define your own tebd model with your own couplings?
Thanks for your help.
Python: Select all
class Field(CouplingModel, NearestNeighborModel):
def __init__(self):
# Define the lattice with custom sites
site = Qumode()
lattice = Chain(lattice_size, site=site, bc='periodic') # Use open boundary conditions
super().__init__(lattice)
CouplingModel.__init__(self, lattice)
print("Nearest-neighbor pairs:", self.lat.pairs['nearest_neighbors']) # totally screws up apparently
print("Number of sites in the unit cell:", len(lattice.unit_cell)) # Output: 1 -- this is so we can have local symmetries
print("Total number of sites in the lattice:", lattice.N_sites) # Output: 10
Python: Select all
print("Nearest-neighbor pairs:", field.lat.pairs['nearest_neighbors'])
Code: Select all
Nearest-neighbor pairs: [(0, 0, array([1]))]
The alternative looks like to
self.init_H_bonds()
Python: Select all
def init_H_bonds(self):
"""Initialize `H_bonds` hamiltonian."""
yada yada ...
self.H_bonds = H_list
Thanks for your help.