Calculate Energy Expectation on Ladder

How do I use this algorithm? What does that parameter do?
Post Reply
QS Wang
Posts: 8
Joined: 22 Mar 2021, 10:27

Calculate Energy Expectation on Ladder

Post by QS Wang »

Hello. I am working with an impurity-electron model on a ladder. The Hamiltonian is

\(H_tot=-t \sum_i (c_i^\dagger c_{i+1} +h.c.) - h \sum_i (\chi_i^\dagger \chi_{i+1}+h.c.) +V\sum_i n_{c,i} n_{c,i+1} + g \sum_i n_{c,i} n_{x,i}\)

where C is annihilator of a host Fermion and \(\chi\) that of an impority.
To verify its validity, I am trying to calculate its energy spectrum when there is no impurity and no host-host interaction, then the spectrum \(E_p = \langle GS | c_p H C_p^\dagger | GS \rangle \) should be cosine like. However, there is a technical problem. Calculating the energy expectation requires a H_bond, which cannot be attained in this case as for a ladder a physical nearest-pair-interaction has distance of interaction of 2, and calc_H_bond cannot be applied.

Is there any possible way to get it around?
QS Wang
Posts: 8
Joined: 22 Mar 2021, 10:27

Re: Calculate Energy Expectation on Ladder

Post by QS Wang »

The Hamiltonian is

\(H_tot=-t \sum_i (c_i^\dagger c_{i+1} +h.c.) - h \sum_i (\chi_i^\dagger \chi_{i+1}+h.c.) +V\sum_i n_{c,i} n_{c,i+1} + g \sum_i n_{c,i} n_{x,i}\)
User avatar
Johannes
Site Admin
Posts: 413
Joined: 21 Jul 2018, 12:52
Location: TU Munich

Re: Calculate Energy Expectation on Ladder

Post by Johannes »

There are more ways to get the expectation value \(E = \langle \psi | H | \psi\rangle \) of a given state than just through H_bonds: when you have a model, you can evaluate the MPO expectation value with M.H_MPO.expectation_value(psi).
Does this answer your question?
QS Wang
Posts: 8
Joined: 22 Mar 2021, 10:27

Re: Calculate Energy Expectation on Ladder

Post by QS Wang »

Thanks!
Another thing, now I am trying to calculate the spectrum function, for which I need to do tebd on the ladder model. However, it raises error when I try to calculate H_bond. When I try to get H_bond with calc_H_bond(), it says

Code: Select all

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-128-2c765ae31cee> in <module>()
----> 1 TestModel.calc_H_bond()

1 frames
/usr/local/lib/python3.7/dist-packages/tenpy/models/model.py in calc_H_bond(self, tol_zero)
   1482         ct = self.all_coupling_terms()
   1483         ct.remove_zeros(tol_zero)
-> 1484         H_bond = ct.to_nn_bond_Arrays(sites)
   1485 
   1486         ot = self.all_onsite_terms()

/usr/local/lib/python3.7/dist-packages/tenpy/networks/terms.py in to_nn_bond_Arrays(self, sites)
    725                     if j2 != i + 1:
    726                         msg = "Can't give nearest neighbor H_bond for long-range {i:d}-{j:d}"
--> 727                         raise ValueError(msg.format(i=i, j=j2))
    728                     for op2, strength in d3.items():
    729                         if isinstance(op2, tuple):

ValueError: Can't give nearest neighbor H_bond for long-range 0-2
when I try calc_H_bond_from_MPO, it says

Code: Select all

ValueError                                Traceback (most recent call last)
<ipython-input-129-3992d8e6b876> in <module>()
      1 TestModel.calc_H_MPO()
----> 2 TestModel.calc_H_bond_from_MPO()

/usr/local/lib/python3.7/dist-packages/tenpy/models/model.py in calc_H_bond_from_MPO(self, tol_zero)
    588         for W in Ws:
    589             if npc.norm(W) > tol_zero:
--> 590                 raise ValueError("Bond couplings didn't capture everything. "
    591                                  "Either H is long range or IdL/IdR is wrong!")
    592         # now merge the onsite terms to H_bond

ValueError: Bond couplings didn't capture everything. Either H is long range or IdL/IdR is wrong!
The definition of the model class is

Code: Select all

class GroupedBosonImpModel(CouplingMPOModel):
  default_lattice = "Ladder"
  force_default_lattice = True
  # this requires TeNPy v0.8.0

  def init_sites(self, model_params):
    conserve_F = model_params.get('conserve_F', 'N')
    filling_F = model_params.get('filling_F',0.5)
    conserve_B = model_params.get('conserve_B', 'N')
    filling_B = model_params.get('filling_B',0)
    Nmax = model_params.get('Nmax',1)
    model_label = model_params.get('label',None)
    model_charges = model_params.get('charges','independent')

    HostSite = FermionSite(conserve_F,filling_F)
    ImpSite = BosonSite(Nmax,conserve_B,filling_B)
    set_common_charges([HostSite, ImpSite], model_charges)
    return [HostSite, ImpSite]
  
  def init_terms(self, model_params):

    #confirm that the input lattice is a chain
    if not isinstance(self.lat, tenpy.models.lattice.Ladder):
      raise ValueError("The input lattice is not a Ladder") 

    #get the coupling constants, t*c_{i+1}^\dagger c_i, 
    # h*x_{i+1}^\dagger x_i
    # V*n_e*n_e and g*n_x*n_e
    # mue, mux the potential for particle number conservation

    t = model_params.get('t', 1.)
    h = model_params.get('h', 1.)
    V = model_params.get('V', 0.)
    g = model_params.get('g', 0.)
    mue = model_params.get('mue', 1.)
    mux = model_params.get('mux', 1.)

    #implement chemical potential
    self.add_onsite(-mue,0,'N')  # `u=0` = HostSite
    self.add_onsite(-mux,1,'N')  # `u=1` = ImpSite

    #implement e-imp interaction
    self.add_coupling(g, 0, 'N', 1, 'N', dx=[0],plus_hc=False)

    #implement e-e interaction
    self.add_coupling(V,0,'dN',0,'dN',dx=[1],plus_hc=False)

    #implement kinetic energy
    self.add_coupling(-t,0,'Cd',0,'C',1,plus_hc=True)
    self.add_coupling(-h,1,'Bd',1,'B',1,plus_hc=True)
    
  def bond_energies(self, psi):
      """Calculate bond energies <psi|H_bond|psi>.
      Parameters
      ----------
      psi : :class:`~tenpy.networks.mps.MPS`
          The MPS for which the bond energies should be calculated.
      Returns
      -------
      E_bond : 1D ndarray
          List of bond energies: for finite bc, ``E_Bond[i]`` is the energy of bond ``i, i+1``.
          (i.e. we omit bond 0 between sites L-1 and 0);
          for infinite bc ``E_bond[i]`` is the energy of bond ``i-1, i``.
      """
      if self.lat.bc_MPS == 'infinite':
          return psi.expectation_value(self.H_bond, axes=(['p0', 'p1'], ['p0*', 'p1*']))
      # else
      return psi.expectation_value(self.H_bond[1:], axes=(['p0', 'p1'], ['p0*', 'p1*']))
Do I need to rebuild another model with GroupedSite or could I do tebd with this class?
Post Reply