Skip to content
Snippets Groups Projects
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
No related branches found
Tags v1.4.1
No related merge requests found
......@@ -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)
else:
tot_norbs = csr_matrix(syst).shape[0]
try:
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment