# Adding a field to Hamiltonian to form gates

0 votes
asked

I would like to perform TEBD with the Hamiltonian,
$$H=\sum^{N-1}{i} (XX + YY) + \sum{i=1}^{N} V(i)Z$$
Where V(i) is just some function that depends on the site. I want this written as a gate but when I compare numerics to small system size ED they do not match. Here is the code for creating my gates. Help is much appreciated

function Gates(N::Int, dt::Float64, J, λ, q, phi, sindex)
gates = ITensor[]
for j=1:N-1
s1 = sindex[j]
s2 = sindex[j+1]
if j != (N-1)
Wj = 2*λ*cos(2*pi*q*j + phi)
hj = J[j]*0.5*(op("S+", s1)*op("S-", s2) + op("S-", s1)*op("S+", s2)) + Wj*op("Sz", s1)*op("Id", s2)
Gj = exp(-1.0im*0.5*dt*hj)
elseif j==(N-1)
WjN = 2*λ*cos(2*pi*q*N + phi)
Wj = 2*λ*cos(2*pi*q*j + phi)
hj = J[j]*0.5*(op("S+", s1)*op("S-", s2) + op("S-", s1)*op("S+", s2)) + WjN*op("Id", s1)*op("Sz", s2) + Wj*op("Sz", s1)*op("Id", s2)
Gj = exp(-1.0im*0.5*dt*hj)
end
push!(gates, Gj)
end
append!(gates, reverse(gates))


end

## 1 Answer

0 votes
answered by (70.1k points)

Just a reminder this forum is now closed, and we are leaving it here mainly so that people can search it for previous answers.

Thanks for realizing this, clanglett, and posting on the new forum.

You can see my response here:
https://itensor.discourse.group/t/adding-a-field-to-hamiltonian-for-tebd-gates/364/2