From e930baf2b4856b63d46536f17f6a600e0817baf1 Mon Sep 17 00:00:00 2001 From: jan Date: Tue, 5 Sep 2017 11:07:32 -0700 Subject: [PATCH] fix and improve error-checking for shifts parameter --- gridlock/grid.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gridlock/grid.py b/gridlock/grid.py index 817a229..e4787cb 100644 --- a/gridlock/grid.py +++ b/gridlock/grid.py @@ -307,9 +307,12 @@ class Grid(object): self.periodic = periodic self.shifts = numpy.array(shifts, dtype=float) + if len(self.shifts.shape) != 2: + raise GridError('Misshapen shifts: shifts must have two axes! ' + ' The given shifts has shape {}'.format(self.shifts.shape)) if self.shifts.shape[1] != 3: - GridError('Misshapen shifts; second axis size should be 3,' - ' shape is {}'.format(self.shifts.shape)) + raise GridError('Misshapen shifts; second axis size should be 3,' + ' shape is {}'.format(self.shifts.shape)) num_shifts = self.shifts.shape[0] if num_grids is None: