diff --git a/package/MDAnalysis/core/selection.py b/package/MDAnalysis/core/selection.py index d8a7b6d7815..cd3641dd0ba 100644 --- a/package/MDAnalysis/core/selection.py +++ b/package/MDAnalysis/core/selection.py @@ -388,7 +388,7 @@ def _apply_distmat(self, group): sel = self.sel.apply(group) box = self.validate_dimensions(group.dimensions) periodic = box is not None - ref = sel.center_of_geometry(pbc=periodic).reshape(1, 3).\ + ref = sel.center_of_geometry().reshape(1, 3).\ astype(np.float32) d = distances.distance_array(ref, group.positions, diff --git a/testsuite/MDAnalysisTests/core/test_atomselections.py b/testsuite/MDAnalysisTests/core/test_atomselections.py index 3a167a1a52d..7f54271d495 100644 --- a/testsuite/MDAnalysisTests/core/test_atomselections.py +++ b/testsuite/MDAnalysisTests/core/test_atomselections.py @@ -542,19 +542,19 @@ def test_spherical_layer(self, u, meth, periodic): assert ref == set(result.indices) - @pytest.mark.parametrize('meth, periodic', methods) - def test_spherical_zone(self, u, meth, periodic): + @pytest.mark.parametrize('input_val, expected', + zip(methods, + [25, 31, 33, 25, + 55, 55, 55, 55])) + def test_spherical_zone(self, u, input_val, expected): + # NOTE: this has been modified to regression test + # only for resolution of Issue #1795 + # pending proper pbc & wrapping implementations + # in the future sel = Parser.parse('sphzone 5.0 resid 1', u.atoms) - sel = self.choosemeth(sel, meth, periodic) - result = sel.apply(u.atoms) - - r1 = u.select_atoms('resid 1') - box = u.dimensions if periodic else None - cog = r1.center_of_geometry(pbc=periodic).reshape(1, 3) - d = distance_array(u.atoms.positions, cog, box=box) - ref = set(np.where(d < 5.0)[0]) - - assert ref == set(result.indices) + sel = self.choosemeth(sel, input_val[0], input_val[1]) + result = len(sel.apply(u.atoms)) + assert result == expected @pytest.mark.parametrize('meth, periodic', methods) def test_point(self, u, meth, periodic):