Dear Kwok-Long Lee, You wrote:
I have another question about " smatrix = kwant.smatrix(sys, energy, args=[-welldepth])", and I found in tutorial 2.3.2 the expression "kwant.smatrix allows us to specify a list, *args*, that will be passed additional arguments to the functions that provide the Hamiltonian matrix elements." So *args *passed additional arguments to the "def make_system", but the corresponding parameter in def make_system is unclear, for example, in tutorial 2.3.2 the corresponding parameter for args =[-welldepth] is the "potential(site, pot)". When we have more than one additional arguments like args=[-welldepth, hex], how can kwant.smatrix(sys, energy, args=[-welldepth,hex]) find the right corresponding parameters in def make_system, will it cause mistakes? I mean hex in args=[-welldepth,hex]) may passed value to potential(site, pot).
Kwant’s “args” are explained here: http://kwant-project.org/doc/1.0/pre/whatsnew/1.0#parameters-to-hamiltonian args is a sequence (i.e. list) that is passed as additional arguments to all value functions of the system. So, if you call kwant.smatrix(sys, energy, args=[-welldepth, hex]), all your value functions will need to take two additional arguments. For example: def onsite(site, foo, bar): … “onsite” is a site value function, so with empty “args” it would need to accept a single argument, a site. If args has length 2, the function needs to take exactly two additional arguments. Their names do not matter, only the order does. All of this has been inspired by Python’s own *-syntax by the way: https://docs.python.org/2/tutorial/controlflow.html#unpacking-argument-lists Christoph