Hello everyone.
With the hope you are doing well, I would like to address a concern regarding some calculations I am currently doing.
In fact, I have a 14-site alternating mixed-spin chain of spin-1/2 and spin-1 and I would like to get the reduced density matrix of say 4 sites (not necessarily adjacent). Let A, B, C, and D be the sites of interest.
Following some ideas proposed here before as well as suggestions, I wrote some lines but I currently have some issue due to the non-adjacent character of the sites of interest.
Here, I provide with an example of the code I wrote:
let
c=1
N = 14
sites = siteinds("S=1/2",N)
os = OpSum()
for j=1:N-1
os += 0.5,"S+",j,"S-",j+1
os += 0.5,"S-",j,"S+",j+1
os += "Sz",j,"Sz",j+1
end
H = MPO(os,sites)
nsweeps = 5 # number of sweeps is 5
maxdim = [10, 100, 1000, 10000, 25580] # gradually increase states kept
cutoff = [1E-10] # desired truncation error
psi0 = random_mps(sites;linkdims=10)
energy,psi = dmrg(H,psi0;nsweeps,maxdim,cutoff)
# Reduced density matrix between sites 1, 2, 3, 4 in the order 1234
psidag=prime(dag(psi),linkinds(psi))
rho1=prime(psi[1],sites[1])*dag(psi[1])
for i=2:4
rho1 *= psi[i]
rho1 *= psidag[i]
end
rho1_PT = swapinds(rho1,inds(rho1)[1],inds(rho1)[3])
############################################################################################
# Reduced density matrix between sites 1, 2, 3, 4 in the order 4123
orthogonalize!(psi,c+3)
ket2=psi[c+3]
ket2 *= psi[c]*psi[c+1]*psi[c+2]
bra2 = dag(ket2)
rho2 = prime(ket2,"Site")*bra2
rho2_PT = swapinds(rho2,inds(rho2)[1],inds(rho2)[3])
############################################################################################
# Reduced density matrix between sites 1, 2, 3, 4 in the order 3124
orthogonalize!(psi,c+4)
ket3= psi[c+4]
ket3 *= psi[c]*psi[c+1]*psi[c+3]
bra3 = dag(ket3)
rho3 = prime(ket3,"Site")*bra3
rho3_PT = swapinds(rho3,inds(rho3)[1],inds(rho3)[3])
The last lines of each subpart represents a part transpose in each matrix, with the intention to check whether they are well-defined (diagonal summing up to 1).
The lines I wrote, following the first part of the code is the following:
a1=0
a2=0
a3=0
d1,u1 = eigen(rho1_PT)
d2,u2 = eigen(rho2_PT)
d3,u3 = eigen(rho3_PT)
for j=1:length(diag(real(d1)))
a1+=diag(real(d1))[j]
end
for j=1:length(diag(real(d2)))
a2+=diag(real(d2))[j]
end
for j=1:length(diag(real(d3)))
a3+=diag(real(d3))[j]
end
As outputs, I obtain the following:
a1 = 0.9999999999999999
a2 = 0.8323756817707685
a3 = 31.99999999999999
Meaning that something wrong is happening.
Therefore, I would like to ask if there is a way you might know to deal with this situation because my main goal is to compute the log-negativity based on these 4-sites RDMs.
Thanks in advance for your time and consideration,
Sincerely,
Idriss