QA: mismatched ground state with Exact diagonalization

Hi,

I have built a DMRG eigensolver for a TFIM system, but the solution does not match the exact diagonalization from the Linear Algebra package. I must have done something wrong but I am not sure what it is.

Problem definition

The inputs to my eigensolver are the:

  • hx: the spin-spin interaction strength matrix in the X direction
  • hz: the transverse field strength vector for the Z direction.

My simple test consists of a TFIM with 4 half-spin qubits. My inputs are:

hx=\begin{pmatrix} 0 & 1 & 0 & 0 \\ 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}\\ hz=\begin{pmatrix} 1\\ 1\\ 1\\ 1 \end{pmatrix}\\

Note that this input matches a simple nearest neighbors TFIM with J=1, h=1.

ITensors dmrg solution

The two simple functions I built are:

function tfim_mpo(hx::Matrix{Float64},hz::Vector{Float64})
# Function to create the MPO from the spin-spin interaction matrix and the transverse field vector

    N = size(hx, 1)
    @assert size(hx, 2) == size(hz, 1) == N

    # Define the MPO's sites
    sites = siteinds("S=1/2", N)

    os = OpSum()
    # Only use the upper triangular and off-diagonal entries of the X interactions matrix.
    for i=1:(N-1), j=(i+1):N
        intStr = hx[i,j]
        if intStr != 0
            os -= (intStr * 4,"Sx",i,"Sx",j)  # *4 to rescale the spin half operators
        end
    end

    # Transverse field
    for i=1:N
        os -= (hz[i] * 2,"Sz",i) # *2 to rescale the spin half operators
    end

    H = MPO(os, sites)

    return H, sites
end


function simple_dmrg(H, sites; nsweeps=5, maxdim = [10,20,100,100,200], cutoff=1e-10)

    psi0 = random_mps(sites;linkdims=2)

    # Run the DMRG algorithm
    energy, psi = dmrg(H, psi0; nsweeps, maxdim, cutoff)

    return energy, psi
end

To solve my DMRG I run:

H, sites = tfim_mpo(Float64.(hx),Float64.(hz))
energy,psi = simple_dmrg(H, sites)
After sweep 1 energy=-4.758769105651318  maxlinkdim=4 maxerr=2.48E-16 time=0.004
...

Ground state:

energy
-4.758770483143469

Corresponding eigenvector:

p=contract(psi)
ev = [p[i] for i=1:16]

16-element Vector{Float64}:
  0.9019123326754053
 -1.6807723281441355e-7
 -2.2743415706943405e-7
  0.22454944224260454
 -2.2735047695906037e-7
  0.10878394347280426
  0.23524568518773323
 -7.387077210338358e-8
 -1.6811866392360353e-7
  0.05788269114857835
  0.10878393750542867
 -4.9144196289382986e-8
  0.22454944846790273
 -4.913867696800656e-8
 -7.390499860912247e-8
  0.057882705520756646

QA

To check my answer, I use the eigen function from the Linear Algebra package on the hamiltonian matrix contracted from the MPO representation:

T = contract(H)
hm = [T[(N^2)*(i-1)+j] for i in 1:N^2, j in 1:N^2]
ed = eigen(hm)

ed.values[1]
-6.928203230275511

ed.vectors[:,1]
16-element Vector{Float64}:
 -0.7618016810571367
  0.0
  0.0
 -0.35355339059327373
  0.0
 -0.20412414523193156
 -0.20412414523193156
  0.0
  0.0
 -0.20412414523193148
 -0.20412414523193156
  0.0
 -0.35355339059327373
  0.0
  0.0
  0.054694899870589314

I get a different (lower) ground state than the one obtained from the dmrg function. What am I missing?

Thank you,
Daniel

I’m a bit suspicious of this operation:

T = contract(H)
hm = [T[(N^2)*(i-1)+j] for i in 1:N^2, j in 1:N^2]
ed = eigen(hm)

You may be implicitly assuming a certain Index ordering of T. What if you use eigen(T; ishermitian=true)? That should handle the Index ordering correctly.

Indeed, when I ran:

ed = eigen(T; ishermitian=true)
minimum(ed.spec.eigs)

I get:

-4.758770483143617

Which is close enough to the DMRG’s solution!

Now I want to find its corresponding eigenvector from the (2,2,2,2,16) shaped ed.V ITensor.

I can get the ground state’s index order with igs = argmin(ed.spec.eigs).
Then, what would be the correct way to get the GS vector from the eg.V[:,:,:,:,igs] contraction using ITensors?

PS: Thank you for the quick reply!

You could use this to convert to a Julia Matrix:

C = combiner(sites)
c = combinedind(C)
u = uniqueind(ed.V, C)
Matrix(ed.V * C, c, u)
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.