From 232b6f346bbfdd52b573cc8c5cb7b8ebda686707 Mon Sep 17 00:00:00 2001 From: Christoph Groth <christoph.groth@cea.fr> Date: Thu, 6 Mar 2014 15:29:05 +0100 Subject: [PATCH] bugfix: do not fail when the Hamiltonian has no non-zero entries --- kwant/solvers/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kwant/solvers/common.py b/kwant/solvers/common.py index a6bdecda..adeb9f2d 100644 --- a/kwant/solvers/common.py +++ b/kwant/solvers/common.py @@ -148,7 +148,7 @@ class SparseSolver(object): lhs = lhs - energy * sp.identity(lhs.shape[0], format=self.lhsformat) num_orb = lhs.shape[0] - if check_hermiticity: + if check_hermiticity and len(lhs.data): rtol = 1e-13 atol = 1e-300 tol = rtol * np.max(np.abs(lhs.data)) + atol -- GitLab