Commit 2d3c51ad authored by Christoph Groth's avatar Christoph Groth

fix avoidable backwards incompatibility: System.parameters

When System.parameters was introduced, we thought it would be a good idea to
also use this new attribute.  The plan was to check in hamiltonian_submatrix()
whether any unneeded parameters are provided by the user.  This turned out to
be impossible, so the only check that remained was whether all the necessary
parameters are indeed provided.  However, this check is not necessary, because
the 'hamiltonian' method is in any way obliged to signal an error when it does
not obtain the necessary parameters.
parent 66104ecf
......@@ -341,3 +341,5 @@ Changes in Kwant 1.4.1
- The list of user-visible changes was rearranged to emphasize
backwards-incompatible changes by moving them to the top of the list and
adding the entry `Value functions may no longer take unnamed arguments`_.
- Kwant no longer requires the existence of a `parameters` attribute for
low-level systems.
......@@ -243,17 +243,6 @@ def make_dense_full(ham, args, params, CGraph gr, diag,
return h_sub
def _check_parameters_match(expected_parameters, params):
if params is None:
params = {}
missing = set(expected_parameters) - set(params)
if missing:
msg = ('System is missing required parameters: ',
', '.join(map('"{}"'.format, missing)))
raise TypeError(''.join(msg))
......@@ -301,9 +290,6 @@ def hamiltonian_submatrix(self, args=(), to_sites=None, from_sites=None,
n = self.graph.num_nodes
matrix = ta.matrix
if not args: # Then perhaps parameters
_check_parameters_match(self.parameters, params)
if from_sites is None:
diag = n * [None]
from_norb = np.empty(n, gint_dtype)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment