# question about asymmetric hubbard model

**URL:** <https://itensor.discourse.group/t/question-about-asymmetric-hubbard-model/2020>\
**Category:** ITensor Julia Questions\
**Tags:** dmrg\
**Created:** [September 29, 2024, 9:42am UTC](https://itensor.discourse.group/t/question-about-asymmetric-hubbard-model/2020 "2024-09-29T09:42:42Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![corbett5](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/corbett5/32/886_2.png) [@corbett5](https://itensor.discourse.group/u/corbett5)\
**Post date:** [October 4, 2024, 6:19pm UTC](https://itensor.discourse.group/t/question-about-asymmetric-hubbard-model/2020/4 "2024-10-04T18:19:43Z")

</div>

I’ve been using ITensors to study the Ferm-Hubbard Hamiltonian as well and can confirm that 6x6 is ambitious. The one other remark I have is that I think your interaction term is wrong.

You have (ignoring the other terms)

```julia
for b in lattice
  os += U, "Nup", b.s1, "Ndn", b.s1
end

```

but here `for b in lattice` is iterating over all the lattice bonds not sites. Even worse the number of times `b.s1` will appear is not constant from site to site so you’ll wind up with different interaction strengths.

```julia
julia> lattice = square_lattice(2, 2; yperiodic=false)
4-element Vector{LatticeBond}:
 LatticeBond(1, 3, 1.0, 1.0, 2.0, 1.0, "")
 LatticeBond(1, 2, 1.0, 1.0, 1.0, 2.0, "")
 LatticeBond(2, 4, 1.0, 2.0, 2.0, 2.0, "")
 LatticeBond(3, 4, 2.0, 1.0, 2.0, 2.0, "")

julia> for b in lattice
       @show b.s1, b.s2
       end
(b.s1, b.s2) = (1, 3)
(b.s1, b.s2) = (1, 2)
(b.s1, b.s2) = (2, 4)
(b.s1, b.s2) = (3, 4)

```

I would imagine there’s a way to use the lattice system to do this but I would just do

```julia
for i in 1:N
  os += U, "Nup", i, "Ndn", i
end

```

Also, about the computational speed. Currently you’re only conserving the total spin, do you also want to conserve the total number of electrons (I think this is the most common case). Have you tried enabling the block sparse [multithreading](https://itensor.github.io/ITensors.jl/stable/Multithreading.html)? I would try increasing the number of sweeps at lower bond dimensions substantially as a way to speed convergence at the larger bond dimensions. I would also recommend saving the MPS to disk so that you can resume the calculation and not have to redo it every time ([here](https://itensor.discourse.group/t/how-to-save-mps-data-during-the-dmrg-calculation/949) is an example of how to do this).

---

_[View the full topic](https://itensor.discourse.group/t/question-about-asymmetric-hubbard-model/2020)._
