# To find ground state energy for a fixed "Sz\_total"

**URL:** <https://itensor.discourse.group/t/to-find-ground-state-energy-for-a-fixed-sz-total/222>\
**Category:** ITensor C++ Questions\
**Created:** [June 22, 2022, 7:03am UTC](https://itensor.discourse.group/t/to-find-ground-state-energy-for-a-fixed-sz-total/222 "2022-06-22T07:03:13Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![vrushali.k](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vrushali.k](https://itensor.discourse.group/u/vrushali.k)\
**Post date:** [June 22, 2022, 7:03am UTC](https://itensor.discourse.group/t/to-find-ground-state-energy-for-a-fixed-sz-total/222/1 "2022-06-22T07:03:13Z")

</div>

Hi,  
I am interested to find ground state energy for a spin chain using DMRG for a fixed Sz\_total=0,1,2. How to do that?

---

<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:** [June 22, 2022, 1:51pm UTC](https://itensor.discourse.group/t/to-find-ground-state-energy-for-a-fixed-sz-total/222/2 "2022-06-22T13:51:12Z")

</div>

The way that our QN conserving DMRG works is that when you give it an initial state to use, it keeps the total quantum numbers of that state exactly the same throughout the calculation. So if you give it an initial state with total S^z=1 for example, then DMRG will find the lowest-energy state having total S^z=1.

For a detailed walkthrough of how to do this, please see the following code example pages:

- Julia version (the writing is also applicable to the C++ version)  
[https://itensor.github.io/ITensors.jl/stable/tutorials/QN\_DMRG.html](https://itensor.github.io/ITensors.jl/stable/tutorials/QN_DMRG.html)
- C++ version  
[http://itensor.org/docs.cgi?vers=cppv3&page=formulas/qn\_dmrg](http://itensor.org/docs.cgi?vers=cppv3&page=formulas/qn_dmrg)

---

<div class="post-metadata">

**Author:** ![vrushali.k](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vrushali.k](https://itensor.discourse.group/u/vrushali.k)\
**Post date:** [June 23, 2022, 6:54am UTC](https://itensor.discourse.group/t/to-find-ground-state-energy-for-a-fixed-sz-total/222/3 "2022-06-23T06:54:12Z")

</div>

Thanks. But for even N it is not possible to fix Sz\_total=1.

---

<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:** [June 23, 2022, 7:02pm UTC](https://itensor.discourse.group/t/to-find-ground-state-energy-for-a-fixed-sz-total/222/4 "2022-06-23T19:02:36Z")

</div>

I see – so there is one possible source of confusion which is that for S^z, ITensor uses units where

- S^z=1/2 corresponds to `QN("Sz",1)`
- S^z=1 corresponds to `QN("Sz",2)`
- S^z=3/2 corresponds to `QN("Sz",3)`  
and so on. So the “ITensor units” are twice that of the usual spin units.

Then if your point about Sz\_total=1 (ITensor units) not being possible for an even number of spins means S^z=1/2 (physics units) isn’t possible, that is correct and is just an unavoidable consequence of the mathematics of spin. But if you meant S^z=1 in physics units, then that would be possible.

Could you please clarify the units you meant? (ITensor units versus physics?)

---

<div class="post-metadata">

**Author:** ![vrushali.k](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vrushali.k](https://itensor.discourse.group/u/vrushali.k)\
**Post date:** [June 24, 2022, 5:38am UTC](https://itensor.discourse.group/t/to-find-ground-state-energy-for-a-fixed-sz-total/222/5 "2022-06-24T05:38:54Z")

</div>

suppose I have N=6 spin-1/2 chain with arranegment up\_1 dn\_2 up\_3 dn\_4 up\_5 dn\_6. Here Sz\_total=0. If I flip one spin then arrangement will be up\_1 dn\_2 up\_3 up\_4 up\_5 dn\_6. So here Sz\_total=1. So I was expecting output QN(“Sz”,1) where I was getting QN(“Sz”,2).

---

<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:** [June 24, 2022, 1:58pm UTC](https://itensor.discourse.group/t/to-find-ground-state-energy-for-a-fixed-sz-total/222/6 "2022-06-24T13:58:27Z")

</div>

In my previous answer, I indicated that Sz\_total=1 in physical corresponds to `QN("Sz",2)` in ITensor units. Does that answer your question?

---

<div class="post-metadata">

**Author:** ![vrushali.k](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vrushali.k](https://itensor.discourse.group/u/vrushali.k)\
**Post date:** [June 27, 2022, 9:09am UTC](https://itensor.discourse.group/t/to-find-ground-state-energy-for-a-fixed-sz-total/222/7 "2022-06-27T09:09:59Z")

</div>

Yes, That answers my question. Thanks a lot.

---

<div class="post-metadata">

**Author:** ![vrushali.k](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vrushali.k](https://itensor.discourse.group/u/vrushali.k)\
**Post date:** [July 31, 2023, 7:16am UTC](https://itensor.discourse.group/t/to-find-ground-state-energy-for-a-fixed-sz-total/222/8 "2023-07-31T07:16:19Z")

</div>

Hi miles,  
Suppose I am using AFM spin-half chain having N sites and I want a state conserving total Sz=N/2 i.e. all spins are up or down. After DMRG calculations I would expect ground state and first excited state energy to be same. But it comes different. Can you please clarify?

---

<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:** [July 31, 2023, 2:05pm UTC](https://itensor.discourse.group/t/to-find-ground-state-energy-for-a-fixed-sz-total/222/9 "2023-07-31T14:05:34Z")

</div>

Hi vrushali.k,  
To keep the forum better organized, please start a new topic when asking a new question.

Also, if you do decide to, could you please provide some more information about what you are asking? Whether or not the ground and first excited state have the same energy depends on whether the Hamiltonian has a gap. As you know, some systems have a gap and others do not and it depends very much on the system.

---

<div class="post-metadata">

**Author:** ![vrushali.k](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vrushali.k](https://itensor.discourse.group/u/vrushali.k)\
**Post date:** [August 1, 2023, 5:50am UTC](https://itensor.discourse.group/t/to-find-ground-state-energy-for-a-fixed-sz-total/222/10 "2023-08-01T05:50:22Z")

</div>

okay.
