+1 vote
asked by (230 points)

Hey all!
Maybe someone can tell me waht is the problem in my code here with the expo ?
I'm getting an error about this
using ITensors
s= siteinds("S=1/2",N)
cutoff = 1E-8
tau = 0.1
ttotal = 5.0

Compute the number of steps to do

Nsteps = Int(ttotal/tau)
gates= ITensor[] #creating an empty array for Trotter gate

for i=1:N-1
for j=2:N
hj= op("Sz",s[i])op("Sz",s[j])
Gj = exp(-1.0im

commented by (70.1k points)
What is the error you are getting? Does the answer by JR below solve your problem?

1 Answer

0 votes
answered by (550 points)
edited by

The code "Gj = exp(-1.0imtau/2*hj) " should be replaced by "Gj = exp(-1.0im*tau/2*hj)" .

the apply function can handle non-nearest-neighbor gates, I am not sure that Trotter gates cannot deal with long-range interactions in the versions of ITensor?

commented by (70.1k points)
Thanks for answering. Yes, in the Julia version of ITensor, which is what tsegev appears to be using, the apply function can accept gates acting on any sites i and j no matter how far apart they are.
commented by (550 points)
edited by
Thanks for your reply!  This looks very good.  Like  the method TDVP or Time Evolving an MPS with an MPO, we can use apply function handle with time evolution of a system with next-nearest-neighbor or long-range interactions.
commented by (70.1k points)
Yes, that is true and it's a very useful feature of ITensor.

One caution though: while Trotter gates are excellent for short range Hamiltonians or Hamiltonians with further-neighbor terms, for truly long-range Hamiltonians where there is a non-zero interaction connecting every pair of sites (so N^2 interactions in total for N sites), then it can be much more efficient to use a technique based on MPOs, such as the TDVP technique. So I would definitely recommend TDVP for truly long-range Hamiltonians or cases like quasi-2d systems.

Best regards,
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.