Raise better error in NeighborList.curitem if no index is set

This commit is contained in:
Florian Bruhin 2014-02-23 17:39:29 +01:00
parent b59f0e9a34
commit 7da05b3fb9

View File

@ -104,7 +104,10 @@ class NeighborList:
def curitem(self): def curitem(self):
"""Get the current item in the list.""" """Get the current item in the list."""
return self._items[self.idx] if self.idx is not None:
return self._items[self.idx]
else:
raise IndexError("No current item!")
def nextitem(self): def nextitem(self):
"""Get the next item in the list.""" """Get the next item in the list."""