# How to store pauli's matrices inside an index of a tensor

+1 vote
asked

Hey all!
I am trying to write down an Hamiltonian of the form Sum(J(i,j,a,b)*S(i,a)*S(j,b)
where S is the spin operator Sx+Sy+Sz and J is just some normal rendom numbers, and i>j .
So my problem is that I can't figure out how to store an array inside an index. For example I want that whan a.b= 1 I will get Sx a,b=2 I will get Sy and for a,b=3 I will get Sz.
and to match a random number to each of them (J ).
Can anyone please help me ?
Thank you, Tomer

commented by (64.2k points)
Hi Tomer,
Thanks for the question. I have a few to ask you before I will know how to help.

When you say "write down" a Hamiltonian, what kind of thing do you want to make? Do you want your Hamiltonian to be a single tensor? Or an MPO tensor network (which is what we use to represent Hamiltonians in many simulation methods such as DMRG)?

Are you sure you need to make a tensor S(i,a) with the property you mention? To make a spin interaction of the form you wrote above, you can write all the different terms as separate terms and use our OpSum/AutoMPO system to turn these mathematical terms into an MPO? Would that give you what you need? Pairing the right random numbers with the terms should not be too hard or we can discuss how.

Here is an example of the OpSum system making an MPO from a sum of Hamiltonian terms:
https://itensor.github.io/ITensors.jl/stable/tutorials/DMRG.html
commented by (210 points)
What I want to do is to write an Hamiltonian (some kind of an Ising model) which sums over 4 indices. My indices are i>j, alpha, beta.
So my goal is to make a MPO which will have a indices of the site, and a index fo the physical information (pauli matrix). The problem is that I don't know how to do it.