# Ground state Energy and quantum\_number conservation in iDMRG using VUMPS algorithm

**URL:** <https://itensor.discourse.group/t/ground-state-energy-and-quantum-number-conservation-in-idmrg-using-vumps-algorithm/2200>\
**Category:** ITensor Julia Questions\
**Created:** [January 15, 2025, 8:36pm UTC](https://itensor.discourse.group/t/ground-state-energy-and-quantum-number-conservation-in-idmrg-using-vumps-algorithm/2200 "2025-01-15T20:36:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paban.patra](https://avatars.discourse-cdn.com/v4/letter/p/58956e/32.png) [@paban.patra](https://itensor.discourse.group/u/paban.patra)\
**Post date:** [January 15, 2025, 8:36pm UTC](https://itensor.discourse.group/t/ground-state-energy-and-quantum-number-conservation-in-idmrg-using-vumps-algorithm/2200/1 "2025-01-15T20:36:23Z")

</div>

Hi,

I am working on a two-leg ladder model to find the ground state energy using the VUMPS algorithm in Julia. For this, I have chosen a custom unit cell of 4 sites . The unit cell Hamiltonian given below.

 ![vumps](https://global.discourse-cdn.com/free1/uploads/itensor/original/1X/75420d7b60d95e8e1eda62b8f0cfd426836bc755.png)

where even-numbered sites are on one leg and odd-numbered sites are on the other leg.

I have two questions basically,

(i) When I set `conserve_qns = true` and use an initial Neel state( S\_{z}=0), I get an error. This error doesn’t occur in the finite-size DMRG case. Can you explain how to fix it?

`you are trying to set is in a block with flux QN(("Nf",0,-1),("Sz",2)), which is different from the flux QN(("Nf",0,-1),("Sz",0)) of the other blocks of the ITensor.`

(ii) while I found the final wavefunction after the following command

`ψ = vumps_subspace_expansion(H, ψ; outer_iters, subspace_expansion_kwargs, vumps_kwargs)`

I’m unable to obtain the ground state energy for the infinite system. I understand that the method for calculating ground state energy in finite systems (e.g., DMRG) doesn’t apply here, but I’m unsure of the correct approach for the infinite system. Could you clarify how to compute the ground state energy in this context ?

Thanking you  
Paban

---

<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:** [January 15, 2025, 9:56pm UTC](https://itensor.discourse.group/t/ground-state-energy-and-quantum-number-conservation-in-idmrg-using-vumps-algorithm/2200/2 "2025-01-15T21:56:13Z")

</div>

Small comment, from [Please Read: Make It Easier to Help You](https://itensor.discourse.group/t/please-read-make-it-easier-to-help-you/7)

- **Please do not attach a screenshot of your code** , it makes it much more difficult for us to help you since then we cannot easily run your code to reproduce your issue. Instead, copy the text of your code directly into your post and format it properly so that we can easily read it.

1. Note that when you make a unit cell, you need to include all connections to the next unit cell. This means that because you have U in 1-4, you’ll need whatever hops that are in 5,6,7,8

An example of the Hubbard model for 2 sites in this way:

```julia
function ITensorInfiniteMPS.unit_cell_terms(::Model"hubbard1d_2"; t,U)
  op = OpSum()

  op += -t, "Cdagup", 1, "Cup", 2
  op += -t, "Cdagup", 2, "Cup", 1
  op += -t, "Cdagdn", 1, "Cdn", 2
  op += -t, "Cdagdn", 2, "Cdn", 1

  # these connect to the next unit cell
  op += -t, "Cdagup", 2, "Cup", 3
  op += -t, "Cdagup", 3, "Cup", 2
  op += -t, "Cdagdn", 2, "Cdn", 3
  op += -t, "Cdagdn", 3, "Cdn", 2

  op += U, "Nupdn", 1
  op += U, "Nupdn", 2
  return op
end

```

1. The “energy” is the energy per site for each site in your unit cell. You can average these together to create an overall “energy per site” of your model. To calculate the energy (which is also displayed during optimization), you can use

```julia
expect(ψ,H)

```

which will produce a vector of `N` elements (4 for your case). I would suggest playing around with [the examples](https://github.com/ITensor/ITensorInfiniteMPS.jl/tree/main/examples/vumps) that have exact energy references to see how the final wave functions and their energy compare to the exact answers
