Fix item sorting in NeighborList.

See #361.
This commit is contained in:
Florian Bruhin 2014-12-18 23:20:38 +01:00
parent 07957b105d
commit 05e835684d

View File

@ -120,7 +120,7 @@ class NeighborList(collections.abc.Sequence):
item = min(items, key=lambda tpl: abs(self.fuzzyval - tpl[1]))
else:
sorted_items = sorted([(idx, e) for (idx, e) in
enumerate(self.items)])
enumerate(self.items)], key=lambda e: e[1])
idx = 0 if offset < 0 else -1
item = sorted_items[idx]
self._idx = item[0]