Two-site Jordan-Wigner normalization and signs (source code)

= Two-site Jordan-Wigner normalization and signs
{title2=$s_j^\pm=(\sigma_j^x\pm i\sigma_j^y)/2,\quad\sigma_j^z=2f_j^\dagger f_j-1$}

With occupied fermion sites representing up-spins, use $s_1^-=f_1$, $s_2^-=P_1f_2$ and $P_1=(-1)^{n_1}=1-2n_1$. The <canonical anticommutation relations> imply $P_1^2=I$, $P_1f_1=-f_1P_1$ and $[P_1,f_2]=0$. Consequently the two sites commute as spin operators, while $[s_j^-,s_j^+]=1-2n_j=-\sigma_j^z$. This normalization is essential: the unscaled combinations $\sigma_j^x\pm i\sigma_j^y$ are twice $s_j^\pm$.

The <two-spin XY Hamiltonian> becomes
$$
H=2h-2h(n_1+n_2)-2J(f_1^\dagger f_2+f_2^\dagger f_1).
$$
In particular, $f_1^\dagger P_1=f_1^\dagger$ and $f_1P_1=-f_1$ fix the hopping signs. The modes $b=(f_1+f_2)/\sqrt2$ and $c=(f_1-f_2)/\sqrt2$ preserve the <canonical anticommutation relations> and give $H=2h+(-2h-2J)b^\dagger b+(-2h+2J)c^\dagger c$.