From de7191ebef5069a6515e78653879f38f2dce0341 Mon Sep 17 00:00:00 2001 From: ojeda-e Date: Sat, 24 Jul 2021 13:57:19 -0600 Subject: [PATCH] Changed keyword by . --- membrane_curvature/base.py | 17 ++++++++--------- .../tests/test_membrane_curvature.py | 10 +++++----- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/membrane_curvature/base.py b/membrane_curvature/base.py index a55fb54..41023ef 100644 --- a/membrane_curvature/base.py +++ b/membrane_curvature/base.py @@ -17,7 +17,6 @@ import MDAnalysis from MDAnalysis.analysis.base import AnalysisBase -from MDAnalysis.transformations import wrap import logging MDAnalysis.start_logging() @@ -36,8 +35,8 @@ class MembraneCurvature(AnalysisBase): select : str or iterable of str, optional. The selection string of an atom selection to use as a reference to derive a surface. - pbc : bool, optional - Apply periodic boundary conditions. + wrap : bool, optional + Apply coordinate wrapping. n_x_bins : int, optional, default: '100' Number of bins in grid in the x dimension. n_y_bins : int, optional, default: '100' @@ -105,11 +104,11 @@ def __init__(self, universe, select='all', n_x_bins=100, n_y_bins=100, x_range=None, y_range=None, - pbc=True, **kwargs): + wrap=True, **kwargs): super().__init__(universe.universe.trajectory, **kwargs) self.ag = universe.select_atoms(select) - self.pbc = pbc + self.wrap = wrap self.n_x_bins = n_x_bins self.n_y_bins = n_y_bins self.x_range = x_range if x_range else (0, universe.dimensions[0]) @@ -129,11 +128,11 @@ def __init__(self, universe, select='all', warnings.warn(msg) logger.warn(msg) - # Apply PBC conditions - if self.pbc is True: + # Apply wrapping coordinates + if self.wrap: self.ag.wrap() else: - warnings.warn(" `PBC == False` may result in inaccurate calculation " + warnings.warn(" `wrap == False` may result in inaccurate calculation " "of membrane curvature. Surfaces will be derived from " "a reduced number of atoms.") @@ -150,7 +149,7 @@ def _prepare(self): self.n_y_bins), np.nan) def _single_frame(self): - if self.pbc: + if self.wrap: self.ag.wrap() # Populate a slice with np.arrays of surface, mean, and gaussian per frame self.results.z_surface[self._frame_index] = get_z_surface(self.ag.positions, diff --git a/membrane_curvature/tests/test_membrane_curvature.py b/membrane_curvature/tests/test_membrane_curvature.py index 5b28a55..6bd0e49 100644 --- a/membrane_curvature/tests/test_membrane_curvature.py +++ b/membrane_curvature/tests/test_membrane_curvature.py @@ -273,7 +273,7 @@ def test_analysis_get_z_surface_dummy(self, universe_dummy, x_bin, y_bin, x_rang avg_surface = mc.results.average_z_surface assert_almost_equal(avg_surface, expected_surface) - @pytest.mark.xfail(reason="PBC conditions not applied.") + @pytest.mark.xfail(reason="Wrapping coordinates not applied.") @pytest.mark.parametrize('x_bin, y_bin, expected_surface', [ (3, 3, np.array([[150., 150., 120.], @@ -371,10 +371,10 @@ def test_analysis_wrapping_coordinates(self, dummy_array, expected_surface): x_range=x_range, y_range=y_range).run() avg_surface = mc.results.average_z_surface - # assert if default values of pbc z_surface returns correctly + # assert if default values of wrapped coords in z_surface returns correctly assert_almost_equal(avg_surface, expected_surface) - def test_test_analysis_no_pbc(self, universe): - regex = (r"`PBC == False` may result in inaccurate calculation") + def test_test_analysis_no_wrapping(self, universe): + regex = (r"`wrap == False` may result in inaccurate calculation") with pytest.warns(UserWarning, match=regex): - MembraneCurvature(universe, pbc=False) + MembraneCurvature(universe, wrap=False)