Dear Xiangru,

If you provide a code that reproduces the error, you will have more chances that someone  answers your question.

Regards,
Adel

On Wed, Aug 19, 2020 at 2:01 AM Xiangru Kong <kongxru@gmail.com> wrote:
I know there is Tbmodels package can deal with wannier90 output tight binding files. But I think TBmodels group all the orbitals into one site.

I was trying to do things that can assign hoppings and on-site energies in "Real" systems that have differnet sites but with different orbitals per site.

The errors are the following when I try to use kwant_model.hamiltonian_submatrix module

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/Users/x0k/opt/anaconda3/envs/kwant/lib/python3.6/site-packages/kwant/builder.py in hamiltonian(self, i, j, params, *args)
   1885                 try:
-> 1886                     value = value(site, *args)
   1887                 except Exception as exc:

/Users/x0k/opt/anaconda3/envs/kwant/lib/python3.6/site-packages/kwant/wraparound.py in f(*in_args)
    154                 if callable(val):
--> 155                     acc = acc + val(*out_args)
    156                 else:

ValueError: operands could not be broadcast together with shapes (6,6) (10,10)

The above exception was the direct cause of the following exception:

UserCodeError                             Traceback (most recent call last)
<ipython-input-34-1b24fb1489bf> in <module>()
      3         params={key: val for key, val in zip(['k_x', 'k_y', 'k_z'], 2 * np.pi * np.array(k_list[0]))}
      4     )
----> 5 ) for k in k_list]

<ipython-input-34-1b24fb1489bf> in <listcomp>(.0)
      3         params={key: val for key, val in zip(['k_x', 'k_y', 'k_z'], 2 * np.pi * np.array(k_list[0]))}
      4     )
----> 5 ) for k in k_list]

/Users/x0k/opt/anaconda3/envs/kwant/lib/python3.6/site-packages/kwant/_common.py in inner(*args, **kwargs)
     70             if sig.bind(*args, **kwargs).arguments.get(parameter_name):
     71                 warn()
---> 72             return f(*args, **kwargs)
     73
     74         return inner

kwant/_system.pyx in kwant._system.hamiltonian_submatrix()

/Users/x0k/opt/anaconda3/envs/kwant/lib/python3.6/site-packages/kwant/builder.py in hamiltonian(self, i, j, params, *args)
   1892                                    ', '.join(map('"{}"'.format, missing)))
   1893                             raise TypeError(''.join(msg))
-> 1894                     _raise_user_error(exc, value)
   1895         else:
   1896             edge_id = self.graph.first_edge_id(i, j)

/Users/x0k/opt/anaconda3/envs/kwant/lib/python3.6/site-packages/kwant/builder.py in _raise_user_error(exc, func)
   1814     msg = ('Error occurred in user-supplied value function "{0}".\n'
   1815            'See the upper part of the above backtrace for more information.')
-> 1816     raise UserCodeError(msg.format(func.__name__)) from exc
   1817
   1818

UserCodeError: Error occurred in user-supplied value function "f".
See the upper part of the above backtrace for more information.


--
Abbout Adel