kwant.UserCodeError

Contents

kwant.UserCodeError#

exception kwant.UserCodeError[source]#

Bases: Exception

Class for errors that occur in user-provided code.

Usually users will define value functions that Kwant calls in order to evaluate the Hamiltonian. If one of these function raises an exception then it is caught and this error is raised in its place. This makes it clear that the error is from the user’s code (and not a bug in Kwant) and also makes it possible for any libraries that wrap Kwant to detect when a user’s function causes an error.