From f728597ce495ae1bddcff606b7086f0c13044d13 Mon Sep 17 00:00:00 2001 From: Christoph Groth <christoph.groth@cea.fr> Date: Fri, 30 Jun 2017 12:09:24 +0200 Subject: [PATCH] add (failing) test for zero-valued selfenergy leads That test fails because the result of the selfenergy callback is used as a numpy array without a call to asarray. --- kwant/tests/test_builder.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kwant/tests/test_builder.py b/kwant/tests/test_builder.py index b31c0dc0..bc61f971 100644 --- a/kwant/tests/test_builder.py +++ b/kwant/tests/test_builder.py @@ -1085,6 +1085,15 @@ def test_ModesLead_and_SelfEnergyLead(): ts2 = [kwant.greens_function(fsyst, e).transmission(1, 0) for e in energies] assert_almost_equal(ts2, ts) + # Append a virtual (=zero self energy) lead. This should have no effect. + # Also verifies that the selfenergy callback function can return exotic + # arraylikes. + syst.leads.append(builder.SelfEnergyLead( + lambda *args: list(ta.zeros((L, L))), interface)) + fsyst = syst.finalized() + ts2 = [kwant.greens_function(fsyst, e).transmission(1, 0) for e in energies] + assert_almost_equal(ts2, ts) + def test_site_pickle(): site = kwant.lattice.square()(0, 0) -- GitLab