Hey,
I am trying to benchmark my exact free fermion numerics for a setup (that I shall now explain) on DMRG. My setup involves taking the ground state of the XX chain and making random 0/1 projections/measurements on a subset of sites of the system and then probing the resultant leftover state. I pick the 0/1 projection for a given site with 50-50 probability. Now, in the exact free fermion numerics, I observe that my state is sometimes killed (which makes sense since there would be outcomes chosen such that the overlap with the ground state is 0). However, that does not seem to happen in the DMRG code. Here is my measurement code:
function ITensors.op(::OpName"projupz", ::SiteType"S=1/2", s::Index)
mat = [1 0
0 0]
return itensor(mat, s', s)
end
function ITensors.op(::OpName"projdnz", ::SiteType"S=1/2", s::Index)
mat = [0 0
0 1]
return itensor(mat, s', s)
end
outcomes = rand(0:1, length(meas_loc))
function measure_avg(psi, loc, outcomes, sites)
for (i, site_index) in enumerate(loc)
op_tuple = (outcomes[i] == 0 ? ("projdnz", site_index) : ("projupz", site_index))
psi = apply(ITensors.ops([op_tuple], sites), psi)
psi /= norm(psi)
end
return psi
end
sites = siteinds("S=1/2",L)
nsweeps = 40
maxdims = [200,300, 350, 400]
cutoff = [1E-15]
os = OpSum()
for j=1:L-1
os -= "Sy",j,"Sy",j+1
os -= "Sx",j,"Sx",j+1
end
os -= "Sy",L,"Sy",1
os -= "Sx",L,"Sx",1
H = MPO(os,sites)
psi0 = randomMPS(sites;linkdims=4)
observe = DMRGObserver(; energy_tol=1e-12, minsweeps=10, energy_type=Float64)
energy,psi_gs = dmrg(H,psi0;nsweeps,maxdim,cutoff, observer=observe)
result = measure_avg(psi_gs, meas_loc, outcomes, sites)
The above is just a skeleton of my code. I tried debugging by taking the input state to the measurement function to be the product states of S_x and S_z eigenstates and I get the expected results. Not sure where the issue could be? Any help would be appreciated.