From 6adf7afd6213b9a35b7ab10db694987deb946b72 Mon Sep 17 00:00:00 2001
From: Anton Akhmerov <anton.akhmerov@gmail.com>
Date: Tue, 8 Mar 2016 17:50:42 +0100
Subject: [PATCH] extra check for attaching leads

---
 kwant/builder.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kwant/builder.py b/kwant/builder.py
index c594f720..b43b5547 100644
--- a/kwant/builder.py
+++ b/kwant/builder.py
@@ -1070,6 +1070,9 @@ class Builder(object):
         The lead numbering starts from zero and increments from there, i.e.
         the leads are numbered in the order in which they are attached.
         """
+        if self.symmetry.num_directions:
+            raise ValueError("Can only attach leads to finite systems")
+
         if add_cells < 0 or int(add_cells) != add_cells:
             raise ValueError('add_cells must be an integer >= 0.')
 
-- 
GitLab