Dear Christoph,
Thanks a lot for your helpful reply. 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).
Best regards,
Kwok-Long Lee

On Thu, Dec 4, 2014 at 5:49 PM, wrote:
Dear Lee Kwok-Long,

To be able to work with Kwant there's no way around learning the basics of Python.  There are plenty of good tutorials available on the internet.  We recommend the official Python tutorial (https://docs.python.org/2/tutorial/index.html) and “Software carpentry” (http://software-carpentry.org/v5/novice/python/index.html).

You wrote:

I want to output the results into a .txt file with the energy in the first column, well depths in the second column, conductance in the third column, so I can plot the contour by origin.

You can add a function print_conductances to the tutorial script:

def plot_conductance(sys, energies, welldepths):
for energy in energies:
for welldepth in welldepths:
smatrix = kwant.smatrix(sys, energy,            args=[-welldepth])
print energy, welldepth, smatrix.transmission(1, 0)

Call it like this:

plot_conductance(sys,
energies=[0.01 * i for i in xrange(100)],
welldepths=[0.01 * i for i in xrange(100)])

The data will be printed as you wished.  In order to print it to a file and not to the terminal screen, redirect the output to a file when running the script (this will even work with Windows as far as I know):

python script.py >conductance.dat

Note that if you want to make a 2d plot of this data, you can directly use matplotlib’s imshow.  There’s no need to output the data to a file.

Best regards,
Christoph