Tensor product of spins and operators


first of all thanks for the great package. I’m trying to understand what the best way to set up a computation with the ITensor package in Julia.

Let’s say that what I’m interested in is a spin chain where I have two 1/2 spins living on every site, so that every operator Sz, S+ and S- operators should have an extra index f=1,2.

Clearly, instead of N sites on which these spins live, I could consider 2N sites, where the first flavor of spins live on even sites and the second flavor lives on odd sites. But I would rather not have to think about even sites and odd sites.

I would actually prefer to have N sites, each with a physical index that has four possible states. That would require taking tensor products of operators. My questions are

  1. How do I define tensors product of operators, such as 1 \otimes S_z , S_z \otimes S_z and so on?
  2. What should I do with SiteType?
  3. Do I risk this being less efficient than the 2N sites solution?


Hi Bernardo,
Glad to hear you’re enjoying using ITensor! It’s a good question about what you are hoping to do here. It’s definitely possible and would not be too hard, but the main reason I would somewhat dissuade you from it is that, yes, it would be less efficient.

Methods like DMRG scale at least linearly in the site dimension, so there would be hitting a factor of two slowdown, and some steps scale as the square of the site dimension so those could get even slower. Now if your calculation was fast overall, like if you are doing a 1D system and not expecting to see bond dimensions beyond a few hundred, then a factor of two or 4 (or even 8) would not be so bad and you could still get results in a handful of minutes. So it could still be worth trying if you think it will be that much more convenient.

In terms of how to do it, you’d have to define a new SiteType using the steps outlined here:
(Note that on the dev branch of the docs there are currently some extra examples not yet in the stable docs, but they will get merged in when we tag the next version.)

Basically you’d have to come up with a name for your site, like “TwoSpin” or “S=1/2AB” or something. Then make custom operators with names like “Sz1” and “Sz2” meaning Sz acting on the first or second spin on the site. These would be 4x4 matrices and the tensor product would be the usual one defined in mathematics, also here for the case of matrices known as the Kronecker product, and you’d have to work out the appropriate matrix elements. Also if you want to use conserved quantum numbers (total conserved Sz would be the main thing in this case) then you’d have to appropriately define the quantum numbers in the space function as detailed in the tutorial linked above.