fully connected model

Discussing the best way to implement feature X
orkiss
Posts: 1
Joined: 27 Feb 2024, 12:00

fully connected model

Hi all!,

I am trying to implement a fully connected model $$\sum_{i<j} J_{ij}(X_iX_j + Y_iY_j + Z_iZ_j)$$.
Currently, i am doing something like this

Code: Select all

lat = Chain(L, spin_site, bc=bc, bc_MPS = bc_MPS)
CouplingModel.__init__(self, lat)

for i in range(L-1):
for j in range(i+1,L):
dx = np.array([[1]])

self.add_coupling(J[i,j], i, 'Sp', j, 'Sm', dx=dx)
self.add_coupling(J[i,j], j, 'Sp', i, 'Sm', dx=-dx)
self.add_coupling(J[i,j], i, 'Sm', j, 'Sp', dx=dx)
self.add_coupling(J[i,j], i, 'Sm', j, 'Sp', dx=-dx)

self.add_coupling(J[i,j], i, 'Sz', j, 'Sz', dx=dx)

However, I get an index out-of-bounds error (probably because I do not respect the unit cell of the lattice).
I would be very grateful for any hint!

PS: I know that those kinds of models are not great for MPS.
Johannes
the add_coupling method is for adding a bunch of terms at once, all of the form $$\sum_i J_{i, i+dx} A_i B_{i+dx}$$.
You want to add a single term $$A_i B_j$$, which is what the lower-level add_coupling_term to really add a single coupling between MPS sites i and j - since the chain is a trivial geometry, the MPS site indices are just the lattice indices.