Charge Mod N Conservation

I’m trying to investigate a 4e-superconductor, so my Hamiltonian conserves charge mod 4 only. I was attempting to make custom sites on top of the given electron site class, such that it would conserve charge mod 4. Is this the correct way to impose this?

Below Q4 is my name for the charge mod 4 quantum number. I was inferring from looking at fermion parity that having a -4 as the second number would lead to it being mod 4.

QN(“Q4”, 0, -4) => 1,
QN(“Q4”, 1, -4) => 2,
QN(“Q4”, 2, -4) => 1

Thank you!

Yes, this is the correct way to define a QN for a quantum number that behaves as Z_2 (\text{mod} 4). It is good that you are putting the minus sign too, though I don’t think we are using that minus sign anywhere in the library right now (it was more of a “future proofing” sort of idea). If you are making a custom “site type” there is a system for registering certain operators as fermionic by defining a certain function on them; I can point you to some examples for the “Electron” and “Fermion” site types. Doing this won’t enable fermionic behavior everywhere, but it will enable it for the OpSum system (for making Hamiltonians and other MPO’s) and also for functions like expect and correlation_matrix for computing one- and two-point observables.