Dear Christoph,
Thanks for your code. Can I run it on kwant 1.0 ? When I run your code on my computer I get some error message:

Traceback (most recent call last):
  File "E:\360data\importantdata\desktop\Bulk", line 191, in <module>
  File "E:\360data\importantdata\desktop\Bulk", line 181, in test
    np.testing.assert_almost_equal(energies_a, energies_b)
  File "E:\Kwant Install\Python27\lib\site-packages\numpy\testing\", line

452, in assert_almost_equal
    return assert_array_almost_equal(actual, desired, decimal, err_msg)
  File "E:\Kwant Install\Python27\lib\site-packages\numpy\testing\", line

812, in assert_array_almost_equal
    header=('Arrays are not almost equal to %d decimals' % decimal))
  File "E:\Kwant Install\Python27\lib\site-packages\numpy\testing\", line

645, in assert_array_compare
    raise AssertionError(msg)
Arrays are not almost equal to 7 decimals

(mismatch 90.3225806452%)
 x: array([[-1.        ,  1.        ],
       [-1.19292464,  1.19292464],
       [-1.3736081 ,  1.3736081 ],...
 y: array([[-1.        ,  1.        ],
       [-0.79754736,  0.79754736],
       [-0.58925337,  0.58925337],...

Do you know why this happens?
Best wishes,
Weiyuan Tong


On Monday, February 8, 2016, Christoph Groth <> wrote:
Weiyuan Tong wrote:

I want to calculate the conductance and the band structure of a bulk graphene system.

Finalized systems in current Kwant can only handle a single direction of translational symmetry.  We are working on removing this restriction, but this unfortunately requires modifying some deep internals of Kwant.

There is, however, a workaround: I just finished a little code that makes it possible (and quite easy) to work with bulk systems in current Kwant.  The code takes a Kwant builder with an arbitrary number of translational symmetries and returns an equivalent builder with 1 or 0 symmetries that can be finalized. The symmetries that are removed are replaced by momentum parameters that are added to the system.

The code is available here:  It should be completely general, i.e. it should work with _any_ builder that uses _any_ values.  It should be also reasonably efficient.  The code seems to work well, but I did only some basic testing so far.

With this hack one can now do transport through systems with periodic BCs, transport across infinite planes, and calculate multi-dimensional band structures.  The provided example (function "demo") plots the band structure of bulk graphene.  To try it out, simply execute "python".

As always, I’m happy to hear comments and suggestions.