+1 vote
asked by (210 points)

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:
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.

Please log in or register to answer this question.

Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.