Hello everyone.
Hope you are doing well.
Below, I provide with the code of the spin chain of mixed spins (1,1/2) with 14 sites. I should specify that my interest is in obtaining the reduced density matrix as well as some log negativity based on matrix product states.
In the code below, my problem is at the level of obtaining the logarithm of the trace of partial transpose since the states are tensors of order 3 in general.
using ITensors, ITensorMPS
let
c=1
N = 14
# Make an array of N Index objects with alternating
# "S=1/2" and "S=1" tags on odd versus even sites
# (The first argument n->isodd(n) ... is an
# on-the-fly function mapping integers to strings)
sites = siteinds(n->isodd(n) ? "S=1/2" : "S=1",N)
# Couplings between spin-half and
# spin-one sites:
Jho = 1.0 # half-one coupling
Jhh = 0.5 # half-half coupling
Joo = 0.5 # one-one coupling
os = OpSum()
for j=1:N-1
os += 0.5*Jho,"S+",j,"S-",j+1
os += 0.5*Jho,"S-",j,"S+",j+1
os += Jho,"Sz",j,"Sz",j+1
end
for j=1:2:N-2
os += 0.5*Jhh,"S+",j,"S-",j+2
os += 0.5*Jhh,"S-",j,"S+",j+2
os += Jhh,"Sz",j,"Sz",j+2
end
for j=2:2:N-2
os += 0.5*Joo,"S+",j,"S-",j+2
os += 0.5*Joo,"S-",j,"S+",j+2
os += Joo,"Sz",j,"Sz",j+2
end
H = MPO(os,sites)
nsweeps = 10
maxdim = [10,20,40,80,100,140,180,200]
cutoff = [1E-8]
psi0 = random_mps(sites;linkdims=4)
energy,psi = dmrg(H,psi0;nsweeps,maxdim,cutoff)
orthogonalize!(psi,c+6)
ket1 = psi[c]*psi[c+1]
bra1 = dag(ket1)
ket2 = psi[c+4]#*psi[c+5]
bra2 = dag(ket2)
rho1 = prime(ket1,"Site")*bra1
rho2 = prime(ket2,"Site")*bra2
N1=partial_transpose_per(rho1, 2, (2,2))
N2=partial_transpose_per(rho2, 2, (2,2))
Ns1=log(tr(N1))
Ns2=log(tr(N2))
N=(Ns1*Ns2)^(1/7)
return @show psi[10];
end
Therefore, my question would be: Please, is there an alternative way to compute the logarithm negativity once I obtain the reduced density matrix since the approach I used seems not useful for that purpose?
Also, I used as code for partial transpose the following:
function partial_transpose_per(x, sys, dims)
n = length(dims)
d = prod(dims)
s = n - sys + 1
p = collect(1:2n)
p[s] = n + s
p[n + s] = s
rdims = reverse(dims)
r = reshape(x, (rdims..., rdims...))
return reshape(permutedims(r,p),(d,d))
end
Thank you in advance for your reaction and suggestion(s).
Idriss