Hi Ali,
A quick reply from my side. This
hamiltonian = semicon.models.foreman(
components=['foreman'],
bands=bands,
coords='xz',
)
specify what will be spatial dependence of the parameters in the symbolic
Hamiltonian that is used.
As far as I remember, two_deg_params provides you a single coordinate
dependent parameters.
I suggest you either create parameter functions returned by two_deg_params
by hand or
try to set coords of semicon.models.foreman to the single coordinate along
which you want to
vary your parameters.
I will be able to look more in details into that next week.
Regards,
Rafal
--
Rafał Skolasiński
Software Engineer
GitHub: https://github.com/RafalSkolasinski
Kwant GitLab: https://gitlab.kwant-project.org/r-j-skolasinski
On Tue, 4 Dec 2018 at 16:14, Ali Asgharpour <[email protected]>
wrote:
> Thanks for the feedback! If you find the bug, would you please let me
> know? Thanks in advance. By the way, I am also trying to code it myself
> from the beginning. Thanks again.
>
> Best regards,
>
> Ali
>
> On Tue, Dec 4, 2018 at 6:57 PM Joseph Weston <[email protected]>
> wrote:
>
>> Thanks for the information!
>>
>> 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.
>>
>>
>> this certainly looks like a bug in semicon. I've managed to reproduce the
>> bug, but I don't understand why it occurs. I inspected what was happening
>> using the Python debugger and it seems to me that everything should work
>> (but clearly it doesn't!).
>>
>>
>> Unfortunately the author of semicon is no longer working in academia, and
>> the semicon project is currently without a maintainer (and it's not even
>> v1.0!), so I am not sure what the best course of action is going forward.
>>
>>
>> Happy Kwanting,
>>
>>
>> Joe
>>
>