I was wondering if it is possible to build MPOs without using OpSum. It seems that this is possible in the C++ version of ITensor (Constructing MPO manually - ITensor Support Q&A) but I cannot see how this could be done in the Julia version.
You should be able to use opsum to get all of H except the center element. And then assign the center afterwards. I can make some sample code for you, but I don’t understand the e^{-1} element, it is a scalar, we need an operator there. Did you mean I*e^{-1} ?
using ITensors
let
N,J=5,1.0
s=siteinds("S=1/2",N)
# Build the NN Ising portion of H using OpSum for convenience
os=OpSum()
for i in 1:N-1
os += J,"Sz",i,"Sz",i+1
end
H=MPO(os,s) #Convert to MPO, H[1] and H[N] are row and column vectors
ils=linkinds(H) #Get all N-1 linkindices
H[2]+=exp(-1.0)*op(s[2],"Id")*onehot(ils[1]=>2,ils[2]=>2)
@show H[2]
end