From 4226d5fd7bb46ef84efaf4aa67e44fb562681b95 Mon Sep 17 00:00:00 2001 From: Christoph Groth <christoph.groth@cea.fr> Date: Fri, 6 Dec 2019 14:47:30 +0100 Subject: [PATCH] update examples to work (at all or without warnings) --- examples/advanced_construction.py | 2 +- examples/square.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/advanced_construction.py b/examples/advanced_construction.py index dbd5cb29b..ac1ae8ce0 100644 --- a/examples/advanced_construction.py +++ b/examples/advanced_construction.py @@ -47,7 +47,7 @@ def make_system(R): def main(): syst = make_system(100) - print(kwant.smatrix(syst, 1.1, [0.1]).transmission(0, 1)) + print(kwant.smatrix(syst, 1.1, params=dict(B=0.1)).transmission(0, 1)) if __name__ == '__main__': diff --git a/examples/square.py b/examples/square.py index ed3f634dc..2152cfd80 100644 --- a/examples/square.py +++ b/examples/square.py @@ -16,7 +16,9 @@ class Lead: self.t = t self.potential = potential - def selfenergy(self, fermi_energy, args=()): + def selfenergy(self, fermi_energy, args=(), params=None): + assert not args + assert params is None return square_selfenergy(self.width, self.t, self.potential + fermi_energy) @@ -73,8 +75,10 @@ class System(kwant.system.FiniteSystem): self.leads = [Lead(shape[1], hopping, lead_potentials[i]) for i in range(2)] - def hamiltonian(self, i, j): + def hamiltonian(self, i, j, *args, params=None): """Return an submatrix of the tight-binding Hamiltonian.""" + assert not args + assert params is None if i == j: # An on-site Hamiltonian has been requested. result = 4 * self.t + self.pot(self.pos_from_nodeid(i)) -- GitLab