fully connected model

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

fully connected model

Post by orkiss »

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.
User avatar
Johannes
Site Admin
Posts: 457
Joined: 21 Jul 2018, 12:52
Location: TU Munich

Re: fully connected model

Post by Johannes »

Disclaimer: You already said that MPS are not a good idea for this kind of model...

That said, I can point you to you misunderstanding:
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.
Post Reply