-
Notifications
You must be signed in to change notification settings - Fork 825
Closed
Description
Is your feature request related to a problem?
Since sphzone will do a center of geometry calculation first, if an empty atomgorup is passed to the sphzone, a not very useful error message will be given.
Traceback (most recent call last):
water = u.select_atoms( 'resname SOL and sphzone 3 (resid 12 and name HE)')
File "/Users/grte2001/GitHub/mdanalysis/package/MDAnalysis/core/universe.py", line 677, in select_atoms
return self.atoms.select_atoms(*args, **kwargs)
File "/Users/grte2001/GitHub/mdanalysis/package/MDAnalysis/core/groups.py", line 2863, in select_atoms
selections[0].apply(self))
File "/Users/grte2001/GitHub/mdanalysis/package/MDAnalysis/core/selection.py", line 136, in apply
rsel = self.rsel.apply(group)
File "/Users/grte2001/GitHub/mdanalysis/package/MDAnalysis/core/selection.py", line 168, in apply
return func(self, group)
File "/Users/grte2001/GitHub/mdanalysis/package/MDAnalysis/core/selection.py", line 333, in apply
ref = sel.center_of_geometry().reshape(1, 3).astype(np.float32)
ValueError: cannot reshape array of size 0 into shape (1,3)
Describe the solution you'd like
An error message which says the selection is empty could be given.
EDIT: Following the discussion below and on #3026 we want these selections to behave like around, i.e., just return an empty AtomGroup. — @orbeckst
Describe alternatives you've considered
Just return an empty atomgroup.
Reactions are currently unavailable