Related to making a trotter gate and finding the GS

Following the same question: Related to trotter gates

I want to calculate the GS Energy for the following as a function of B_z at Some \beta,

H = \sum_{j=1}^{N-1} S^z_{j} S^z_{j+1} + \frac{1}{2} S^+_{j} S^-_{j+1} + \frac{1}{2} S^-_{j} S^+_{j+1} -B_z \sum_{j=1}^{N} {S^z}_{j}

Trotter Gate is as follow:

gates = ITensor[]
for j=1:N-1
 s1 = s[j]
 s2 = s[j+1]
 hj =       op("Sz",s1) * op("Sz",s2) +
      1/2 * op("S+",s1) * op("S-",s2) +
      1/2 * op("S-",s1) * op("S+",s2) 
      -B_z*op("Sz",s1) * op("Id",s2) 
Gj = exp(-1.0* tau/2 * hj)
push!(gates,Gj)
end
hj += - B_z*op("Id",s[N-1]) * op("Sz",s[N]) 
Gj = exp(-1.0* tau/2 * hj)
push!(gates,Gj)
append!(gates,reverse(gates))

But results are not matching with ED results for B_z>0.

A Case: For N=8, B_z = 0.4 and \beta (=1/T): ED gives E_{gs}= -1.867, while Itensors gives
E_{gs}= -1.667.

Complete Code is here: itensor - Pastebin.com

Any comments ?

Hi thanks for the question. When you say your results arenā€™t matching with ED, could you please say more about it? I see that your gates here are evolving in imaginary time, so are you trying to use them to obtain the ground state or to evolve to a specific amount of imaginary time?

Hi, Miles, thank for responding. I have updated the ques, Now I hope the ques is clearer. Waiting for your comment

Hi, Miles, Could you please look into the post . It will be a great help.

I see ā€“ so here you are only evolving to a time beta_max = 1.0 apparently. The ground state is only reached for a very large beta, and formally only when beta goes to infinity. In practice a beta of 20 is often enough to reach the ground state, but it depends on the size of the energy gap.

Did you try larger values of beta?

Also if you are trying to compute ground states with ITensor, itā€™s much more efficient to use DMRG to do that.

Hi, Miles, Basically I want to calculate the Ground state magnetisation of the same system at some finite temperature T. Is this (above code) not the correct way to do so ? If not , then how I can find the finite T properties (magnetisation )

Sorry for asking the naive questions.

ā€˜ I see ā€“ so here you are only evolving to a time beta_max = 1.0 apparentlyā€™

Is the beta_max is related to time, not to T ?

Is this beta_max is inverse of Temperature T ? If so then beta_max = 1.0 corresponds to T =1.0. ?

I assumed that, since beta=1/T, so properties at any T can be found by reaching that T (corresponding beta). Do I need to evolve the system ? Could you please comment on that. We donā€™t do this in ED. We can directly find the properties by giving that particular T.

Could you please clarify ? Many thanks.

I see, I was confused by you calling the finite temperature state the ground state. The term ā€œground stateā€ only refers to the state of the system at T=0 which is a pure. A state at a finite temperature is given by a mixed state and is not called a ground state.

The code you linked to does look possibly correct for obtaining the thermal mixed state at inverse temperature \beta=beta_max since you start with an infinite temperature state as an MPO and imaginary time evolve that.

So I donā€™t know off hand the reason that you are getting a different energy from your ED code if that one is also computing finite temperature properties, I assume in a correct way.

We have put an example code showing how to implement the ā€œpurificationā€ method for finite-temperature systems which is equivalent to what you are trying to do. It could be helpful for you to compare your implementation to ours, which is available in the ITensor example folder here:
https://github.com/ITensor/ITensors.jl/blob/main/examples/finite_temperature/purification.jl

Yes, miles, sorry for calling it ground state.

I have taken the code from your folder only on GitHub, now in that code I want to add last term , I.e. magnetic field term,

Results matches with ED (yes it is computing for finite T) for Bz = 0, which is your code only. But for non zero it does not match.

Could you check that I am implementing the last term correctly in trotter gate. ? Or if possible, you may have a look at link for the complete code.

It might be related to default sweeps ?, is that required ?

I thank you for your time, It will be a great help.

Your code does look correct, but as always a code has to be run and checked to be sure of its correctness.

Did you take into account the partition function, that is, the trace of rho no longer being equal to 1 after the imaginary time evolution? You will need to either make it equal to 1 or else divide by the trace when computing any observables.

Yes, Tr(\rho) is one after every evolution.

I was using Gj = exp(-1.0* tau/2 * hj) so far!! I was getting negative real numbers as energy, but if I use Gj = exp(-1.0im* tau/2 * hj) then I get the complex energies!! ?

Right, so the reason you are getting complex energies in that case is because apply(gates,rho) is defined to only apply the gates to one side of rho. So it is doing e^{-i H \tau} \rho.

In contrast, the correct way to evolve a density matrix in real time is e^{-i H \tau} \rho e^{i H \tau} for a time step \tau. For this purpose, there is a keyword argument called apply_dag you can use like this:

rho = apply(gates,rho; apply_dag=true)

The documentation for apply_dag can currently be hard to find, so I can see why you did not know about it!

For the imaginary time case of what you are doing you donā€™t need apply_dag however, because computing just e^{- H \tau} \rho ought to be fine for obtaining e^{- H \beta} when starting from \rho being an identity operator.

As to why you are still getting a different energy from your ED code, I donā€™t know the reason as it seems it is a bug you need to find, but it could be one of many different things:

  • is it possible your ED code is using Pauli matrices for the spin operators whereas ITensor uses spin operators which include a factor of 1/2 ?
  • perhaps you are not accounting correctly for the total amount of imaginary time evolved in one or both codes?
  • I note in your code that you are printing out the energy before taking the imaginary time step. Maybe you should print it out after taking the time step?
2 Likes