Hi, I want to obtain elements of a tensor represented by an MPS when the quantum number is conserved.
using ITensors
sites3=siteinds("S=1/2",3; conserve_qns=true)
state3 = ["Dn" for i in 1:3]
state3[2] = "Up"
state3
psi4 = productMPS(sites3,state3)
for i in 1:2
for j in 1:2
for k in 1:2
el3 = [i,j,k]
V3 = ITensor(1.)
for l=1:3
V3 *= (psi4[l]*state(sites3[l],el3[l]))
end
v3 = scalar(V3)
print(i,j,k)
# v is the element we wanted to obtain:
@show v3
end
end
end
It works well without conserve_qns=true
in siteinds
function.