# Understanding conserved QNs

**URL:** <https://itensor.discourse.group/t/understanding-conserved-qns/2384>\
**Category:** DMRG and Numerical Methods\
**Created:** [May 9, 2025, 7:55pm UTC](https://itensor.discourse.group/t/understanding-conserved-qns/2384 "2025-05-09T19:55:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElevenBadger](https://avatars.discourse-cdn.com/v4/letter/e/6bbea6/32.png) [@ElevenBadger](https://itensor.discourse.group/u/ElevenBadger)\
**Post date:** [May 9, 2025, 7:55pm UTC](https://itensor.discourse.group/t/understanding-conserved-qns/2384/1 "2025-05-09T19:55:04Z")

</div>

Hi all,

I’m trying to study a multi-component Hubbard model, similar to what was asked before [here](https://itensor.discourse.group/t/dmrg-with-mixed-local-hilbert-space-types/201). However, instead of splitting up the sites into a mixed “Electron” space, I’m trying to define a single custom SiteType. Essentially, I’d like to generalise the “Electron” SiteType for additional internal states.

Defining the new SiteType with no QNs and the operators is fairly straightforward. However, I’m struggling to understand how to implement the conservation laws, for example, to conserve the number of fermions of each spin. In particular, in the predefined “Electron” type, I don’t fully understand the following lines:

```julia
if conserve_sz && conserve_nf
    return [
      QN((qnname_nf, 0, -1), (qnname_sz, 0)) => 1
      QN((qnname_nf, 1, -1), (qnname_sz, +1)) => 1
      QN((qnname_nf, 1, -1), (qnname_sz, -1)) => 1
      QN((qnname_nf, 2, -1), (qnname_sz, 0)) => 1
    ]
  elseif conserve_nf
    return [
      QN(qnname_nf, 0, -1) => 1
      QN(qnname_nf, 1, -1) => 2
      QN(qnname_nf, 2, -1) => 1
    ]
  elseif conserve_sz
    return [
      QN((qnname_sz, 0), (qnname_nfparity, 0, -2)) => 1
      QN((qnname_sz, +1), (qnname_nfparity, 1, -2)) => 1
      QN((qnname_sz, -1), (qnname_nfparity, 1, -2)) => 1
      QN((qnname_sz, 0), (qnname_nfparity, 0, -2)) => 1
    ]
  elseif conserve_nfparity
    return [
      QN(qnname_nfparity, 0, -2) => 1
      QN(qnname_nfparity, 1, -2) => 2
      QN(qnname_nfparity, 0, -2) => 1
    ]
  end

```

I think I understand how the conservation of the total number of fermions is implemented, but not the conservation of Sz.

Aren’t the qnname’s just labels? In this sense, why if Sz is conserved QN needs two tuples? And also, what’s the difference between the QNs inside  
conserve\_sz && conserve\_nf and conserve\_sz, and between  
conserve\_nf and conserve\_nfparity?

Also, what does the third input in (qnname\_nf, \_ , -1) and (qnname\_nfparity, \_, -2) mean [the -1 and -2]?

Thanks!

---

<div class="post-metadata">

**Author:** ![ryanlevy](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/ryanlevy/32/150_2.png) [@ryanlevy](https://itensor.discourse.group/u/ryanlevy)\
**Post date:** [May 9, 2025, 8:38pm UTC](https://itensor.discourse.group/t/understanding-conserved-qns/2384/2 "2025-05-09T20:38:00Z")

</div>

The third input is the group “modulus”, see Miles’ comment here: [Why nf is defined modulus -1 in sitetype "fermion" "electron" - #2 by miles](https://itensor.discourse.group/t/why-nf-is-defined-modulus-1-in-sitetype-fermion-electron/2141/2)

qnnames are just labels but they are rigorously related to conserved global abelian symmetries of the states/operators. Those lines describe how the space is split up, so that all operations are block diagonal within that space. If total Sz is conserved and total fermion number is not conserved then fermion parity is conserved.

Perhaps check out the ITensor paper section 8:  
[https://scipost.org/SciPostPhysCodeb.4/pdf](https://scipost.org/SciPostPhysCodeb.4/pdf)  
and the references in that section

---

<div class="post-metadata">

**Author:** ![ElevenBadger](https://avatars.discourse-cdn.com/v4/letter/e/6bbea6/32.png) [@ElevenBadger](https://itensor.discourse.group/u/ElevenBadger)\
**Post date:** [May 9, 2025, 8:51pm UTC](https://itensor.discourse.group/t/understanding-conserved-qns/2384/3 "2025-05-09T20:51:57Z")

</div>

Thanks! That makes sense. Apologies for not finding that previous post.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/itensor/original/1X/d3072b13e047cd06df7f3981547c0917d940dfa4.png) [@system](https://itensor.discourse.group/u/system)\
**Post date:** [May 19, 2025, 8:52pm UTC](https://itensor.discourse.group/t/understanding-conserved-qns/2384/4 "2025-05-19T20:52:00Z")

</div>

Closed on May 19, 2025, 8:52pm UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
