# Density Induced Hopping / Correlated Hopping

**URL:** <https://itensor.discourse.group/t/density-induced-hopping-correlated-hopping/713>\
**Category:** ITensor Julia Questions\
**Tags:** julia, dmrg, mps, fermions\
**Created:** [March 20, 2023, 9:00pm UTC](https://itensor.discourse.group/t/density-induced-hopping-correlated-hopping/713 "2023-03-20T21:00:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aditya214](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/aditya214/32/231_2.png) [@Aditya214](https://itensor.discourse.group/u/Aditya214)\
**Post date:** [March 20, 2023, 9:00pm UTC](https://itensor.discourse.group/t/density-induced-hopping-correlated-hopping/713/1 "2023-03-20T21:00:31Z")

</div>

Urgent Help !!  
Hey ! I am just getting acquainted with ITENSOR julia version (recently shifted from Tenpy 🙂 ) Well, my main aim is to code Hamiltonian involving density-induced hopping, also called correlated hopping, as shown in the image below:

 ![image](https://global.discourse-cdn.com/free1/uploads/itensor/original/1X/10c91a98e3b222676429710938ce75677318009b.png)  
Also see: [Phys. Rev. B 106, L241115 (2022) - Interacting second-order topological insulators in one-dimensional fermions with correlated hopping](https://journals.aps.org/prb/abstract/10.1103/PhysRevB.106.L241115)  
Explanation: Here two chains are taken and the hopping of second chain depends on the density of first chain. I have tried a lot however could not code the hamiltonian. It would be great if you could provide its Julia code.

---

<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:** [March 21, 2023, 12:23am UTC](https://itensor.discourse.group/t/density-induced-hopping-correlated-hopping/713/2 "2023-03-21T00:23:18Z")

</div>

One thing I’d suggest starting with is to plot the density of the bosons after the DMRG calculation is done running. Are they distributed symmetrically across your system? I ask because your initial state has all of the bosons on the left half of the system then you only do 5 sweeps of DMRG, so it might not be converged after. Do your results become closer to ED if you do 10 sweeps or 30 sweeps?

---

<div class="post-metadata">

**Author:** ![Aditya214](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/aditya214/32/231_2.png) [@Aditya214](https://itensor.discourse.group/u/Aditya214)\
**Post date:** [March 21, 2023, 4:37am UTC](https://itensor.discourse.group/t/density-induced-hopping-correlated-hopping/713/3 "2023-03-21T04:37:11Z")

</div>

Hey Miles Thank you so much for your quick response. By the way I hope you noticed my main question which was how to code density induced hopping hamiltonian in ITENSOR Julia as shown below in the image:

 ![image](https://global.discourse-cdn.com/free1/uploads/itensor/original/1X/10c91a98e3b222676429710938ce75677318009b.png)  
And about the BHM model, yes the DMRG works better when I change my initial state but still there is an issue I will work it out and let you know. Could you please throw some light on how to code density induced hamiltonian in ITENSOR:Explanation: Here two chains are taken and the hopping of second chain depends on the density of first chain. I have tried a lot however could not code the hamiltonian. It would be great if you could provide its Julia code.

---

<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:** [March 24, 2023, 2:26am UTC](https://itensor.discourse.group/t/density-induced-hopping-correlated-hopping/713/4 "2023-03-24T02:26:31Z")

</div>

Hi Aditya,  
By the way, you can input and format Latex directly into posts on this forum. The way to do it is to use dollar signs $ to surround your Latex:  
so  
$$  
H = \sum\_{i,\sigma} J c^\dagger\_{i\sigma} c\_{i+1,\sigma} …  
$$  
turns into

H = \sum\_{i,\sigma} J c^\dagger\_{i\sigma} c\_{i+1,\sigma} ...

etc.

I assume the notation \bar{\sigma} means that if \sigma=\uparrow then \bar{\sigma}=\downarrow and vice versa?

Here is how you can input that Hamiltonian to the ITensor OpSum system to make an MPO for it:

```julia
using ITensors

let
  N = 10
  J = 1.0
  δJ = 0.1
  X = 0.5

  s = siteinds("Electron",N; conserve_nf=true)

  os = OpSum()

  for i=1:N-1
    os += -(J+δJ*(-1)^i),"Cdagup",i,"Cup",i+1
    os += -(J+δJ*(-1)^i),"Cdagup",i+1,"Cup",i
    os += -(J+δJ*(-1)^i),"Cdagdn",i,"Cdn",i+1
    os += -(J+δJ*(-1)^i),"Cdagdn",i+1,"Cdn",i

    os += -X*(J+δJ*(-1)^i),"Ndn",i,"Cdagup",i,"Cup",i+1
    os += -X*(J+δJ*(-1)^i),"Ndn",i,"Cdagup",i+1,"Cup",i
    os += -X*(J+δJ*(-1)^i),"Nup",i,"Cdagdn",i,"Cdn",i+1
    os += -X*(J+δJ*(-1)^i),"Nup",i,"Cdagdn",i+1,"Cdn",i

    os += -X*(J+δJ*(-1)^i),"Ndn",i+1,"Cdagup",i,"Cup",i+1
    os += -X*(J+δJ*(-1)^i),"Ndn",i+1,"Cdagup",i+1,"Cup",i
    os += -X*(J+δJ*(-1)^i),"Nup",i+1,"Cdagdn",i,"Cdn",i+1
    os += -X*(J+δJ*(-1)^i),"Nup",i+1,"Cdagdn",i+1,"Cdn",i
  end

  H = MPO(os,s)

  return
end

```

Please look closely over the code above to verify that it is defined correctly to the best of your understanding, and most importantly please check any DMRG or other calculations you do with it against known results or on small systems to debug it and check that it’s correct.

As you can see the main trick needed is to multiply out all the terms and then you can input products of operators using our OpSum system, then “compile” an OpSum into an actual MPO.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![Aditya214](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/aditya214/32/231_2.png) [@Aditya214](https://itensor.discourse.group/u/Aditya214)\
**Post date:** [March 25, 2023, 6:44pm UTC](https://itensor.discourse.group/t/density-induced-hopping-correlated-hopping/713/5 "2023-03-25T18:44:00Z")

</div>

Thank you So much Miles, it worked and gave the expected results. Itensor is one of the best numerical libraries I have ever experienced. I will surely cite ITENSOR in my next paper, thanks for your quick response, really appreciated.

---

<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:** [March 25, 2023, 10:19pm UTC](https://itensor.discourse.group/t/density-induced-hopping-correlated-hopping/713/6 "2023-03-25T22:19:52Z")

</div>

Glad to hear it works! Yes this is a good case where OpSum really shows its power and convenience. Thanks for the kind words about ITensor. That is high praise.
