I am fairly new to tensor network methods and have just started using ITensors. I apologize if this is a repeat of a previous question.
The Hamiltonian I want to use for time evolution is,
For this I need three types of gates. From the previous discussions in this forum I have combined
as
hj = J*op("Sz",s1) * op("Sz",s2) +
B*op("Sx",s1) * op("Id",s2)
to create a gate, and then pushed another gate of \kappa \sum_j \sigma^z_j \sigma^z_{j+2} after that. Hence the code looks like, for a ferromagnetic spin up initial state,
using ITensors
let
N = 10
cutoff = 1E-16
tau = 0.01
ttotal = 20
B=-0.5 *2
k=0.4 *4
J=-1. *4
# Compute the number of steps to do
Nsteps = Int(ttotal/tau)
# Make an array of 'site' indices
s = siteinds("S=1/2",N;conserve_qns=false)
# Make gates (1,2),(2,3),(3,4),...
gates = ITensor[]
for j=1:N-2
s1 = s[j]
s2 = s[j+1]
s3=s[j+2]
hj = J*op("Sz",s1) * op("Sz",s2) +
B*op("Sx",s1) * op("Id",s2)
Gj = exp(-1.0im * tau/2 * hj)
push!(gates,Gj)
hj2 = k*op("Sz",s1) * op("Sz",s3)
Gj2 = exp(-1.0im * tau/2 * hj2)
push!(gates,Gj2)
end
ssecond=s[N-1]
slast=s[N]
hsecondlast= J*op("Sz",ssecond) * op("Sz",slast) +
B*op("Sx",ssecond) * op("Id",slast)
Gsecondlast=exp(-1.0im * tau/2 * hsecondlast)
push!(gates,Gsecondlast)
hlast=B*op("Sx",slast)
Glast=exp(-1.0im * tau/2 * hlast)
push!(gates,Glast)
# Include gates in reverse order too
# (N,N-1),(N-1,N-2),...
append!(gates,reverse(gates))
# Function that measures <Sz> on site n
function measure_Sz(psi,n)
psi = orthogonalize(psi,n)
sn = siteind(psi,n)
Sz = scalar(dag(prime(psi[n],"Site"))*op("Sz",sn)*psi[n])
return real(Sz)
end
# Initialize psi to be a product state (alternating up and down)
psi = productMPS(s, "Up")
c = 4
# Compute and print initial <Sz> value
t = 0.0
Sz = measure_Sz(psi,c)
println("$t $Sz")
# Do the time evolution by applying the gates
# for Nsteps steps
for step=1:Nsteps
psi = apply(gates, psi; cutoff=cutoff)
# @show linkdims(psi)
t += tau
orthogonalize!(psi,c)
rho=prime(psi[c],s[c])*dag(psi[c])
print("$t $rho") #one- site rdm which is what I need
# Sz = measure_Sz(psi,c)
# println("$t $Sz")
end
return
end
I have chosen low cutoffs and dt to try and match with ED. In doing it like this while initially the agreement with ED is good, by t=10 errors are of the order 10^{-2} which seems too large for considering the parameters I have taken. I then also tried using 3-site gates,
gates = ITensor[]
for j=1:N-2
s1 = s[j]
s2 = s[j+1]
s3=s[j+2]
hj = op("Sz",s1) * op("Sz",s2)*op("Id",s3) +op("Sz",s1) * op("Id",s2)*op("Sz",s3)
+1.0*op("Sx",s1) * op("Id",s2)*op("Id",s3)
Gj = exp(-1.0im * tau/2 * hj)
push!(gates,Gj)
end
But that actually gives no evolution!
I was wondering what I am doing wrong in either case and what is the best way to code this Hamiltonian.