Hi Miles,
Thanks for your prompt reply.
Before addressing my main problem, I should mention you’re right, maybe I have to change my site’s type!?
Our system is a 1-D lattice whose sites contain two fermions (particle and antiparticle) that after using Jordan-Wigner transformation I reach the Hamiltonian (that I wrote above) .So In this case I’m not sure which one I should use, “Fermion” or “Electron” site?
Now for the first part of the question, I appreciate your suggestions but I get error when I use your trick. Please let me know did I get your point correctly or not by another simple example as below.
Let’s work on simple Hamiltonian like:
\sum_{j=1}^{N} [\sigma_j^x \otimes \sigma_j^z - \sigma_j^z \otimes \sigma_j^x]^2
In this case, considering your response I should select A and B as follow
A = [(\sigma_j^x \otimes \sigma_j^z) -(\sigma_j^z \otimes \sigma_j^x)] \\
B = [(\sigma_j^x \otimes \sigma_j^z) - (\sigma_j^z \otimes \sigma_j^x)]
By making this choice I will get some errors.
How can I handle the minus sign in the middle of expression?
Here I have two sample codes, the first one does not make any errors but it’s not my subject, and the other one that is my desired expression makes some errors
using ITensors
N = 4;
sites = siteinds("S=1/2",N)
ampo = OpSum()
for j in 1:N
ampo += "Sx*Sz",j
ampo -= "Sz*Sx",j
end
H = MPO(ampo, sites)
psi0 = randomMPS(sites,10)
sweep = Sweeps(3)
setmaxdim!(sweep,10,10,20)
setcutoff!(sweep,1E-10)
energy, psi = dmrg(H,psi0,sweep)
No error.
using ITensors
N = 4;
sites = siteinds("S=1/2",N)
ampo = OpSum()
for j in 1:N
ampo += "((Sx*Sz)-(Sz*Sx)) * ((Sx*Sz)-(Sz*Sx))"
end
H = MPO(ampo, sites)
psi0 = randomMPS(sites,10)
sweep = Sweeps(3)
setmaxdim!(sweep,10,10,20)
setcutoff!(sweep,1E-10)
energy, psi = dmrg(H,psi0,sweep)
And this is its error type
``MethodError: no method matching +(::OpSum, ::String)"
Sorry about this long message.
Thank you in advance for your time