+1 vote
asked by (320 points)

Hi Miles

If my Hamiltonian is a 3-sites interaction, Is it useful to only add a
s3 = s[j+2]
and use
hj= op("xx",s1) * op("xx",s2)*op("xx",s3)
compared with example from document?
I have tried it and the code evaluating time is much longer than 2-sites.

1 Answer

0 votes
answered by (70.1k points)

Hi, it's a good question, though could you please be more specific about what you changed in the code? Did you leave the original two site terms unchanged and then add these three site terms? Or do you only have the three site terms now?

Also when you say the time is much longer, how much longer is it?

I did my own tests of adding three-site terms, in addition to the previous two-site terms. In my case it is slower but by an amount that seems reasonable to me. For N=40 sites and setting conserve_qns=false, I found that the original code took about 4 seconds and the code with additional three-site terms took 12 seconds.

There are many reasons this extra time is reasonable. Here are the main ones:
1. there are just more gates, and there is a cost for acting each gate. If there are twice as many gates, then the code should generally take at least twice as long.
2. the extra gates could lead to the state becoming entangled more quickly, which would add further codes even when applying the two-site gates
3. the cost of applying a three-site gate is always higher than a two-site gate. This is because the code merges together three sites of the MPS, so there is one extra site making that step at least 2 times more expensive and more like 4 times more expensive. (If the site dimension is d then there is one step costing an additional factor of d and another one scaling with an additional d^2).

So for all those reasons I am not too surprised. In general if you are dealing with a very complicated Hamiltonian, then TDVP can be a better option for time evolution compared to Trotter or TEBD. We are actively working on a TDVP code for ITensor and it will be released soon.

Best regards,
Miles

commented by (320 points)
Hi, my 3-site Hamiltonian looks very easy. It's only 3 operators of spin-1/2. I set N=24 and no conserve_qns. However I add a periodic boundary condition. After the
for j=1:N-2
  s1 = s[j]
  s2 = s[j+1]
  s3 = s[j+2]
  hj = op("xx",s1) * op("xx",s2) * op("xx",s3)

  Gj = exp(-1.0im * tau/2 * hj)
  push!(gates,Gj)
end

I added
#periodic
s1 = s[N-1]
s2 = s[N]
s3 = s[1]
hj = op("xx",s1) * op("xx",s2) * op("xx",s3)
Gj = exp(-1.0im * tau/2 * hj)
push!(gates,Gj)

s1 = s[N]
s2 = s[1]
s3 = s[2]
hj = op("xx",s1) * op("xx",s2) * op("xx",s3)
Gj = exp(-1.0im * tau/2 * hj)
push!(gates,Gj)
#periodic finish

I need the PBC, but I can't make sure that is right.
If I add the number of sites, like 36, the time will be about 3 times as N=24.
commented by (70.1k points)
Right, so the part about PBC is very important information! I would not recommend using the Trotter gate method for time evolution to do PBC for very large systems. In fact, it's hard to use any MPS method for very large systems with PBC: MPS just aren't a good choice for doing PBC. But you can push MPS to do PBC to a limited extent.

The reason you are seeing a rapid increase in cost is that to apply Trotter gates to an MPS, the code has to do swap operations on sites, changing their order, to become neighbors in order to apply the Trotter gate. For the case of PBC, this means that site 1 has to be swapped all the way across the system until it is the neighbor of sites N-1 and N in order to apply the Trotter gate.

A solution in theory would be to use MPS that are on a ring (a circle) but the technology for working with such MPS has still not been figured out in the research literature and is still an open and active area of algorithm research.

A better choice if you really have to do PBC is to consider using the TDVP algorithm which uses an MPO representation of the Hamiltonian. We are working on a TDVP code for the Julia version of ITensor but it may not give great results for PBC at this time because of some features we have to put in. But you can try it if you really want to - we cannot guarantee the result.

Lastly, are you sure you need to do PBC? What is the reason you need it over open boundary conditions?
commented by (320 points)
The size of my system is compared small. When I got some observable value,the boundary effect is obvious.
However, I want to get the fidelity which is in direct proportion to the inner product of initial state and the end state. If my system is set big to use OBC, the fidelity will be so small, so I need small system.I will try some idea to replace the PBC.
Expect to the TDVP in Julia version will  be finished and I can't wait to try it.
commented by (70.1k points)
I see, thanks. Even if you are using PBC, then as you know eventually the fidelity will get small there too. So really the best thing to do is not to compute fidelity but to compute the negative log of fidelity divided by system size. To do this carefully, one should begin overlapping the two MPS one tensor at a time, then divide by the norm of this partial overlap tensor and save the log of the norm, adding it to a variable each time. Repeating this, one can get the log of the fidelity without encountering floating point overflow or underflow issues. We don’t have a code for this exactly, but computing the overlap of two MPS with ITensor is not too hard - please ask if you decide to do this and need help.

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

Categories

...