Thank you for your quick response. I am using kwant 1.3.3 version and semicon 0.1.0 version. I think the error is related to calling parameters function which are stored as a tuple. By the way, this is the error I encountered:

TypeError                                 Traceback (most recent call last)
/home/ali/anaconda3/lib/python3.6/site-packages/kwant/builder.py in hamiltonian(self, i, j, params, *args)
   1995                     try:
-> 1996                         value = value(self.sites[i], **params)
   1997                     except Exception as exc:

<string> in onsite(site, Delta_0, E_0, E_v, P, gamma_0, gamma_1, gamma_2, hbar, k_y, m_0)

TypeError: __call__() takes 2 positional arguments but 3 were given

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

UserCodeError                             Traceback (most recent call last)
<ipython-input-5-9c34d828bfe1> in <module>()
     59     # compute the scattering matrix at a given energy
     60     p = {'k_y': 0, **two_deg_params}
---> 61     smatrix = kwant.smatrix(syst, energy, params=p)
     62 
     63     # compute the transmission probability from lead 0 to

/home/ali/anaconda3/lib/python3.6/site-packages/kwant/solvers/common.py in smatrix(self, sys, energy, args, out_leads, in_leads, check_hermiticity, params)
    370         linsys, lead_info = self._make_linear_sys(syst, in_leads, energy, args,
    371                                                   check_hermiticity, False,
--> 372                                                   params=params)
    373 
    374         kept_vars = np.concatenate([coords for i, coords in

/home/ali/anaconda3/lib/python3.6/site-packages/kwant/solvers/common.py in _make_linear_sys(self, sys, in_leads, energy, args, check_hermiticity, realspace, params)
    162         lhs, norb = syst.hamiltonian_submatrix(args, sparse=True,
    163                                                return_norb=True,
--> 164                                                params=params)[:2]
    165         lhs = getattr(lhs, 'to' + self.lhsformat)()
    166         lhs = lhs - energy * sp.identity(lhs.shape[0], format=self.lhsformat)

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

/home/ali/anaconda3/lib/python3.6/site-packages/kwant/builder.py in hamiltonian(self, i, j, params, *args)
   1996                         value = value(self.sites[i], **params)
   1997                     except Exception as exc:
-> 1998                         _raise_user_error(exc, value)
   1999                 else:
   2000                     try:

/home/ali/anaconda3/lib/python3.6/site-packages/kwant/builder.py in _raise_user_error(exc, func)
   1883     msg = ('Error occurred in user-supplied value function "{0}".\n'
   1884            'See the upper part of the above backtrace for more information.')
-> 1885     raise UserCodeError(msg.format(func.__name__)) from exc
   1886 
   1887 

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


On Tue, Dec 4, 2018 at 3:21 PM Joseph Weston <joseph.weston08@gmail.com> wrote:
Hi Ali,


> I want to find conductance of a heterostructure using semicon library.
> When I just use coords='z', everything is OK. But, when I want to
> change it to two dimensions like 'xz', I encounter an error. Would you
> please tell me how I can fix it? I hope it is not just a
> simple mistake which I am not aware. Your time and consideration are
> greatly appreciated in advance. Please find attached the code
> correspondent to what I mentioned above.


Thanks for posting the script, but you'll need to give more information
before anyone else can help you:


+ what version of Kwant and semicon are you using

+ what error was produced? Please provide a full traceback


Happy Kwanting,


Joe