Hi,
Just a quick question on fermionic/electronic sitetypes and where the JW strings are handled automatically. Looking at Fermion site-type operator `c`: `inner()` indicates `c` on different sites commute - #3 by christopherdavidwhit and Proper way to construct fermion gates, it’s unclear if Jordan Wigner strings are handled automatically in apply.
EDIT:
From some testing, it seems to depend on whether QN conservation is used. Here’s a minimal example showing this, where I create a state of two maximally entangled pairs. I will denote fermionic creation operators with c’s, bosonic creation operators as a’s, and pauli Z operators as F’s.
If the operators are applied in the opposite order, the answer should be
i.e. minus the answer of the opposite ordering.
Here is the code to test whether the F factors are included.
N = 4
s = siteinds("Fermion",N,conserve_qns = true)
cdag = [op(s,"Cdag",i) for i in 1:N]
Id = [op(s,"Id",i) for i in 1:N]
psi = MPS(ComplexF64,s,"0")
gate1 = (cdag[1]*Id[3] + Id[1]*cdag[3])/sqrt(2)
gate2 = (cdag[2]*Id[4] + Id[2]*cdag[4])/sqrt(2)
psi = apply(gate1,psi)
psi = apply(gate2,psi)
@show(psi[1]*psi[2]*psi[3]*psi[4])
If conserve_qns = false, the result is the state with no minus signs (i.e the c operators are treated bosonically) either way the operators are applied. If conserve_qns=true, the answer is strange. If gate1 is applied first and then gate2, the answer is
which is wrong. If gate2 is applied first and then gate1, the answer is
which is as expected. If you could help clear up the confusion for me that would be great!