Dear Sreetama,
Thanks for the questions. Please let me know if I'm missing something, but the parity as defined for that code is by definition equal to the number of particles modulo two. So if the particle number is constant or conserved, then the parity will be conserved also.
So I don't believe there is actually a scenario possible where particle number will be conserved but parity won't be, essentially by definition. However, if you can provide an example such as a Hamiltonian for which this is the case then I could definitely help you set up your code to handle it.
Also, please note that for Electron sites, the default behavior is that only particle number "Nf" is conserved, while parity is not separately conserved since it would be redundant and would not make the tensors any more sparse. So maybe that is already the behavior you want? It is the behavior you will obtain if you just make the sites as:
auto sites = Electron(N);
Happy to discuss more -
Best regards,
Miles