Commit dd9fd59c authored by Pablo Piskunow's avatar Pablo Piskunow Committed by Joseph Weston
Browse files

add check for kwant systems, and fix default value of `where` in KPM

parent fc36c935
Pipeline #16845 passed with stages
in 41 minutes and 43 seconds
......@@ -945,7 +945,7 @@ class LocalVectors:
must be a list of integers with the indices where column vectors
are nonzero.
def __init__(self, syst, where, *args):
def __init__(self, syst, where=None, *args):
self.tot_norbs, self.orbs = _normalize_orbs_where(syst, where)
self._idx = 0
......@@ -1006,7 +1006,11 @@ def _normalize_orbs_where(syst, where):
tot_norbs = _get_tot_norbs(syst)
orbs = _from_where_to_orbs(syst, where)
tot_norbs = csr_matrix(syst).shape[0]
tot_norbs = csr_matrix(syst).shape[0]
except TypeError:
raise TypeError("'syst' is neither a matrix "
"nor a Kwant system.")
orbs = (range(tot_norbs) if where is None
else np.asarray(where, int))
return tot_norbs, orbs
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment