# Charge Mod N Conservation

**URL:** <https://itensor.discourse.group/t/charge-mod-n-conservation/1311>\
**Category:** ITensor Julia Questions\
**Created:** [November 23, 2023, 1:04pm UTC](https://itensor.discourse.group/t/charge-mod-n-conservation/1311 "2023-11-23T13:04:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdrobertson0321](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@mdrobertson0321](https://itensor.discourse.group/u/mdrobertson0321)\
**Post date:** [November 23, 2023, 1:04pm UTC](https://itensor.discourse.group/t/charge-mod-n-conservation/1311/1 "2023-11-23T13:04:01Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![miles](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/miles/32/6_2.png) [@miles](https://itensor.discourse.group/u/miles)\
**Post date:** [November 23, 2023, 6:24pm UTC](https://itensor.discourse.group/t/charge-mod-n-conservation/1311/2 "2023-11-23T18:24:16Z")

</div>

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.
