From b7b56cc1239779ac5484804eedfe48ca348fdb8f Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Fri, 15 Dec 2023 13:18:57 -0700 Subject: [PATCH 01/26] Fixed errors in atomicdistances.py --- .../MDAnalysis/analysis/atomicdistances.py | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/package/MDAnalysis/analysis/atomicdistances.py b/package/MDAnalysis/analysis/atomicdistances.py index e13c9543bd4..6497ee4ce8d 100644 --- a/package/MDAnalysis/analysis/atomicdistances.py +++ b/package/MDAnalysis/analysis/atomicdistances.py @@ -67,44 +67,44 @@ We will calculate the distances between an atom group of atoms 101-105 and an atom group of atoms 4001-4005 with periodic boundary conditions. -To select these atoms: +To select these atoms: :: >>> u = mda.Universe(GRO, XTC) >>> ag1 = u.atoms[100:105] >>> ag2 = u.atoms[4000:4005] We can run the calculations using any variable of choice such as -``my_dists`` and access our results using ``my_dists.results``: +``my_dists`` and access our results using ``my_dists.results``: :: >>> my_dists = ad.AtomicDistances(ag1, ag2).run() >>> my_dists.results array([[37.80813681, 33.2594864 , 34.93676414, 34.51183299, 34.96340209], - [27.11746625, 31.19878079, 31.69439435, 32.63446126, 33.10451345], - [23.27210749, 30.38714688, 32.48269361, 31.91444505, 31.84583838], - [18.40607922, 39.21993135, 39.33468192, 41.0133789 , 39.46885946], - [26.26006981, 37.9966713 , 39.14991106, 38.13423586, 38.95451427], - [26.83845081, 34.66255735, 35.59335027, 34.8926705 , 34.27175056], - [37.51994763, 38.12161091, 37.56481743, 36.8488121 , 35.75278065], - [37.27275501, 37.7831456 , 35.74359073, 34.54893794, 34.76495816], - [38.76272761, 41.31816555, 38.81588421, 39.82491432, 38.890219 ], - [39.20012515, 40.00563374, 40.83857688, 38.77886735, 41.45775864]]) + [27.11746625, 31.19878079, 31.69439435, 32.63446126, 33.10451345], + [23.27210749, 30.38714688, 32.48269361, 31.91444505, 31.84583838], + [18.40607922, 39.21993135, 39.33468192, 41.0133789 , 39.46885946], + [26.26006981, 37.9966713 , 39.14991106, 38.13423586, 38.95451427], + [26.83845081, 34.66255735, 35.59335027, 34.8926705 , 34.27175056], + [37.51994763, 38.12161091, 37.56481743, 36.8488121 , 35.75278065], + [37.27275501, 37.7831456 , 35.74359073, 34.54893794, 34.76495816], + [38.76272761, 41.31816555, 38.81588421, 39.82491432, 38.890219 ], + [39.20012515, 40.00563374, 40.83857688, 38.77886735, 41.45775864]]) To do the computation without periodic boundary conditions, we can enter the keyword argument ``pbc=False`` after ``ag2``. The result is different -in this case: +in this case: :: >>> my_dists_nopbc = ad.AtomicDistances(ag1, ag2, pbc=False).run() >>> my_dists_nopbc.results array([[37.80813681, 33.2594864 , 34.93676414, 34.51183299, 34.96340209], - [27.11746625, 31.19878079, 31.69439435, 32.63446126, 33.10451345], - [23.27210749, 30.38714688, 32.482695 , 31.91444505, 31.84583838], - [18.40607922, 39.21992825, 39.33468192, 41.0133757 , 39.46885946], - [26.26006981, 37.99666906, 39.14990985, 38.13423708, 38.95451311], - [26.83845081, 34.66255625, 35.59335027, 34.8926705 , 34.27174827], - [51.86981409, 48.10347964, 48.39570072, 49.14423513, 50.44804292], - [37.27275501, 37.7831456 , 35.74359073, 34.54893794, 34.76495816], - [56.39657447, 41.31816555, 38.81588421, 39.82491432, 38.890219 ], - [39.20012515, 40.00563374, 40.83857688, 38.77886735, 41.45775864]]) + [27.11746625, 31.19878079, 31.69439435, 32.63446126, 33.10451345], + [23.27210749, 30.38714688, 32.482695 , 31.91444505, 31.84583838], + [18.40607922, 39.21992825, 39.33468192, 41.0133757 , 39.46885946], + [26.26006981, 37.99666906, 39.14990985, 38.13423708, 38.95451311], + [26.83845081, 34.66255625, 35.59335027, 34.8926705 , 34.27174827], + [51.86981409, 48.10347964, 48.39570072, 49.14423513, 50.44804292], + [37.27275501, 37.7831456 , 35.74359073, 34.54893794, 34.76495816], + [56.39657447, 41.31816555, 38.81588421, 39.82491432, 38.890219 ], + [39.20012515, 40.00563374, 40.83857688, 38.77886735, 41.45775864]]) """ From 3ade42208abe515236d104ff3b2dabf493453a81 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Fri, 15 Dec 2023 13:19:23 -0700 Subject: [PATCH 02/26] Removed unused import --- package/MDAnalysis/analysis/atomicdistances.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/package/MDAnalysis/analysis/atomicdistances.py b/package/MDAnalysis/analysis/atomicdistances.py index 6497ee4ce8d..59638dbaf8c 100644 --- a/package/MDAnalysis/analysis/atomicdistances.py +++ b/package/MDAnalysis/analysis/atomicdistances.py @@ -112,8 +112,6 @@ from MDAnalysis.lib.distances import calc_bonds - -import warnings import logging from .base import AnalysisBase From c279443647d5f4bdb7cb22a3626dab1ba28a84e0 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Fri, 15 Dec 2023 13:27:28 -0700 Subject: [PATCH 03/26] Fixed tests in overview.rst --- package/doc/sphinx/source/documentation_pages/overview.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/doc/sphinx/source/documentation_pages/overview.rst b/package/doc/sphinx/source/documentation_pages/overview.rst index daf3cc9a1d4..dce93410f5d 100644 --- a/package/doc/sphinx/source/documentation_pages/overview.rst +++ b/package/doc/sphinx/source/documentation_pages/overview.rst @@ -120,7 +120,7 @@ over time:: < DCDReader '/..../MDAnalysis/tests/data/adk_dims.dcd' with 98 frames of 3341 atoms (0 fixed) > Finally, the :meth:`MDAnalysis.Universe.select_atoms` method generates a new -:class:`~MDAnalysis.core.groups.AtomGroup` according to a selection criterion +:class:`~MDAnalysis.core.groups.AtomGroup` according to a selection criterion:: >>> calphas = u.select_atoms("name CA") >>> print(calphas) From 245a7eadb5a81d5c4aec62a9549430e495f26a21 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Fri, 15 Dec 2023 13:47:00 -0700 Subject: [PATCH 04/26] Added name to authors per PR feedback --- package/AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/package/AUTHORS b/package/AUTHORS index c2d41018dce..992d35f7737 100644 --- a/package/AUTHORS +++ b/package/AUTHORS @@ -228,6 +228,7 @@ Chronological list of authors - Sumit Gupta - Heet Vekariya - Johannes Stöckelmaier + - Lawson Woods External code ------------- From 986289aa65a4e638c94b77a496b8d4287d89cf06 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Tue, 19 Dec 2023 15:19:30 -0700 Subject: [PATCH 05/26] Fixed errors in groups.py --- package/MDAnalysis/core/groups.py | 359 +++++++++++++++++++++++------- 1 file changed, 277 insertions(+), 82 deletions(-) diff --git a/package/MDAnalysis/core/groups.py b/package/MDAnalysis/core/groups.py index a73aef445dd..6c90d6ff812 100644 --- a/package/MDAnalysis/core/groups.py +++ b/package/MDAnalysis/core/groups.py @@ -75,7 +75,9 @@ ------ Each of the above classes has a *level* attribute. This can be used to verify -that two objects are of the same level, or to access a particular class:: +that two objects are of the same level, or to access a particular class + +.. code-block:: python u = mda.Universe() @@ -771,6 +773,14 @@ def isunique(self): Examples -------- + .. testsetup:: GroupBase.isunique + + from MDAnalysis.tests.datafiles import PDB, XTC + import MDAnalysis as mda + u = mda.Universe(PDB, XTC) + + .. doctest:: GroupBase.isunique + >>> ag = u.atoms[[2, 1, 2, 2, 1, 0]] >>> ag @@ -1028,15 +1038,33 @@ def center(self, weights, wrap=False, unwrap=False, compound='group'): Examples -------- - To find the center of charge of a given :class:`AtomGroup`:: + To find the center of charge of a given :class:`AtomGroup`: + + .. testsetup:: GroupBase.center + + from MDAnalysis.tests.datafiles import PDB, XTC + import MDAnalysis as mda + u = mda.Universe(PSF, DCD) + + .. doctest:: GroupBase.center >>> sel = u.select_atoms('prop mass > 4.0') >>> sel.center(sel.charges) + array([-0.22925091, -0.04771193, -0.16728489]) - To find the centers of mass per residue of all CA :class:`Atoms`:: + To find the centers of mass per residue of all CA :class:`Atoms`: + + .. doctest:: GroupBase.center + :options: +NORMALIZE_WHITESPACE >>> sel = u.select_atoms('name CA') >>> sel.center(sel.masses, compound='residues') + array([[ 11.66462231, 8.39347267, -8.98323059], + [ 11.41483879, 5.43442154, -6.51348448], + [ 8.95975494, 5.61292315, -3.61323047], + [ 8.29006767, 3.07599092, -0.79665166], + [ 5.01112604, 3.76389837, 1.130355 ], + ... .. versionchanged:: 0.19.0 Added `compound` parameter @@ -1227,20 +1255,42 @@ def accumulate(self, attribute, function=np.sum, compound='group'): Examples -------- - To find the total charge of a given :class:`AtomGroup`:: + To find the total charge of a given :class:`AtomGroup`: + + .. testsetup:: GroupBase.center + + from MDAnalysis.tests.datafiles import PSF, DCD + import MDAnalysis as mda + u = mda.Universe(PSF, DCD) + + .. doctest:: GroupBase.center >>> sel = u.select_atoms('prop mass > 4.0') >>> sel.accumulate('charges') + -251.68500316143036 + + To find the total mass per residue of all CA :class:`Atoms`: - To find the total mass per residue of all CA :class:`Atoms`:: + .. doctest:: GroupBase.center + :options: +NORMALIZE_WHITESPACE >>> sel = u.select_atoms('name CA') >>> sel.accumulate('masses', compound='residues') + array([12.011, 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, + 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, + 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, + 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, + 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, 12.011, + ... To find the maximum atomic charge per fragment of a given - :class:`AtomGroup`:: + :class:`AtomGroup`: + .. doctest:: GroupBase.center + + >>> import numpy as np >>> sel.accumulate('charges', compound="fragments", function=np.max) + array([0.20999999]) .. versionadded:: 0.20.0 @@ -1864,7 +1914,7 @@ def unwrap(self, compound='fragments', reference='com', inplace=True): raise ValueError("Cannot perform unwrap with " "reference='com' because the total " "mass of the group is zero.") - refpos = np.einsum('ij,ij->j',positions,masses[:, None]) + refpos = np.einsum('ij,ij->j', positions, masses[:, None]) refpos /= total_mass else: # reference == 'cog' refpos = positions.mean(axis=0) @@ -1957,22 +2007,40 @@ def groupby(self, topattrs): ------- To group atoms with the same mass together: - >>> ag.groupby('masses') - {12.010999999999999: , - 14.007: , - 15.999000000000001: } + .. testsetup:: GroupBase.groupby - To group atoms with the same residue name and mass together: + from MDAnalysis.tests.datafiles import PSF, DCD + import MDAnalysis as mda + u = mda.Universe(PSF, DCD) + ag = u.atoms - >>> ag.groupby(['resnames', 'masses']) - {('ALA', 1.008): , - ('ALA', 12.011): , - ('ALA', 14.007): , - ('ALA', 15.999): }, - ('ARG', 1.008): , - ...} + .. doctest:: GroupBase.groupby + :options: +NORMALIZE_WHITESPACE - >>> ag.groupby(['resnames', 'masses'])('ALA', 15.999) + >>> ag.groupby('masses') + {32.06: , + 1.008: , + 12.011: , + 14.007: , + 15.999: } + + To group atoms with the same residue name and mass together: + + .. doctest:: GroupBase.groupby + :options: +NORMALIZE_WHITESPACE + + >>> group_dict = ag.groupby(['resnames', 'masses']) + >>> dict(sorted(group_dict.items())) + {('ALA', 1.008): , + ('ALA', 12.011): , + ('ALA', 14.007): , + ('ALA', 15.999): , + ('ARG', 1.008): , + ... + + .. doctest:: GroupBase.groupby + + >>> ag.groupby(['resnames', 'masses'])['ALA', 15.999] @@ -2023,13 +2091,21 @@ def concatenate(self, other): The order of the original contents (including duplicates) are preserved when performing a concatenation. - >>> ag1 = u.select_atoms('name O') - >>> ag2 = u.select_atoms('name N') - >>> ag3 = ag1 + ag2 # or ag1.concatenate(ag2) - >>> ag3[:3].names - array(['O', 'O', 'O'], dtype=object) - >>> ag3[-3:].names - array(['N', 'N', 'N'], dtype=object) + .. testsetup:: GroupBase.concatenate + + from MDAnalysis.tests.datafiles import PDB, XTC + import MDAnalysis as mda + u = mda.Universe(PDB, XTC) + + .. doctest:: GroupBase.concatenate + + >>> ag1 = u.select_atoms('name O') + >>> ag2 = u.select_atoms('name N') + >>> ag3 = ag1 + ag2 # or ag1.concatenate(ag2) + >>> ag3[:3].names + array(['O', 'O', 'O'], dtype=object) + >>> ag3[-3:].names + array(['N', 'N', 'N'], dtype=object) .. versionadded:: 0.16.0 @@ -2061,11 +2137,19 @@ def union(self, other): In contrast to :meth:`concatenate`, any duplicates are dropped and the result is sorted. - >>> ag1 = u.select_atoms('name O') - >>> ag2 = u.select_atoms('name N') - >>> ag3 = ag1 | ag2 # or ag1.union(ag2) - >>> ag3[:3].names - array(['N', 'O', 'N'], dtype=object) + .. testsetup:: GroupBase.union + + from MDAnalysis.tests.datafiles import PDB, XTC + import MDAnalysis as mda + u = mda.Universe(PDB, XTC) + + .. doctest:: GroupBase.union + + >>> ag1 = u.select_atoms('name O') + >>> ag2 = u.select_atoms('name N') + >>> ag3 = ag1 | ag2 # or ag1.union(ag2) + >>> ag3[:3].names + array(['N', 'O', 'N'], dtype=object) See Also -------- @@ -2101,9 +2185,11 @@ def intersection(self, other): become too complicated. For example to find the water atoms which are within 4.0A of two segments: - >>> shell1 = u.select_atoms('resname SOL and around 4.0 segid 1') - >>> shell2 = u.select_atoms('resname SOL and around 4.0 segid 2') - >>> common = shell1 & shell2 # or shell1.intersection(shell2) + .. code-block:: python + + >>> shell1 = u.select_atoms('resname SOL and around 4.0 segid 1') + >>> shell2 = u.select_atoms('resname SOL and around 4.0 segid 2') + >>> common = shell1 & shell2 # or shell1.intersection(shell2) See Also -------- @@ -2140,11 +2226,19 @@ def subtract(self, other): Unlike :meth:`difference` this method will not sort or remove duplicates. - >>> ag1 = u.atoms[[3, 3, 2, 2, 1, 1]] - >>> ag2 = u.atoms[2] - >>> ag3 = ag1 - ag2 # or ag1.subtract(ag2) - >>> ag1.indices - array([3, 3, 1, 1]) + .. testsetup:: GroupBase.subtract + + import MDAnalysis as mda + from MDAnalysis.tests.datafiles import PSF, DCD + u = mda.Universe(PSF,DCD) + + .. doctest:: GroupBase.subtract + + >>> ag1 = u.atoms[[3, 3, 2, 2, 1, 1]] + >>> ag2 = u.atoms[2] + >>> ag3 = ag1.subtract(ag2) + >>> ag3.indices + array([3, 3, 1, 1]) See Also -------- @@ -2207,11 +2301,19 @@ def symmetric_difference(self, other): Example ------- - >>> ag1 = u.atoms[[0, 1, 5, 3, 3, 2]] - >>> ag2 = u.atoms[[4, 4, 6, 2, 3, 5]] - >>> ag3 = ag1 ^ ag2 # or ag1.symmetric_difference(ag2) - >>> ag3.indices # 0 and 1 are only in ag1, 4 and 6 are only in ag2 - [0, 1, 4, 6] + .. testsetup:: GroupBase.symmetric_difference + + from MDAnalysis.tests.datafiles import PSF, DCD + import MDAnalysis as mda + u = mda.Universe(PSF, DCD) + + .. doctest:: GroupBase.symmetric_difference + + >>> ag1 = u.atoms[[0, 1, 5, 3, 3, 2]] + >>> ag2 = u.atoms[[4, 4, 6, 2, 3, 5]] + >>> ag3 = ag1 ^ ag2 # or ag1.symmetric_difference(ag2) + >>> ag3.indices # 0 and 1 are only in ag1, 4 and 6 are only in ag2 + array([0, 1, 4, 6]) See Also -------- @@ -2464,25 +2566,34 @@ class AtomGroup(GroupBase): be attached by the new :class:`AtomGroup`. If the Universe is serialized with its :class:`AtomGroup`, they will still be bound together afterwards: - .. code-block:: python + .. testsetup:: AtomGroup + + import MDAnalysis as mda + from MDAnalysis.tests.datafiles import PSF, DCD + + .. doctest:: AtomGroup + + >>> import pickle >>> u = mda.Universe(PSF, DCD) >>> g = u.atoms >>> g_pickled = pickle.loads(pickle.dumps(g)) >>> print("g_pickled.universe is u: ", u is g_pickled.universe) - g_pickled.universe is u: False + g_pickled.universe is u: False - >>> g_pickled, u_pickled = pickle.load(pickle.dumps(g, u)) + >>> g_pickled, u_pickled = pickle.loads(pickle.dumps((g, u))) >>> print("g_pickled.universe is u_pickled: ", - >>> u_pickle is g_pickled.universe) - g_pickled.universe is u_pickled: True + ... u_pickled is g_pickled.universe) + g_pickled.universe is u_pickled: True If multiple :class:`AtomGroup` are bound to the same :class:`MDAnalysis.core.universe.Universe`, they will bound to the same one after serialization: - .. code-block:: python + .. doctest:: AtomGroup + + >>> import pickle >>> u = mda.Universe(PSF, DCD) >>> g = u.atoms @@ -2490,14 +2601,14 @@ class AtomGroup(GroupBase): >>> g_pickled = pickle.loads(pickle.dumps(g)) >>> h_pickled = pickle.loads(pickle.dumps(h)) - >>> print("g_pickled.universe is h_pickled.universe : ", - >>> g_pickled.universe is h_pickled.universe) - g_pickled.universe is h_pickled.universe: False + >>> print("g_pickled.universe is h_pickled.universe: ", + ... g_pickled.universe is h_pickled.universe) + g_pickled.universe is h_pickled.universe: False - >>> g_pickled, h_pickled = pickle.load(pickle.dumps(g, h)) + >>> g_pickled, h_pickled = pickle.loads(pickle.dumps((g, h))) >>> print("g_pickled.universe is h_pickled.universe: ", - >>> g_pickle.universe is h_pickled.universe) - g_pickled.universe is h_pickled.universe: True + ... g_pickled.universe is h_pickled.universe) + g_pickled.universe is h_pickled.universe: True The aforementioned two cases are useful for implementation of parallel analysis base classes. First, you always get an independent @@ -2672,6 +2783,8 @@ def unique(self): Examples -------- + .. doctest:: AtomGroup.unique + >>> import MDAnalysis as mda >>> from MDAnalysis.tests.datafiles import PSF, DCD >>> u = mda.Universe(PSF, DCD) @@ -2679,12 +2792,12 @@ def unique(self): >>> ag >>> ag.ix - array([2, 1, 2, 2, 1, 0], dtype=int64) + array([2, 1, 2, 2, 1, 0]) >>> ag2 = ag.unique >>> ag2 >>> ag2.ix - array([0, 1, 2], dtype=int64) + array([0, 1, 2]) >>> ag2.unique is ag2 False @@ -2728,6 +2841,8 @@ def asunique(self, sorted=False): Examples -------- + .. doctest:: AtomGroup.asunique + >>> import MDAnalysis as mda >>> from MDAnalysis.tests.datafiles import PSF, DCD >>> u = mda.Universe(PSF, DCD) @@ -2736,14 +2851,14 @@ def asunique(self, sorted=False): >>> ag2 is ag True >>> ag2.ix - array([2, 1, 0], dtype=int64) + array([2, 1, 0]) >>> ag3 = ag.asunique(sorted=True) >>> ag3 is ag False >>> ag3.ix - array([0, 1, 2], dtype=int64) + array([0, 1, 2]) >>> u.atoms[[2, 1, 1, 0, 1]].asunique(sorted=False).ix - array([2, 1, 0], dtype=int64) + array([2, 1, 0]) .. versionadded:: 2.0.0 @@ -2925,35 +3040,70 @@ def select_atoms(self, sel, *othersel, periodic=True, rtol=1e-05, All simple selection listed below support multiple arguments which are implicitly combined with an or operator. For example + .. testsetup:: AtomGroup.select_atoms + + from MDAnalysis.tests.datafiles import PSF, DCD + import MDAnalysis as mda + universe = mda.Universe(PSF, DCD) + + .. doctest:: AtomGroup.select_atoms + >>> sel = universe.select_atoms('resname MET GLY') + >>> sel + is equivalent to + .. doctest:: AtomGroup.select_atoms + >>> sel = universe.select_atoms('resname MET or resname GLY') + >>> sel + Will select all atoms with a residue name of either MET or GLY. Subselections can be grouped with parentheses. - >>> sel = universe.select_atoms("segid DMPC and not ( name H* O* )") - >>> sel - + .. doctest:: AtomGroup.select_atoms + >>> sel = universe.select_atoms("segid 4AKE and not ( name H* O* )") + >>> sel + Existing :class:`AtomGroup` objects can be passed as named arguments, which will then be available to the selection parser. + .. testsetup:: AtomGroup.select_atoms.namedarguments + + from MDAnalysis.tests.datafiles import PSF, DCD + import MDAnalysis as mda + universe = mda.Universe(PSF, DCD) + sel = universe.select_atoms("segid 4AKE and not ( name H* O* )") + + .. doctest:: AtomGroup.select_atoms, AtomGroup.select_atoms.namedarguments + >>> universe.select_atoms("around 10 group notHO", notHO=sel) - + Selections can be set to update automatically on frame change, by setting the `updating` keyword argument to `True`. This will return a :class:`UpdatingAtomGroup` which can represent the solvation shell around another object. - >>> universe.select_atoms("resname SOL and around 2.0 protein", updating=True) - + .. testsetup:: AtomGroup.select_atoms.updating + + from MDAnalysis.tests.datafiles import PDB, XTC + import MDAnalysis as mda + universe = mda.Universe(PDB, XTC) + + .. doctest:: AtomGroup.select_atoms.updating + :options: +NORMALIZE_WHITESPACE + >>> universe.select_atoms("resname SOL and around 2.0 protein", + ... updating=True) + + Notes ----- @@ -3043,8 +3193,19 @@ def select_atoms(self, sel, *othersel, periodic=True, rtol=1e-05, problem can be fixed by increasing the value of maxMatches. This behavior may be updated in the future. - >>> universe.select_atoms("C", smarts_kwargs={"maxMatches": 100}) - + .. testsetup:: AtomGroup.select_atoms.smarts + + from MDAnalysis.tests.datafiles import PSF, DCD + from MDAnalysis.topology.guessers import guess_types + import MDAnalysis as mda + universe = mda.Universe(PSF, DCD) + guessed_elements = guess_types(universe.atoms.names) + universe.add_TopologyAttr('elements', guessed_elements) + + .. doctest:: AtomGroup.select_atoms.smarts + + >>> universe.select_atoms("smarts C", smarts_kwargs={"maxMatches": 100}) + chiral *R | S* select a particular stereocenter. e.g. ``name C and chirality @@ -3461,13 +3622,15 @@ def write(self, filename=None, file_format=None, Examples -------- - >>> ag = u.atoms - >>> ag.write('selection.ndx') # Write a gromacs index file - >>> ag.write('coordinates.pdb') # Write the current frame as PDB - >>> # Write the trajectory in XTC format - >>> ag.write('trajectory.xtc', frames='all') - >>> # Write every other frame of the trajectory in PBD format - >>> ag.write('trajectory.pdb', frames=u.trajectory[::2]) + .. code-block:: python + + >>> ag = u.atoms + >>> ag.write('selection.ndx') # Write a gromacs index file + >>> ag.write('coordinates.pdb') # Write the current frame as PDB + >>> # Write the trajectory in XTC format + >>> ag.write('trajectory.xtc', frames='all') + >>> # Write every other frame of the trajectory in PBD format + >>> ag.write('trajectory.pdb', frames=u.trajectory[::2]) Parameters ---------- @@ -3612,17 +3775,17 @@ def sort(self, key='ix', keyfunc=None): Example ---------- - .. code-block:: python + .. doctest:: AtomGroup.sort >>> import MDAnalysis as mda >>> from MDAnalysisTests.datafiles import PDB_small >>> u = mda.Universe(PDB_small) >>> ag = u.atoms[[3, 2, 1, 0]] >>> ag.ix - array([3 2 1 0]) + array([3, 2, 1, 0]) >>> ag = ag.sort() >>> ag.ix - array([0 1 2 3]) + array([0, 1, 2, 3]) >>> ag.positions array([[-11.921, 26.307, 10.41 ], [-11.447, 26.741, 9.595], @@ -3795,6 +3958,14 @@ def unique(self): Examples -------- + .. testsetup:: ResidueGroup.unique + + import MDAnalysis as mda + from MDAnalysis.tests.datafiles import PSF, DCD + u = mda.Universe(PSF, DCD) + + .. doctest:: ResidueGroup.unique + >>> rg = u.residues[[2, 1, 2, 2, 1, 0]] >>> rg @@ -3843,12 +4014,20 @@ def asunique(self, sorted=False): Examples -------- + .. testsetup:: ResidueGroup.asunique + + import MDAnalysis as mda + from MDAnalysis.tests.datafiles import PSF, DCD + u = mda.Universe(PSF, DCD) + + .. doctest:: ResidueGroup.asunique + >>> rg = u.residues[[2, 1, 2, 2, 1, 0]] >>> rg >>> rg.ix array([2, 1, 2, 2, 1, 0]) - >>> rg2 = rg.asunique() + >>> rg2 = rg.asunique(sorted=True) >>> rg2 >>> rg2.ix @@ -3971,6 +4150,14 @@ def unique(self): Examples -------- + .. testsetup:: SegmentGroup.unique + + from MDAnalysis.tests.datafiles import CONECT + import MDAnalysis as mda + u = mda.Universe(CONECT) + + .. doctest:: SegmentGroup.unique + >>> sg = u.segments[[2, 1, 2, 2, 1, 0]] >>> sg @@ -4019,12 +4206,20 @@ def asunique(self, sorted=False): Examples -------- + .. testsetup:: SegmentGroup.asunique + + from MDAnalysis.tests.datafiles import CONECT + import MDAnalysis as mda + u = mda.Universe(CONECT) + + .. doctest:: SegmentGroup.asunique + >>> sg = u.segments[[2, 1, 2, 2, 1, 0]] >>> sg >>> sg.ix array([2, 1, 2, 2, 1, 0]) - >>> sg2 = sg.asunique() + >>> sg2 = sg.asunique(sorted=True) >>> sg2 >>> sg2.ix From 1cd741ba1fe8b0a5fbe50443331ef914a43c3a18 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Tue, 19 Dec 2023 16:05:53 -0700 Subject: [PATCH 06/26] flake8 & black reformatting --- package/MDAnalysis/core/groups.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/package/MDAnalysis/core/groups.py b/package/MDAnalysis/core/groups.py index 6c90d6ff812..061d7fd466b 100644 --- a/package/MDAnalysis/core/groups.py +++ b/package/MDAnalysis/core/groups.py @@ -99,8 +99,7 @@ import contextlib import warnings -from .. import (_CONVERTERS, - _TOPOLOGY_ATTRS, _TOPOLOGY_TRANSPLANTS, _TOPOLOGY_ATTRNAMES) +from .. import _TOPOLOGY_ATTRS, _TOPOLOGY_TRANSPLANTS, _TOPOLOGY_ATTRNAMES from ..lib import util from ..lib.util import (cached, warn_if_not_unique, unique_int_1d, unique_int_1d_unsorted, @@ -1099,7 +1098,7 @@ def center(self, weights, wrap=False, unwrap=False, compound='group'): return coords.mean(axis=0) # promote weights to dtype if required: weights = weights.astype(dtype, copy=False) - return np.einsum('ij,ij->j',coords,weights[:, None]) / weights.sum() + return np.einsum("ij,ij->j", coords, weights[:, None]) / weights.sum() # When compound split caching gets implemented it will be clever to # preempt at this point whether or not stable sorting will be needed @@ -1911,10 +1910,12 @@ def unwrap(self, compound='fragments', reference='com', inplace=True): masses = unique_atoms.masses total_mass = masses.sum() if np.isclose(total_mass, 0.0): - raise ValueError("Cannot perform unwrap with " - "reference='com' because the total " - "mass of the group is zero.") - refpos = np.einsum('ij,ij->j', positions, masses[:, None]) + raise ValueError( + "Cannot perform unwrap with " + "reference='com' because the total " + "mass of the group is zero." + ) + refpos = np.einsum("ij,ij->j", positions, masses[:, None]) refpos /= total_mass else: # reference == 'cog' refpos = positions.mean(axis=0) @@ -2028,7 +2029,7 @@ def groupby(self, topattrs): .. doctest:: GroupBase.groupby :options: +NORMALIZE_WHITESPACE - + >>> group_dict = ag.groupby(['resnames', 'masses']) >>> dict(sorted(group_dict.items())) {('ALA', 1.008): , @@ -3103,7 +3104,7 @@ def select_atoms(self, sel, *othersel, periodic=True, rtol=1e-05, ... updating=True) - + Notes ----- @@ -3201,10 +3202,11 @@ def select_atoms(self, sel, *othersel, periodic=True, rtol=1e-05, universe = mda.Universe(PSF, DCD) guessed_elements = guess_types(universe.atoms.names) universe.add_TopologyAttr('elements', guessed_elements) - + .. doctest:: AtomGroup.select_atoms.smarts - >>> universe.select_atoms("smarts C", smarts_kwargs={"maxMatches": 100}) + >>> universe.select_atoms("smarts C", smarts_kwargs= + ... {"maxMatches": 100}) chiral *R | S* From ee8528be048e8a4861ede6ccbcdb83f6b6fae0e9 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Tue, 19 Dec 2023 18:10:20 -0700 Subject: [PATCH 07/26] Changed indentation to four spaces Resolved linting issues --- package/MDAnalysis/core/groups.py | 406 +++++++++++++++--------------- 1 file changed, 204 insertions(+), 202 deletions(-) diff --git a/package/MDAnalysis/core/groups.py b/package/MDAnalysis/core/groups.py index 061d7fd466b..7d5f10f7ed3 100644 --- a/package/MDAnalysis/core/groups.py +++ b/package/MDAnalysis/core/groups.py @@ -79,15 +79,15 @@ .. code-block:: python - u = mda.Universe() + u = mda.Universe() - ag = u.atoms[:10] - at = u.atoms[11] + ag = u.atoms[:10] + at = u.atoms[11] - ag.level == at.level # Returns True + ag.level == at.level # Returns True - ag.level.singular # Returns Atom class - at.level.plural # Returns AtomGroup class + ag.level.singular # Returns Atom class + at.level.plural # Returns AtomGroup class """ from collections import namedtuple @@ -113,7 +113,7 @@ from . import selection from ..exceptions import NoDataError from . import topologyobjects -from ._get_readers import get_writer_for, get_converter_for +from ._get_readers import get_writer_for def _unpickle(u, ix): @@ -366,7 +366,6 @@ def __getattr__(self, attr): # property of wrong group/component if not isinstance(self, clstype): - mname = 'property' if isinstance(meth, property) else 'method' err = '{attr} is a {method} of {clstype}, not {selfcls}' clsname = clstype.__name__ if clsname == 'GroupBase': @@ -618,9 +617,9 @@ def __getattr__(self, attr): def __repr__(self): name = self.level.name - return ("<{}Group with {} {}{}>" - "".format(name.capitalize(), len(self), name, - "s"[len(self) == 1:])) # Shorthand for a conditional plural 's'. + return ("<{}Group with {} {}{}>""".format( + name.capitalize(), len(self), + name, "s"[len(self) == 1:])) # Shorthand for a conditional plural 's'. def __str__(self): name = self.level.name @@ -774,22 +773,22 @@ def isunique(self): .. testsetup:: GroupBase.isunique - from MDAnalysis.tests.datafiles import PDB, XTC - import MDAnalysis as mda - u = mda.Universe(PDB, XTC) + from MDAnalysis.tests.datafiles import PDB, XTC + import MDAnalysis as mda + u = mda.Universe(PDB, XTC) .. doctest:: GroupBase.isunique - >>> ag = u.atoms[[2, 1, 2, 2, 1, 0]] - >>> ag - - >>> ag.isunique - False - >>> ag2 = ag.unique - >>> ag2 - - >>> ag2.isunique - True + >>> ag = u.atoms[[2, 1, 2, 2, 1, 0]] + >>> ag + + >>> ag.isunique + False + >>> ag2 = ag.unique + >>> ag2 + + >>> ag2.isunique + True See Also -------- @@ -968,10 +967,10 @@ def _split_by_compound_indices(self, compound, stable_sort=False): compound_masks.append(compound_sizes == compound_size) if needs_sorting: atom_masks.append(sort_indices[size_per_atom == compound_size] - .reshape(-1, compound_size)) + .reshape(-1, compound_size)) else: atom_masks.append(np.where(size_per_atom == compound_size)[0] - .reshape(-1, compound_size)) + .reshape(-1, compound_size)) return atom_masks, compound_masks, len(compound_sizes) @@ -1127,7 +1126,7 @@ def center(self, weights, wrap=False, unwrap=False, compound='group'): _centers = _coords.mean(axis=1) else: _weights = weights[atom_mask] - _centers = np.einsum('ijk,ijk->ik',_coords,_weights[:, :, None]) + _centers = np.einsum('ijk,ijk->ik', _coords, _weights[:, :, None]) _centers /= _weights.sum(axis=1)[:, None] centers[compound_mask] = _centers if wrap: @@ -1927,8 +1926,8 @@ def unwrap(self, compound='fragments', reference='com', inplace=True): # When unwrapping and not shifting with a cog/com reference we # need to make sure that the first atom of each compound is stable # regarding sorting. - atom_masks = unique_atoms._split_by_compound_indices(comp, - stable_sort=reference is None)[0] + atom_masks = unique_atoms._split_by_compound_indices( + comp, stable_sort=reference is None)[0] positions = unique_atoms.positions for atom_mask in atom_masks: for mask in atom_mask: @@ -1944,7 +1943,7 @@ def unwrap(self, compound='fragments', reference='com', inplace=True): "reference='com' because the " "total mass of at least one of " "the {} is zero.".format(comp)) - refpos = np.einsum('ijk,ijk->ik',positions[atom_mask], + refpos = np.einsum('ijk,ijk->ik', positions[atom_mask], masses[:, :, None]) refpos /= total_mass[:, None] else: # reference == 'cog' @@ -2010,39 +2009,39 @@ def groupby(self, topattrs): .. testsetup:: GroupBase.groupby - from MDAnalysis.tests.datafiles import PSF, DCD - import MDAnalysis as mda - u = mda.Universe(PSF, DCD) - ag = u.atoms + from MDAnalysis.tests.datafiles import PSF, DCD + import MDAnalysis as mda + u = mda.Universe(PSF, DCD) + ag = u.atoms .. doctest:: GroupBase.groupby :options: +NORMALIZE_WHITESPACE - >>> ag.groupby('masses') - {32.06: , - 1.008: , - 12.011: , - 14.007: , - 15.999: } + >>> ag.groupby('masses') + {32.06: , + 1.008: , + 12.011: , + 14.007: , + 15.999: } To group atoms with the same residue name and mass together: .. doctest:: GroupBase.groupby :options: +NORMALIZE_WHITESPACE - >>> group_dict = ag.groupby(['resnames', 'masses']) - >>> dict(sorted(group_dict.items())) - {('ALA', 1.008): , - ('ALA', 12.011): , - ('ALA', 14.007): , - ('ALA', 15.999): , - ('ARG', 1.008): , - ... + >>> group_dict = ag.groupby(['resnames', 'masses']) + >>> dict(sorted(group_dict.items())) + {('ALA', 1.008): , + ('ALA', 12.011): , + ('ALA', 14.007): , + ('ALA', 15.999): , + ('ARG', 1.008): , + ... .. doctest:: GroupBase.groupby - >>> ag.groupby(['resnames', 'masses'])['ALA', 15.999] - + >>> ag.groupby(['resnames', 'masses'])['ALA', 15.999] + .. versionadded:: 0.16.0 @@ -2094,19 +2093,19 @@ def concatenate(self, other): .. testsetup:: GroupBase.concatenate - from MDAnalysis.tests.datafiles import PDB, XTC - import MDAnalysis as mda - u = mda.Universe(PDB, XTC) + from MDAnalysis.tests.datafiles import PDB, XTC + import MDAnalysis as mda + u = mda.Universe(PDB, XTC) .. doctest:: GroupBase.concatenate - >>> ag1 = u.select_atoms('name O') - >>> ag2 = u.select_atoms('name N') - >>> ag3 = ag1 + ag2 # or ag1.concatenate(ag2) - >>> ag3[:3].names - array(['O', 'O', 'O'], dtype=object) - >>> ag3[-3:].names - array(['N', 'N', 'N'], dtype=object) + >>> ag1 = u.select_atoms('name O') + >>> ag2 = u.select_atoms('name N') + >>> ag3 = ag1 + ag2 # or ag1.concatenate(ag2) + >>> ag3[:3].names + array(['O', 'O', 'O'], dtype=object) + >>> ag3[-3:].names + array(['N', 'N', 'N'], dtype=object) .. versionadded:: 0.16.0 @@ -2140,17 +2139,17 @@ def union(self, other): .. testsetup:: GroupBase.union - from MDAnalysis.tests.datafiles import PDB, XTC - import MDAnalysis as mda - u = mda.Universe(PDB, XTC) + from MDAnalysis.tests.datafiles import PDB, XTC + import MDAnalysis as mda + u = mda.Universe(PDB, XTC) .. doctest:: GroupBase.union - >>> ag1 = u.select_atoms('name O') - >>> ag2 = u.select_atoms('name N') - >>> ag3 = ag1 | ag2 # or ag1.union(ag2) - >>> ag3[:3].names - array(['N', 'O', 'N'], dtype=object) + >>> ag1 = u.select_atoms('name O') + >>> ag2 = u.select_atoms('name N') + >>> ag3 = ag1 | ag2 # or ag1.union(ag2) + >>> ag3[:3].names + array(['N', 'O', 'N'], dtype=object) See Also -------- @@ -2703,8 +2702,8 @@ def residues(self, new): except AttributeError: errmsg = ("Can only set AtomGroup residues to Residue " "or ResidueGroup not {}".format( - ', '.join(type(r) for r in new - if not isinstance(r, Residue)))) + ', '.join(type(r) for r in new + if not isinstance(r, Residue)))) raise TypeError(errmsg) from None if not isinstance(r_ix, itertools.cycle) and len(r_ix) != len(self): raise ValueError("Incorrect size: {} for AtomGroup of size: {}" @@ -2786,21 +2785,21 @@ def unique(self): .. doctest:: AtomGroup.unique - >>> import MDAnalysis as mda - >>> from MDAnalysis.tests.datafiles import PSF, DCD - >>> u = mda.Universe(PSF, DCD) - >>> ag = u.atoms[[2, 1, 2, 2, 1, 0]] - >>> ag - - >>> ag.ix - array([2, 1, 2, 2, 1, 0]) - >>> ag2 = ag.unique - >>> ag2 - - >>> ag2.ix - array([0, 1, 2]) - >>> ag2.unique is ag2 - False + >>> import MDAnalysis as mda + >>> from MDAnalysis.tests.datafiles import PSF, DCD + >>> u = mda.Universe(PSF, DCD) + >>> ag = u.atoms[[2, 1, 2, 2, 1, 0]] + >>> ag + + >>> ag.ix + array([2, 1, 2, 2, 1, 0]) + >>> ag2 = ag.unique + >>> ag2 + + >>> ag2.ix + array([0, 1, 2]) + >>> ag2.unique is ag2 + False See Also -------- @@ -2844,22 +2843,22 @@ def asunique(self, sorted=False): .. doctest:: AtomGroup.asunique - >>> import MDAnalysis as mda - >>> from MDAnalysis.tests.datafiles import PSF, DCD - >>> u = mda.Universe(PSF, DCD) - >>> ag = u.atoms[[2, 1, 0]] - >>> ag2 = ag.asunique(sorted=False) - >>> ag2 is ag - True - >>> ag2.ix - array([2, 1, 0]) - >>> ag3 = ag.asunique(sorted=True) - >>> ag3 is ag - False - >>> ag3.ix - array([0, 1, 2]) - >>> u.atoms[[2, 1, 1, 0, 1]].asunique(sorted=False).ix - array([2, 1, 0]) + >>> import MDAnalysis as mda + >>> from MDAnalysis.tests.datafiles import PSF, DCD + >>> u = mda.Universe(PSF, DCD) + >>> ag = u.atoms[[2, 1, 0]] + >>> ag2 = ag.asunique(sorted=False) + >>> ag2 is ag + True + >>> ag2.ix + array([2, 1, 0]) + >>> ag3 = ag.asunique(sorted=True) + >>> ag3 is ag + False + >>> ag3.ix + array([0, 1, 2]) + >>> u.atoms[[2, 1, 1, 0, 1]].asunique(sorted=False).ix + array([2, 1, 0]) .. versionadded:: 2.0.0 @@ -2867,7 +2866,6 @@ def asunique(self, sorted=False): return self._asunique(sorted=sorted, group=self.universe.atoms, set_mask=True) - @property def positions(self): r"""Coordinates of the :class:`Atoms` in the :class:`AtomGroup`. @@ -3043,23 +3041,23 @@ def select_atoms(self, sel, *othersel, periodic=True, rtol=1e-05, .. testsetup:: AtomGroup.select_atoms - from MDAnalysis.tests.datafiles import PSF, DCD - import MDAnalysis as mda - universe = mda.Universe(PSF, DCD) + from MDAnalysis.tests.datafiles import PSF, DCD + import MDAnalysis as mda + universe = mda.Universe(PSF, DCD) .. doctest:: AtomGroup.select_atoms - >>> sel = universe.select_atoms('resname MET GLY') - >>> sel - + >>> sel = universe.select_atoms('resname MET GLY') + >>> sel + is equivalent to .. doctest:: AtomGroup.select_atoms - >>> sel = universe.select_atoms('resname MET or resname GLY') - >>> sel - + >>> sel = universe.select_atoms('resname MET or resname GLY') + >>> sel + Will select all atoms with a residue name of either MET or GLY. @@ -3067,24 +3065,24 @@ def select_atoms(self, sel, *othersel, periodic=True, rtol=1e-05, .. doctest:: AtomGroup.select_atoms - >>> sel = universe.select_atoms("segid 4AKE and not ( name H* O* )") - >>> sel - + >>> sel = universe.select_atoms("segid 4AKE and not ( name H* O* )") + >>> sel + Existing :class:`AtomGroup` objects can be passed as named arguments, which will then be available to the selection parser. .. testsetup:: AtomGroup.select_atoms.namedarguments - from MDAnalysis.tests.datafiles import PSF, DCD - import MDAnalysis as mda - universe = mda.Universe(PSF, DCD) - sel = universe.select_atoms("segid 4AKE and not ( name H* O* )") + from MDAnalysis.tests.datafiles import PSF, DCD + import MDAnalysis as mda + universe = mda.Universe(PSF, DCD) + sel = universe.select_atoms("segid 4AKE and not ( name H* O* )") .. doctest:: AtomGroup.select_atoms, AtomGroup.select_atoms.namedarguments - >>> universe.select_atoms("around 10 group notHO", notHO=sel) - + >>> universe.select_atoms("around 10 group notHO", notHO=sel) + Selections can be set to update automatically on frame change, by setting the `updating` keyword argument to `True`. This will return @@ -3093,17 +3091,17 @@ def select_atoms(self, sel, *othersel, periodic=True, rtol=1e-05, .. testsetup:: AtomGroup.select_atoms.updating - from MDAnalysis.tests.datafiles import PDB, XTC - import MDAnalysis as mda - universe = mda.Universe(PDB, XTC) + from MDAnalysis.tests.datafiles import PDB, XTC + import MDAnalysis as mda + universe = mda.Universe(PDB, XTC) .. doctest:: AtomGroup.select_atoms.updating :options: +NORMALIZE_WHITESPACE - >>> universe.select_atoms("resname SOL and around 2.0 protein", - ... updating=True) - + >>> universe.select_atoms("resname SOL and around 2.0 protein", + ... updating=True) + Notes ----- @@ -3705,7 +3703,7 @@ def write(self, filename=None, file_format=None, # provided explicitly. If not, then we need to figure out if we write # multiple frames or not. multiframe = kwargs.pop('multiframe', None) - if len(trj_frames) > 1 and multiframe == False: + if len(trj_frames) > 1 and multiframe is False: raise ValueError( 'Cannot explicitely set "multiframe" to False and request ' 'more than 1 frame with the "frames" keyword argument.' @@ -3743,7 +3741,8 @@ def write(self, filename=None, file_format=None, # here `file_format` is only used as default, # anything pulled off `filename` will be used preferentially writer = get_selection_writer_for(filename, - file_format if file_format is not None else 'PDB') + file_format if file_format is not None + else 'PDB') except (TypeError, NotImplementedError): pass else: @@ -3962,24 +3961,24 @@ def unique(self): .. testsetup:: ResidueGroup.unique - import MDAnalysis as mda - from MDAnalysis.tests.datafiles import PSF, DCD - u = mda.Universe(PSF, DCD) + import MDAnalysis as mda + from MDAnalysis.tests.datafiles import PSF, DCD + u = mda.Universe(PSF, DCD) .. doctest:: ResidueGroup.unique - >>> rg = u.residues[[2, 1, 2, 2, 1, 0]] - >>> rg - - >>> rg.ix - array([2, 1, 2, 2, 1, 0]) - >>> rg2 = rg.unique - >>> rg2 - - >>> rg2.ix - array([0, 1, 2]) - >>> rg2.unique is rg2 - False + >>> rg = u.residues[[2, 1, 2, 2, 1, 0]] + >>> rg + + >>> rg.ix + array([2, 1, 2, 2, 1, 0]) + >>> rg2 = rg.unique + >>> rg2 + + >>> rg2.ix + array([0, 1, 2]) + >>> rg2.unique is rg2 + False .. versionadded:: 0.16.0 @@ -4018,24 +4017,24 @@ def asunique(self, sorted=False): .. testsetup:: ResidueGroup.asunique - import MDAnalysis as mda - from MDAnalysis.tests.datafiles import PSF, DCD - u = mda.Universe(PSF, DCD) + import MDAnalysis as mda + from MDAnalysis.tests.datafiles import PSF, DCD + u = mda.Universe(PSF, DCD) .. doctest:: ResidueGroup.asunique - >>> rg = u.residues[[2, 1, 2, 2, 1, 0]] - >>> rg - - >>> rg.ix - array([2, 1, 2, 2, 1, 0]) - >>> rg2 = rg.asunique(sorted=True) - >>> rg2 - - >>> rg2.ix - array([0, 1, 2]) - >>> rg2.asunique() is rg2 - True + >>> rg = u.residues[[2, 1, 2, 2, 1, 0]] + >>> rg + + >>> rg.ix + array([2, 1, 2, 2, 1, 0]) + >>> rg2 = rg.asunique(sorted=True) + >>> rg2 + + >>> rg2.ix + array([0, 1, 2]) + >>> rg2.asunique() is rg2 + True .. versionadded:: 2.0.0 @@ -4154,24 +4153,24 @@ def unique(self): .. testsetup:: SegmentGroup.unique - from MDAnalysis.tests.datafiles import CONECT - import MDAnalysis as mda - u = mda.Universe(CONECT) + from MDAnalysis.tests.datafiles import CONECT + import MDAnalysis as mda + u = mda.Universe(CONECT) .. doctest:: SegmentGroup.unique - >>> sg = u.segments[[2, 1, 2, 2, 1, 0]] - >>> sg - - >>> sg.ix - array([2, 1, 2, 2, 1, 0]) - >>> sg2 = sg.unique - >>> sg2 - - >>> sg2.ix - array([0, 1, 2]) - >>> sg2.unique is sg2 - False + >>> sg = u.segments[[2, 1, 2, 2, 1, 0]] + >>> sg + + >>> sg.ix + array([2, 1, 2, 2, 1, 0]) + >>> sg2 = sg.unique + >>> sg2 + + >>> sg2.ix + array([0, 1, 2]) + >>> sg2.unique is sg2 + False .. versionadded:: 0.16.0 @@ -4210,24 +4209,24 @@ def asunique(self, sorted=False): .. testsetup:: SegmentGroup.asunique - from MDAnalysis.tests.datafiles import CONECT - import MDAnalysis as mda - u = mda.Universe(CONECT) + from MDAnalysis.tests.datafiles import CONECT + import MDAnalysis as mda + u = mda.Universe(CONECT) .. doctest:: SegmentGroup.asunique - >>> sg = u.segments[[2, 1, 2, 2, 1, 0]] - >>> sg - - >>> sg.ix - array([2, 1, 2, 2, 1, 0]) - >>> sg2 = sg.asunique(sorted=True) - >>> sg2 - - >>> sg2.ix - array([0, 1, 2]) - >>> sg2.asunique() is sg2 - True + >>> sg = u.segments[[2, 1, 2, 2, 1, 0]] + >>> sg + + >>> sg.ix + array([2, 1, 2, 2, 1, 0]) + >>> sg2 = sg.asunique(sorted=True) + >>> sg2 + + >>> sg2.ix + array([0, 1, 2]) + >>> sg2.asunique() is sg2 + True .. versionadded:: 2.0.0 @@ -4733,8 +4732,8 @@ def __repr__(self): else: basegrp = "another AtomGroup." # With a shorthand to conditionally append the 's' in 'selections'. - return "{}, with selection{} {} on {}>".format(basestr[:-1], - "s"[len(self._selection_strings) == 1:], sels, basegrp) + return "{}, with selection{} {} on {}>".format( + basestr[:-1], "s"[len(self._selection_strings) == 1:], sels, basegrp) @property def atoms(self): @@ -4760,21 +4759,24 @@ def atoms(self): ------- The static :attr:`atoms` allows comparison of groups of atoms between frames. For example, track water molecules that move in and out of a - solvation shell of a protein:: + solvation shell of a protein + + .. code-block:: python - u = mda.Universe(TPR, XTC) - water_shell = u.select_atoms("name OW and around 3.5 protein", updating=True) - water_shell_prev = water_shell.atoms + u = mda.Universe(TPR, XTC) + water_shell = u.select_atoms("name OW and around 3.5 protein", + updating=True) + water_shell_prev = water_shell.atoms - for ts in u.trajectory: - exchanged = water_shell - water_shell_prev + for ts in u.trajectory: + exchanged = water_shell - water_shell_prev - print(ts.time, "waters in shell =", water_shell.n_residues) - print(ts.time, "waters that exchanged = ", exchanged.n_residues) - print(ts.time, "waters that remained bound = ", - water_shell.n_residues - exchanged.n_residues) + print(ts.time, "waters in shell =", water_shell.n_residues) + print(ts.time, "waters that exchanged = ", exchanged.n_residues) + print(ts.time, "waters that remained bound = ", + water_shell.n_residues - exchanged.n_residues) - water_shell_prev = water_shell.atoms + water_shell_prev = water_shell.atoms By remembering the atoms of the current time step in `water_shell_prev`, it becomes possible to use the :meth:`subtraction From a6e2a7308f05682605c5a37f7de46449f504edff Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Sun, 17 Dec 2023 12:10:02 -0700 Subject: [PATCH 08/26] Added username to CHANGELOG --- package/CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/CHANGELOG b/package/CHANGELOG index 7b6cbc709f3..c116dc57d8f 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -15,7 +15,7 @@ The rules for this file: ------------------------------------------------------------------------------- ??/??/?? IAlibay, ianmkenney, PicoCentauri, pgbarletta, p-j-smith, - richardjgowers, lilyminium, ALescoulie, hmacdope, HeetVekariya, + richardjgowers, lilyminium, ALescoulie, hmacdope, HeetVekariya, ljwoods2, JoStoe * 2.7.0 From f4c3501d16b9b9db36983b5cca942ae17848abb7 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Sun, 17 Dec 2023 15:31:48 -0700 Subject: [PATCH 09/26] Added CHANGELOG entry describing PR --- package/CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/CHANGELOG b/package/CHANGELOG index c116dc57d8f..ee7140af8e1 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -33,6 +33,8 @@ Fixes RMSD of None * Fixes hydrogenbonds tutorial path to point to hbonds (Issue #4285, PR #4286) * Fix atom charge reading in PDBQT parser (Issue #4282, PR #4283) + * Fix doctests failing from separated blocks of imports and + execution and incorrectly formatted test output (Issue #3925, PR #4366) Enhancements * Added a reader for GROMOS11 TRC trajectories (PR #4292 , Issue #4291) From e885e437c218b1fb72b399f1d6b6dd8218929437 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Tue, 19 Dec 2023 19:22:25 -0700 Subject: [PATCH 10/26] Revert "Fixed errors in atomicdistances.py" This reverts commit 30c8bccef82a3b6ad714c0802b6ffb0df457e100. --- .../MDAnalysis/analysis/atomicdistances.py | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/package/MDAnalysis/analysis/atomicdistances.py b/package/MDAnalysis/analysis/atomicdistances.py index 59638dbaf8c..048935aac65 100644 --- a/package/MDAnalysis/analysis/atomicdistances.py +++ b/package/MDAnalysis/analysis/atomicdistances.py @@ -67,44 +67,44 @@ We will calculate the distances between an atom group of atoms 101-105 and an atom group of atoms 4001-4005 with periodic boundary conditions. -To select these atoms: :: +To select these atoms: >>> u = mda.Universe(GRO, XTC) >>> ag1 = u.atoms[100:105] >>> ag2 = u.atoms[4000:4005] We can run the calculations using any variable of choice such as -``my_dists`` and access our results using ``my_dists.results``: :: +``my_dists`` and access our results using ``my_dists.results``: >>> my_dists = ad.AtomicDistances(ag1, ag2).run() >>> my_dists.results array([[37.80813681, 33.2594864 , 34.93676414, 34.51183299, 34.96340209], - [27.11746625, 31.19878079, 31.69439435, 32.63446126, 33.10451345], - [23.27210749, 30.38714688, 32.48269361, 31.91444505, 31.84583838], - [18.40607922, 39.21993135, 39.33468192, 41.0133789 , 39.46885946], - [26.26006981, 37.9966713 , 39.14991106, 38.13423586, 38.95451427], - [26.83845081, 34.66255735, 35.59335027, 34.8926705 , 34.27175056], - [37.51994763, 38.12161091, 37.56481743, 36.8488121 , 35.75278065], - [37.27275501, 37.7831456 , 35.74359073, 34.54893794, 34.76495816], - [38.76272761, 41.31816555, 38.81588421, 39.82491432, 38.890219 ], - [39.20012515, 40.00563374, 40.83857688, 38.77886735, 41.45775864]]) + [27.11746625, 31.19878079, 31.69439435, 32.63446126, 33.10451345], + [23.27210749, 30.38714688, 32.48269361, 31.91444505, 31.84583838], + [18.40607922, 39.21993135, 39.33468192, 41.0133789 , 39.46885946], + [26.26006981, 37.9966713 , 39.14991106, 38.13423586, 38.95451427], + [26.83845081, 34.66255735, 35.59335027, 34.8926705 , 34.27175056], + [37.51994763, 38.12161091, 37.56481743, 36.8488121 , 35.75278065], + [37.27275501, 37.7831456 , 35.74359073, 34.54893794, 34.76495816], + [38.76272761, 41.31816555, 38.81588421, 39.82491432, 38.890219 ], + [39.20012515, 40.00563374, 40.83857688, 38.77886735, 41.45775864]]) To do the computation without periodic boundary conditions, we can enter the keyword argument ``pbc=False`` after ``ag2``. The result is different -in this case: :: +in this case: >>> my_dists_nopbc = ad.AtomicDistances(ag1, ag2, pbc=False).run() >>> my_dists_nopbc.results array([[37.80813681, 33.2594864 , 34.93676414, 34.51183299, 34.96340209], - [27.11746625, 31.19878079, 31.69439435, 32.63446126, 33.10451345], - [23.27210749, 30.38714688, 32.482695 , 31.91444505, 31.84583838], - [18.40607922, 39.21992825, 39.33468192, 41.0133757 , 39.46885946], - [26.26006981, 37.99666906, 39.14990985, 38.13423708, 38.95451311], - [26.83845081, 34.66255625, 35.59335027, 34.8926705 , 34.27174827], - [51.86981409, 48.10347964, 48.39570072, 49.14423513, 50.44804292], - [37.27275501, 37.7831456 , 35.74359073, 34.54893794, 34.76495816], - [56.39657447, 41.31816555, 38.81588421, 39.82491432, 38.890219 ], - [39.20012515, 40.00563374, 40.83857688, 38.77886735, 41.45775864]]) + [27.11746625, 31.19878079, 31.69439435, 32.63446126, 33.10451345], + [23.27210749, 30.38714688, 32.482695 , 31.91444505, 31.84583838], + [18.40607922, 39.21992825, 39.33468192, 41.0133757 , 39.46885946], + [26.26006981, 37.99666906, 39.14990985, 38.13423708, 38.95451311], + [26.83845081, 34.66255625, 35.59335027, 34.8926705 , 34.27174827], + [51.86981409, 48.10347964, 48.39570072, 49.14423513, 50.44804292], + [37.27275501, 37.7831456 , 35.74359073, 34.54893794, 34.76495816], + [56.39657447, 41.31816555, 38.81588421, 39.82491432, 38.890219 ], + [39.20012515, 40.00563374, 40.83857688, 38.77886735, 41.45775864]]) """ From f7ab37160ecc308b989747f05f237de511d86a95 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Tue, 19 Dec 2023 19:24:06 -0700 Subject: [PATCH 11/26] Revert "Removed unused import" This reverts commit eadfff067b48821facb2c5a757f2a58b0943287c. --- package/MDAnalysis/analysis/atomicdistances.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/MDAnalysis/analysis/atomicdistances.py b/package/MDAnalysis/analysis/atomicdistances.py index 048935aac65..e13c9543bd4 100644 --- a/package/MDAnalysis/analysis/atomicdistances.py +++ b/package/MDAnalysis/analysis/atomicdistances.py @@ -112,6 +112,8 @@ from MDAnalysis.lib.distances import calc_bonds + +import warnings import logging from .base import AnalysisBase From c809864d6f3547405f7aa6c48302279929d7ba9b Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Tue, 19 Dec 2023 19:24:17 -0700 Subject: [PATCH 12/26] Revert "Fixed tests in overview.rst" This reverts commit ad513ddbccf6e1bc4993316c874d5ed26a152ef5. --- package/doc/sphinx/source/documentation_pages/overview.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/doc/sphinx/source/documentation_pages/overview.rst b/package/doc/sphinx/source/documentation_pages/overview.rst index dce93410f5d..daf3cc9a1d4 100644 --- a/package/doc/sphinx/source/documentation_pages/overview.rst +++ b/package/doc/sphinx/source/documentation_pages/overview.rst @@ -120,7 +120,7 @@ over time:: < DCDReader '/..../MDAnalysis/tests/data/adk_dims.dcd' with 98 frames of 3341 atoms (0 fixed) > Finally, the :meth:`MDAnalysis.Universe.select_atoms` method generates a new -:class:`~MDAnalysis.core.groups.AtomGroup` according to a selection criterion:: +:class:`~MDAnalysis.core.groups.AtomGroup` according to a selection criterion >>> calphas = u.select_atoms("name CA") >>> print(calphas) From bcf5380a7ca769459acc6b2cc1560228080f7e0a Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Tue, 19 Dec 2023 19:25:03 -0700 Subject: [PATCH 13/26] Revert "Added name to authors per PR feedback" This reverts commit 1cd57492d0d641c583be9d20718601690ca4a8df. --- package/AUTHORS | 1 - 1 file changed, 1 deletion(-) diff --git a/package/AUTHORS b/package/AUTHORS index 992d35f7737..c2d41018dce 100644 --- a/package/AUTHORS +++ b/package/AUTHORS @@ -228,7 +228,6 @@ Chronological list of authors - Sumit Gupta - Heet Vekariya - Johannes Stöckelmaier - - Lawson Woods External code ------------- From c29255325b3a43d3899f37630efddd0d996ab40e Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Tue, 19 Dec 2023 19:25:34 -0700 Subject: [PATCH 14/26] Reverting commit from different branch --- package/AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/package/AUTHORS b/package/AUTHORS index c2d41018dce..992d35f7737 100644 --- a/package/AUTHORS +++ b/package/AUTHORS @@ -228,6 +228,7 @@ Chronological list of authors - Sumit Gupta - Heet Vekariya - Johannes Stöckelmaier + - Lawson Woods External code ------------- From 16457f740efe71ed07b9c7663e251749fdb5c5cf Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Wed, 20 Dec 2023 10:53:49 -0700 Subject: [PATCH 15/26] Revert "flake8 & black reformatting" This reverts commit 1cd741ba1fe8b0a5fbe50443331ef914a43c3a18. --- package/MDAnalysis/core/groups.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/package/MDAnalysis/core/groups.py b/package/MDAnalysis/core/groups.py index 7d5f10f7ed3..22d15aa0932 100644 --- a/package/MDAnalysis/core/groups.py +++ b/package/MDAnalysis/core/groups.py @@ -99,7 +99,8 @@ import contextlib import warnings -from .. import _TOPOLOGY_ATTRS, _TOPOLOGY_TRANSPLANTS, _TOPOLOGY_ATTRNAMES +from .. import (_CONVERTERS, + _TOPOLOGY_ATTRS, _TOPOLOGY_TRANSPLANTS, _TOPOLOGY_ATTRNAMES) from ..lib import util from ..lib.util import (cached, warn_if_not_unique, unique_int_1d, unique_int_1d_unsorted, @@ -1097,7 +1098,7 @@ def center(self, weights, wrap=False, unwrap=False, compound='group'): return coords.mean(axis=0) # promote weights to dtype if required: weights = weights.astype(dtype, copy=False) - return np.einsum("ij,ij->j", coords, weights[:, None]) / weights.sum() + return np.einsum('ij,ij->j',coords,weights[:, None]) / weights.sum() # When compound split caching gets implemented it will be clever to # preempt at this point whether or not stable sorting will be needed @@ -1909,12 +1910,10 @@ def unwrap(self, compound='fragments', reference='com', inplace=True): masses = unique_atoms.masses total_mass = masses.sum() if np.isclose(total_mass, 0.0): - raise ValueError( - "Cannot perform unwrap with " - "reference='com' because the total " - "mass of the group is zero." - ) - refpos = np.einsum("ij,ij->j", positions, masses[:, None]) + raise ValueError("Cannot perform unwrap with " + "reference='com' because the total " + "mass of the group is zero.") + refpos = np.einsum('ij,ij->j', positions, masses[:, None]) refpos /= total_mass else: # reference == 'cog' refpos = positions.mean(axis=0) @@ -3200,11 +3199,10 @@ def select_atoms(self, sel, *othersel, periodic=True, rtol=1e-05, universe = mda.Universe(PSF, DCD) guessed_elements = guess_types(universe.atoms.names) universe.add_TopologyAttr('elements', guessed_elements) - + .. doctest:: AtomGroup.select_atoms.smarts - >>> universe.select_atoms("smarts C", smarts_kwargs= - ... {"maxMatches": 100}) + >>> universe.select_atoms("smarts C", smarts_kwargs={"maxMatches": 100}) chiral *R | S* From 9989eb8c8ed107c8f8e646bac42c96538745400f Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Wed, 20 Dec 2023 11:14:38 -0700 Subject: [PATCH 16/26] Reverting Black format --- package/MDAnalysis/core/groups.py | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/package/MDAnalysis/core/groups.py b/package/MDAnalysis/core/groups.py index 22d15aa0932..1cb57f1f342 100644 --- a/package/MDAnalysis/core/groups.py +++ b/package/MDAnalysis/core/groups.py @@ -114,7 +114,7 @@ from . import selection from ..exceptions import NoDataError from . import topologyobjects -from ._get_readers import get_writer_for +from ._get_readers import get_writer_for, get_converter_for def _unpickle(u, ix): @@ -367,6 +367,7 @@ def __getattr__(self, attr): # property of wrong group/component if not isinstance(self, clstype): + mname = 'property' if isinstance(meth, property) else 'method' err = '{attr} is a {method} of {clstype}, not {selfcls}' clsname = clstype.__name__ if clsname == 'GroupBase': @@ -618,9 +619,9 @@ def __getattr__(self, attr): def __repr__(self): name = self.level.name - return ("<{}Group with {} {}{}>""".format( - name.capitalize(), len(self), - name, "s"[len(self) == 1:])) # Shorthand for a conditional plural 's'. + return ("<{}Group with {} {}{}>" + "".format(name.capitalize(), len(self), name, + "s"[len(self) == 1:])) # Shorthand for a conditional plural 's'. def __str__(self): name = self.level.name @@ -968,10 +969,10 @@ def _split_by_compound_indices(self, compound, stable_sort=False): compound_masks.append(compound_sizes == compound_size) if needs_sorting: atom_masks.append(sort_indices[size_per_atom == compound_size] - .reshape(-1, compound_size)) + .reshape(-1, compound_size)) else: atom_masks.append(np.where(size_per_atom == compound_size)[0] - .reshape(-1, compound_size)) + .reshape(-1, compound_size)) return atom_masks, compound_masks, len(compound_sizes) @@ -1127,7 +1128,7 @@ def center(self, weights, wrap=False, unwrap=False, compound='group'): _centers = _coords.mean(axis=1) else: _weights = weights[atom_mask] - _centers = np.einsum('ijk,ijk->ik', _coords, _weights[:, :, None]) + _centers = np.einsum('ijk,ijk->ik',_coords,_weights[:, :, None]) _centers /= _weights.sum(axis=1)[:, None] centers[compound_mask] = _centers if wrap: @@ -1913,7 +1914,7 @@ def unwrap(self, compound='fragments', reference='com', inplace=True): raise ValueError("Cannot perform unwrap with " "reference='com' because the total " "mass of the group is zero.") - refpos = np.einsum('ij,ij->j', positions, masses[:, None]) + refpos = np.einsum('ij,ij->j',positions,masses[:, None]) refpos /= total_mass else: # reference == 'cog' refpos = positions.mean(axis=0) @@ -1925,8 +1926,8 @@ def unwrap(self, compound='fragments', reference='com', inplace=True): # When unwrapping and not shifting with a cog/com reference we # need to make sure that the first atom of each compound is stable # regarding sorting. - atom_masks = unique_atoms._split_by_compound_indices( - comp, stable_sort=reference is None)[0] + atom_masks = unique_atoms._split_by_compound_indices(comp, + stable_sort=reference is None)[0] positions = unique_atoms.positions for atom_mask in atom_masks: for mask in atom_mask: @@ -1942,7 +1943,7 @@ def unwrap(self, compound='fragments', reference='com', inplace=True): "reference='com' because the " "total mass of at least one of " "the {} is zero.".format(comp)) - refpos = np.einsum('ijk,ijk->ik', positions[atom_mask], + refpos = np.einsum('ijk,ijk->ik',positions[atom_mask], masses[:, :, None]) refpos /= total_mass[:, None] else: # reference == 'cog' @@ -2701,8 +2702,8 @@ def residues(self, new): except AttributeError: errmsg = ("Can only set AtomGroup residues to Residue " "or ResidueGroup not {}".format( - ', '.join(type(r) for r in new - if not isinstance(r, Residue)))) + ', '.join(type(r) for r in new + if not isinstance(r, Residue)))) raise TypeError(errmsg) from None if not isinstance(r_ix, itertools.cycle) and len(r_ix) != len(self): raise ValueError("Incorrect size: {} for AtomGroup of size: {}" @@ -3701,7 +3702,7 @@ def write(self, filename=None, file_format=None, # provided explicitly. If not, then we need to figure out if we write # multiple frames or not. multiframe = kwargs.pop('multiframe', None) - if len(trj_frames) > 1 and multiframe is False: + if len(trj_frames) > 1 and multiframe == False: raise ValueError( 'Cannot explicitely set "multiframe" to False and request ' 'more than 1 frame with the "frames" keyword argument.' @@ -3739,8 +3740,7 @@ def write(self, filename=None, file_format=None, # here `file_format` is only used as default, # anything pulled off `filename` will be used preferentially writer = get_selection_writer_for(filename, - file_format if file_format is not None - else 'PDB') + file_format if file_format is not None else 'PDB') except (TypeError, NotImplementedError): pass else: From a4db981fff2f54644fdb9c0a715f2e3dd4469ba0 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Wed, 20 Dec 2023 12:35:34 -0700 Subject: [PATCH 17/26] Uppdate CHANGELOG --- package/CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/package/CHANGELOG b/package/CHANGELOG index ee7140af8e1..4ad2edf4b60 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -35,6 +35,7 @@ Fixes * Fix atom charge reading in PDBQT parser (Issue #4282, PR #4283) * Fix doctests failing from separated blocks of imports and execution and incorrectly formatted test output (Issue #3925, PR #4366) + * Fix groups.py doctests using sphinx directives (Issue #3925, PR #4374) Enhancements * Added a reader for GROMOS11 TRC trajectories (PR #4292 , Issue #4291) From a1682f51dd044fa292c8dc6e8271053ef500f375 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Fri, 22 Dec 2023 08:09:33 +0100 Subject: [PATCH 18/26] Update README to reflect move to GitHub Discussions (#4375) --- .github/ISSUE_TEMPLATE/questions.md | 10 ++++----- .github/workflows/greetings.yaml | 2 +- CODE_OF_CONDUCT.md | 4 ++-- GOVERNANCE.md | 2 +- README.rst | 31 ++++++++++++--------------- package/INSTALL | 4 ++-- package/MDAnalysis/__init__.py | 4 ++-- package/MDAnalysis/coordinates/TRJ.py | 4 ++-- package/README | 4 ++-- package/doc/README | 2 +- package/doc/sphinx/source/index.rst | 7 +++--- package/setup.py | 6 ++---- testsuite/INSTALL | 4 ++-- testsuite/README | 12 ++++------- testsuite/setup.py | 4 ++-- 15 files changed, 45 insertions(+), 55 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/questions.md b/.github/ISSUE_TEMPLATE/questions.md index fd8bad08428..39cfcd83bb4 100644 --- a/.github/ISSUE_TEMPLATE/questions.md +++ b/.github/ISSUE_TEMPLATE/questions.md @@ -1,6 +1,6 @@ --- name: Questions -about: If you want to ask a question please use the mailing list! +about: If you want to ask a question please use GitHub Discussions! --- @@ -11,13 +11,13 @@ If you have a **QUESTION** such as - what output means - ... or similar questions related to *USING* MDAnalysis -then please *ask this question on the user mailing list* +then please *ask this question on GitHub Discussions* - https://groups.google.com/forum/#!forum/mdnalysis-discussion + https://github.com/MDAnalysis/mdanalysis/discussions -The issue tracker is meant for DEFECTS ("BUGS"), new FEATURES, and decisions on the API. In order to keep the volume of work on the issue tracker manageable for our volunteer developers, we will **IMMEDIATELY CLOSE ISSUES WITH QUESTIONS** as these questions are better answered on the mailing list. +The issue tracker is meant for DEFECTS ("BUGS"), new FEATURES, and decisions on the API. In order to keep the volume of work on the issue tracker manageable for our volunteer developers, we will migrate issues with questions to [GitHub Discussions](https://github.com/MDAnalysis/mdanalysis/discussions). -We really appreciate you getting in touch with us --- no matter what you want to discuss. But we need your help keeping the amount of work manageable so please use the mailing list for questions and the issue tracker for code-related issues. +We really appreciate you getting in touch with us --- no matter what you want to discuss. But we need your help keeping the amount of work manageable so please use [GitHub Discussions](https://github.com/MDAnalysis/mdanalysis/discussions) for questions and the issue tracker for code-related issues. Thank you! diff --git a/.github/workflows/greetings.yaml b/.github/workflows/greetings.yaml index aa7a6ff9b6f..a0e5903d585 100644 --- a/.github/workflows/greetings.yaml +++ b/.github/workflows/greetings.yaml @@ -17,4 +17,4 @@ jobs: - uses: actions/first-interaction@v1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - pr-message: 'Hello there first time contributor! Welcome to the MDAnalysis community! We ask that all contributors abide by our [Code of Conduct](https://www.mdanalysis.org/pages/conduct/) and that first time contributors introduce themselves on the [developer mailing list](https://groups.google.com/g/mdnalysis-devel) so we can get to know you. You can learn more about [participating here](https://www.mdanalysis.org/#participating). Please also add yourself to `package/AUTHORS` as part of this PR.' + pr-message: 'Hello there first time contributor! Welcome to the MDAnalysis community! We ask that all contributors abide by our [Code of Conduct](https://www.mdanalysis.org/pages/conduct/) and that first time contributors introduce themselves on [GitHub Discussions](https://github.com/MDAnalysis/mdanalysis/discussions) so we can get to know you. You can learn more about [participating here](https://www.mdanalysis.org/#participating). Please also add yourself to `package/AUTHORS` as part of this PR.' diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 70953c07dda..7b6b459a78d 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -41,7 +41,7 @@ welcome reports](#reporting) by filling out [*this form*][conduct-form]. This code applies equally to founders, developers, mentors and new community members, in all spaces managed by MDAnalysis. This -includes the mailing lists, our GitHub organizations, our chat rooms, +includes GitHub Discussions, our GitHub organizations, our chat rooms, in-person events, and any other forums created by the project team. In addition, violations of this code outside these spaces may affect a person's ability to participate within them. @@ -49,7 +49,7 @@ person's ability to participate within them. By embracing the following principles, guidelines and actions to follow or avoid, you will help us make MDAnalysis a welcoming and productive community. If that doesn't answer your questions, feel free to contact us -at our [*user-mailing-list*](mailto:mdnalysis-discussions@googlegroups.com). +via [GitHub Discussions](https://github.com/MDAnalysis/mdanalysis/discussions). 1. **Be friendly and patient**. diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 6c716aeae2f..812b3b98a9c 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -6,7 +6,7 @@ Below is a summary of the governance model (but note that if the text on this pa ---- -Project leadership is provided by a subset of contributors, the **MDAnalysis Core Developers** ([@MDAnalysis/coredevs](https://github.com/orgs/MDAnalysis/teams/coredevs)) who have produced substantial contributions over extended lengths of time and who remain active in reviewing issues and discussions on the various mailing lists. MDAnalysis Core Developers are granted commit rights (write access) to the GitHub source code repository. New MDAnalysis Core Developers are elected with a simple majority of current MDAnalysis Core Developers. +Project leadership is provided by a subset of contributors, the **MDAnalysis Core Developers** ([@MDAnalysis/coredevs](https://github.com/orgs/MDAnalysis/teams/coredevs)) who have produced substantial contributions over extended lengths of time and who remain active in reviewing issues and discussions on the various discussion channels. MDAnalysis Core Developers are granted commit rights (write access) to the GitHub source code repository. New MDAnalysis Core Developers are elected with a simple majority of current MDAnalysis Core Developers. All decisions are made by simple majority of the MDAnalysis Core Developers. diff --git a/README.rst b/README.rst index df365c7e0f4..c539704e74a 100644 --- a/README.rst +++ b/README.rst @@ -2,9 +2,13 @@ MDAnalysis Repository README ================================ -|numfocus| |build| |cron| |cirruscron| |linters| |cov| +|numfocus| -|docs| |devdocs| |usergroup| |developergroup| |anaconda| |asv| +|build| |cron| |cirruscron| |linters| |cov| + +|docs| |devdocs| |discussions| + +|anaconda| |asv| MDAnalysis_ is a Python library for the analysis of computer simulations of many-body systems at the molecular scale, spanning use cases from interactions of drugs with proteins to novel materials. It is widely used in the scientific community and is written by scientists for scientists. @@ -84,10 +88,10 @@ Contributing ============ Please report **bugs** or **enhancement requests** through the `Issue -Tracker`_. Questions can also be asked on the `user mailing list`_. +Tracker`_. Questions can also be asked on `GitHub Discussions`_. If you are a **new developer** who would like to start contributing to -MDAnalysis get in touch on the `developer mailing list`_. To set up a +MDAnalysis get in touch on `GitHub Discussions`_. To set up a development environment and run the test suite read the `developer guide`_. @@ -135,26 +139,15 @@ For citations of included algorithms and sub-modules please see the references_. .. _`MDAnalysis API docs`: https://docs.mdanalysis.org .. _`Issue Tracker`: https://github.com/mdanalysis/mdanalysis/issues -.. _`user mailing list`: - https://groups.google.com/group/mdnalysis-discussion +.. _`GitHub Discussions`: + https://github.com/MDAnalysis/mdanalysis/discussions .. _`developer guide`: https://userguide.mdanalysis.org/contributing.html -.. _`developer mailing list`: - https://groups.google.com/group/mdnalysis-devel .. _`10.1002/jcc.21787`: https://dx.doi.org/10.1002/jcc.21787 .. _`10.25080/Majora-629e541a-00e`: https://doi.org/10.25080/Majora-629e541a-00e .. _references: https://docs.mdanalysis.org/documentation_pages/references.html .. _Embedding code: https://www.mdanalysis.org/pages/citations/#powered-by-mdanalysis - -.. |usergroup| image:: https://img.shields.io/badge/Google%20Group-Users-lightgrey.svg - :alt: User Google Group - :target: https://groups.google.com/group/mdnalysis-discussion - -.. |developergroup| image:: https://img.shields.io/badge/Google%20Group-Developers-lightgrey.svg - :alt: Developer Google Group - :target: https://groups.google.com/group/mdnalysis-devel - .. |docs| image:: https://img.shields.io/badge/docs-latest-brightgreen.svg :alt: Documentation (latest release) :target: https://docs.mdanalysis.org @@ -198,3 +191,7 @@ For citations of included algorithms and sub-modules please see the references_. .. |powered_by_MDA| image:: https://img.shields.io/badge/Powered%20by-MDAnalysis-orange.svg?logoWidth=15&logo=data:image/x-icon;base64,AAABAAEAEBAAAAEAIAAoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJD+XwCY/fEAkf3uAJf97wGT/a+HfHaoiIWE7n9/f+6Hh4fvgICAjwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACT/yYAlP//AJ///wCg//8JjvOchXly1oaGhv+Ghob/j4+P/39/f3IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJH8aQCY/8wAkv2kfY+elJ6al/yVlZX7iIiI8H9/f7h/f38UAAAAAAAAAAAAAAAAAAAAAAAAAAB/f38egYF/noqAebF8gYaagnx3oFpUUtZpaWr/WFhY8zo6OmT///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgICAn46Ojv+Hh4b/jouJ/4iGhfcAAADnAAAA/wAAAP8AAADIAAAAAwCj/zIAnf2VAJD/PAAAAAAAAAAAAAAAAICAgNGHh4f/gICA/4SEhP+Xl5f/AwMD/wAAAP8AAAD/AAAA/wAAAB8Aov9/ALr//wCS/Z0AAAAAAAAAAAAAAACBgYGOjo6O/4mJif+Pj4//iYmJ/wAAAOAAAAD+AAAA/wAAAP8AAABhAP7+FgCi/38Axf4fAAAAAAAAAAAAAAAAiIiID4GBgYKCgoKogoB+fYSEgZhgYGDZXl5e/m9vb/9ISEjpEBAQxw8AAFQAAAAAAAAANQAAADcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjo6Mb5iYmP+cnJz/jY2N95CQkO4pKSn/AAAA7gAAAP0AAAD7AAAAhgAAAAEAAAAAAAAAAACL/gsAkv2uAJX/QQAAAAB9fX3egoKC/4CAgP+NjY3/c3Nz+wAAAP8AAAD/AAAA/wAAAPUAAAAcAAAAAAAAAAAAnP4NAJL9rgCR/0YAAAAAfX19w4ODg/98fHz/i4uL/4qKivwAAAD/AAAA/wAAAP8AAAD1AAAAGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALGxsVyqqqr/mpqa/6mpqf9KSUn/AAAA5QAAAPkAAAD5AAAAhQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADkUFBSuZ2dn/3V1df8uLi7bAAAATgBGfyQAAAA2AAAAMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB0AAADoAAAA/wAAAP8AAAD/AAAAWgC3/2AAnv3eAJ/+dgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9AAAA/wAAAP8AAAD/AAAA/wAKDzEAnP3WAKn//wCS/OgAf/8MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIQAAANwAAADtAAAA7QAAAMAAABUMAJn9gwCe/e0Aj/2LAP//AQAAAAAAAAAA :alt: Powered by MDAnalysis :target: https://www.mdanalysis.org + +.. |discussions| image:: https://img.shields.io/github/discussions/MDAnalysis/MDAnalysis + :alt: GitHub Discussions + :target: https://github.com/MDAnalysis/mdanalysis/discussions \ No newline at end of file diff --git a/package/INSTALL b/package/INSTALL index a6b9a2a876f..71c04e7760e 100644 --- a/package/INSTALL +++ b/package/INSTALL @@ -53,9 +53,9 @@ file) and README and check the MDAnalysis project pages at in particular https://github.com/MDAnalysis/mdanalysis/wiki/Install and related pages. -You can always ask questions on the MDAnalysis mailing list: +You can always ask questions on GitHub Discussions: - http://groups.google.com/group/mdnalysis-discussion + https://github.com/MDAnalysis/mdanalysis/discussions/categories/installation People there are very happy to help. When posting please remember to mention the release of MDAnalysis you are trying to install (e.g. "tar diff --git a/package/MDAnalysis/__init__.py b/package/MDAnalysis/__init__.py index b72908d765c..1813cb27f32 100644 --- a/package/MDAnalysis/__init__.py +++ b/package/MDAnalysis/__init__.py @@ -36,8 +36,8 @@ also be manipulated (for instance, fit to a reference structure) and written out. Time-critical code is written in C for speed. -Help is also available through the mailinglist at -http://groups.google.com/group/mdnalysis-discussion +Help is also available through GitHub Discussions at +https://github.com/MDAnalysis/mdanalysis/discussions Please report bugs and feature requests through the issue tracker at https://github.com/MDAnalysis/mdanalysis/issues diff --git a/package/MDAnalysis/coordinates/TRJ.py b/package/MDAnalysis/coordinates/TRJ.py index 2d41ff09207..ae59073dbc5 100644 --- a/package/MDAnalysis/coordinates/TRJ.py +++ b/package/MDAnalysis/coordinates/TRJ.py @@ -31,7 +31,7 @@ ---- Support for AMBER is still somewhat *experimental* and feedback and contributions are highly appreciated. Use the `Issue Tracker`_ or get in touch -on the `MDAnalysis mailinglist`_. +on the `GitHub Discussions`_. .. rubric:: Units @@ -126,7 +126,7 @@ .. _AMBER netcdf: http://ambermd.org/netcdf/nctraj.xhtml .. _NetCDF: http://www.unidata.ucar.edu/software/netcdf .. _Issue Tracker: https://github.com/MDAnalysis/mdanalysis/issues -.. _MDAnalysis mailinglist: https://groups.google.com/group/mdnalysis-discussion +.. _GitHub Discussions: https://github.com/MDAnalysis/mdanalysis/discussions """ import scipy.io.netcdf diff --git a/package/README b/package/README index cd73289a955..277c62dfed3 100644 --- a/package/README +++ b/package/README @@ -90,7 +90,7 @@ Please report bugs and feature requests through the Issue Tracker at https://github.com/MDAnalysis/mdanalysis/issues -Help is also available through the mailing list +Help is also available through GitHub Discussions - http://groups.google.com/group/mdnalysis-discussion + https://github.com/MDAnalysis/mdanalysis/discussions diff --git a/package/doc/README b/package/doc/README index 432b0db8292..0a25ed3b4e4 100644 --- a/package/doc/README +++ b/package/doc/README @@ -45,7 +45,7 @@ The manual includes all the doc strings with some additional text; it is a work in progress and suggestions to improve it are welcome. File them via the Issue Tracker at https://github.com/MDAnalysis/mdanalysis/issues/ or mention it on the -mailing list http://groups.google.com/group/mdnalysis-discussion . +GitHub Discussions https://github.com/MDAnalysis/mdanalysis/discussions. Wiki and online docs diff --git a/package/doc/sphinx/source/index.rst b/package/doc/sphinx/source/index.rst index ec50cc43290..e6171630c28 100644 --- a/package/doc/sphinx/source/index.rst +++ b/package/doc/sphinx/source/index.rst @@ -46,15 +46,14 @@ Getting involved ================ Please report **bugs** or **enhancement requests** through the `Issue -Tracker`_. Questions can also be asked on the `mdnalysis-discussion mailing -list`_. +Tracker`_. Questions can also be asked on the `GitHub Discussions`_. The MDAnalysis community subscribes to a `Code of Conduct`_ that all community members agree and adhere to --- please read it. .. _Issue Tracker: https://github.com/MDAnalysis/mdanalysis/issues -.. _`mdnalysis-discussion mailing list`: - http://groups.google.com/group/mdnalysis-discussion +.. _`GitHub Discussions`: + https://github.com/MDAnalysis/mdanalysis/discussions .. _`Code of Conduct`: https://www.mdanalysis.org/pages/conduct/ diff --git a/package/setup.py b/package/setup.py index 20833734c99..045b644b8a5 100755 --- a/package/setup.py +++ b/package/setup.py @@ -35,12 +35,10 @@ https://github.com/MDAnalysis/mdanalysis/wiki/INSTALL -Also free to ask on the MDAnalysis mailing list for help: +Also free to ask on GitHub Discussions for help: - http://groups.google.com/group/mdnalysis-discussion + https://github.com/MDAnalysis/mdanalysis/discussions/categories/installation -(Note that the group really is called `mdnalysis-discussion' because -Google groups forbids any name that contains the string `anal'.) """ from setuptools import setup, Extension, find_packages diff --git a/testsuite/INSTALL b/testsuite/INSTALL index b0db41ed077..d70142f6b58 100644 --- a/testsuite/INSTALL +++ b/testsuite/INSTALL @@ -23,9 +23,9 @@ file) and README and check the MDAnalysis project pages at in particular https://github.com/MDAnalysis/mdanalysis/wiki/INSTALL and related pages. -You can always ask questions on the MDAnalysis mailing list: +You can always ask questions on GitHub Discussions: - https://groups.google.com/group/mdnalysis-discussion + https://github.com/MDAnalysis/mdanalysis/discussions/categories/installation People there are very happy to help. When posting please remember to mention the release of MDAnalysis you are trying to install (e.g. "tar file diff --git a/testsuite/README b/testsuite/README index a2627534cfa..77e568e2019 100644 --- a/testsuite/README +++ b/testsuite/README @@ -2,7 +2,7 @@ MDAnalysisTests =================== -|build| |cov| |devdocs| |developergroup| +|build| |cov| |devdocs| MDAnalysis_ is a Python toolkit to analyze molecular dynamics trajectories generated by CHARMM, Amber, NAMD, LAMMPS, or Gromacs. @@ -30,9 +30,9 @@ Contact Please report bugs and feature requests through the `Issue Tracker`_. -Help is also available through the user mailing list at https://groups.google.com/group/mdnalysis-discussion. +Help is also available through GitHub Discussions at https://github.com/MDAnalysis/mdanalysis/discussions/categories/installation. -For questions and discussions for code development, join the developer list https://groups.google.com/group/mdnalysis-devel. +For questions and discussions for code development, use GitHub Discussions. .. Links .. _MDAnalysis: https://www.mdanalysis.org @@ -53,8 +53,4 @@ For questions and discussions for code development, join the developer list http .. |devdocs| image:: https://img.shields.io/badge/docs-development-yellow.svg :alt: Documentation (development version) - :target: https://docs.mdanalysis.org/dev - -.. |developergroup| image:: https://img.shields.io/badge/Google%20Group-Developers-lightgrey.svg - :alt: Developer Google Group - :target: https://groups.google.com/group/mdnalysis-devel + :target: https://docs.mdanalysis.org/dev \ No newline at end of file diff --git a/testsuite/setup.py b/testsuite/setup.py index 154b7dba99b..b61a740e90f 100755 --- a/testsuite/setup.py +++ b/testsuite/setup.py @@ -34,9 +34,9 @@ https://github.com/MDAnalysis/mdanalysis/wiki/INSTALL -Also free to ask on the MDAnalysis mailing list for help: +Also free to ask on GitHub Discussions for help: - http://groups.google.com/group/mdnalysis-discussion + https://github.com/MDAnalysis/mdanalysis/discussions (Note that the group really is called `mdnalysis-discussion' because Google groups forbids any name that contains the string `anal'.) From 5bef44e2427e19e7d82b9df768e9c1e1798788f6 Mon Sep 17 00:00:00 2001 From: Irfan Alibay Date: Sat, 23 Dec 2023 15:35:13 +0000 Subject: [PATCH 19/26] Adding py3.12 to full dependency CI checks (#4329) Running full deps py3.12 check in github actions now. --- .github/workflows/gh-ci.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/gh-ci.yaml b/.github/workflows/gh-ci.yaml index 3ed9ec4d313..578f4e4e845 100644 --- a/.github/workflows/gh-ci.yaml +++ b/.github/workflows/gh-ci.yaml @@ -27,7 +27,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, ] - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] full-deps: [true, ] codecov: [true, ] include: @@ -48,11 +48,6 @@ jobs: full-deps: true codecov: false extra-pip-deps: asv - - name: python_312 - os: ubuntu-latest - python-version: "3.12" - full-deps: false - codecov: true env: CYTHON_TRACE_NOGIL: 1 MPLBACKEND: agg From 4c936dc75482647a16c9a0a90a1ed93b3f5e6ff5 Mon Sep 17 00:00:00 2001 From: Irfan Alibay Date: Sun, 24 Dec 2023 13:27:00 +0000 Subject: [PATCH 20/26] Fix upper python+numpy pin for build system (#4385) Put upper pin at 3.13 not 3.12 --- package/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/pyproject.toml b/package/pyproject.toml index 34d00fa43d5..4b1ed86317c 100644 --- a/package/pyproject.toml +++ b/package/pyproject.toml @@ -17,7 +17,7 @@ requires = [ "numpy==1.26.0; python_version=='3.12' and platform_python_implementation != 'PyPy'", # For unreleased versions of Python there is currently no known supported # NumPy version. In that case we just let it be a bare NumPy install - "numpy<2.0; python_version>='3.12'", + "numpy<2.0; python_version>='3.13'", "setuptools", "wheel", ] From 55bc40e364133e8f515ae88cecfde011e6e5f6e4 Mon Sep 17 00:00:00 2001 From: Irfan Alibay Date: Tue, 26 Dec 2023 17:59:40 +0000 Subject: [PATCH 21/26] Tie off 2.7.0, add release upper pin (numpy) (#4389) Pre-release commit for 2.7.0 --- package/MDAnalysis/version.py | 2 +- package/pyproject.toml | 2 +- package/setup.py | 2 +- testsuite/MDAnalysisTests/__init__.py | 2 +- testsuite/setup.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package/MDAnalysis/version.py b/package/MDAnalysis/version.py index 31a978a816e..ce16880b77e 100644 --- a/package/MDAnalysis/version.py +++ b/package/MDAnalysis/version.py @@ -67,4 +67,4 @@ # e.g. with lib.log #: Release of MDAnalysis as a string, using `semantic versioning`_. -__version__ = "2.7.0-dev0" # NOTE: keep in sync with RELEASE in setup.py +__version__ = "2.7.0" # NOTE: keep in sync with RELEASE in setup.py diff --git a/package/pyproject.toml b/package/pyproject.toml index 4b1ed86317c..db6b0591570 100644 --- a/package/pyproject.toml +++ b/package/pyproject.toml @@ -35,7 +35,7 @@ maintainers = [ ] requires-python = ">=3.9" dependencies = [ - 'numpy>=1.22.3', + 'numpy>=1.22.3,<2.0', 'GridDataFormats>=0.4.0', 'mmtf-python>=1.0.0', 'joblib>=0.12', diff --git a/package/setup.py b/package/setup.py index 045b644b8a5..c44b7f64c8d 100755 --- a/package/setup.py +++ b/package/setup.py @@ -65,7 +65,7 @@ from subprocess import getoutput # NOTE: keep in sync with MDAnalysis.__version__ in version.py -RELEASE = "2.7.0-dev0" +RELEASE = "2.7.0" is_release = 'dev' not in RELEASE diff --git a/testsuite/MDAnalysisTests/__init__.py b/testsuite/MDAnalysisTests/__init__.py index 403963a7a3b..e9cf6107e33 100644 --- a/testsuite/MDAnalysisTests/__init__.py +++ b/testsuite/MDAnalysisTests/__init__.py @@ -97,7 +97,7 @@ logger = logging.getLogger("MDAnalysisTests.__init__") # keep in sync with RELEASE in setup.py -__version__ = "2.7.0-dev0" +__version__ = "2.7.0" # Do NOT import MDAnalysis at this level. Tests should do it themselves. diff --git a/testsuite/setup.py b/testsuite/setup.py index b61a740e90f..171527bd9c9 100755 --- a/testsuite/setup.py +++ b/testsuite/setup.py @@ -87,7 +87,7 @@ def run(self): if __name__ == '__main__': # this must be in-sync with MDAnalysis - RELEASE = "2.7.0-dev0" + RELEASE = "2.7.0" with open("README") as summary: LONG_DESCRIPTION = summary.read() From 3b3f2200fb566f59ea6cc2a4816e4b7bf41d4b10 Mon Sep 17 00:00:00 2001 From: Irfan Alibay Date: Tue, 26 Dec 2023 19:40:19 +0000 Subject: [PATCH 22/26] Update cirrus-deploy.yml (#4392) --- maintainer/ci/cirrus-deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maintainer/ci/cirrus-deploy.yml b/maintainer/ci/cirrus-deploy.yml index e00b4b6c232..3861e6ae497 100644 --- a/maintainer/ci/cirrus-deploy.yml +++ b/maintainer/ci/cirrus-deploy.yml @@ -17,7 +17,7 @@ linux_aarch64_wheel_task: memory: 4G env: CIBW_BUILD: cp39-manylinux_* cp310-manylinux_* cp311-manylinux_* cp312-manylinux_* - CIBW_ARCHS: ARM64 + CIBW_ARCHS: aarch64 build_script: | apt install -y python3-venv python-is-python3 @@ -31,7 +31,7 @@ macos_arm64_wheel_task: image: ghcr.io/cirruslabs/macos-monterey-xcode:14 env: CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* - CIBW_ARCHS: ARM64 + CIBW_ARCHS: arm64 PATH: /opt/homebrew/opt/python@3.10/bin:$PATH build_script: | From f302d84b1052fa1e869fdf22e28e6fc70feef14f Mon Sep 17 00:00:00 2001 From: IAlibay Date: Tue, 26 Dec 2023 23:31:02 +0000 Subject: [PATCH 23/26] Update things for 2.8.0-dev0 --- package/MDAnalysis/version.py | 2 +- package/pyproject.toml | 2 +- package/setup.py | 2 +- testsuite/MDAnalysisTests/__init__.py | 2 +- testsuite/setup.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package/MDAnalysis/version.py b/package/MDAnalysis/version.py index ce16880b77e..4f165486593 100644 --- a/package/MDAnalysis/version.py +++ b/package/MDAnalysis/version.py @@ -67,4 +67,4 @@ # e.g. with lib.log #: Release of MDAnalysis as a string, using `semantic versioning`_. -__version__ = "2.7.0" # NOTE: keep in sync with RELEASE in setup.py +__version__ = "2.8.0-dev0" # NOTE: keep in sync with RELEASE in setup.py diff --git a/package/pyproject.toml b/package/pyproject.toml index db6b0591570..4b1ed86317c 100644 --- a/package/pyproject.toml +++ b/package/pyproject.toml @@ -35,7 +35,7 @@ maintainers = [ ] requires-python = ">=3.9" dependencies = [ - 'numpy>=1.22.3,<2.0', + 'numpy>=1.22.3', 'GridDataFormats>=0.4.0', 'mmtf-python>=1.0.0', 'joblib>=0.12', diff --git a/package/setup.py b/package/setup.py index c44b7f64c8d..ccc846b38ad 100755 --- a/package/setup.py +++ b/package/setup.py @@ -65,7 +65,7 @@ from subprocess import getoutput # NOTE: keep in sync with MDAnalysis.__version__ in version.py -RELEASE = "2.7.0" +RELEASE = "2.8.0-dev0" is_release = 'dev' not in RELEASE diff --git a/testsuite/MDAnalysisTests/__init__.py b/testsuite/MDAnalysisTests/__init__.py index e9cf6107e33..942033e167f 100644 --- a/testsuite/MDAnalysisTests/__init__.py +++ b/testsuite/MDAnalysisTests/__init__.py @@ -97,7 +97,7 @@ logger = logging.getLogger("MDAnalysisTests.__init__") # keep in sync with RELEASE in setup.py -__version__ = "2.7.0" +__version__ = "2.8.0-dev0" # Do NOT import MDAnalysis at this level. Tests should do it themselves. diff --git a/testsuite/setup.py b/testsuite/setup.py index 171527bd9c9..7e40bcbe96a 100755 --- a/testsuite/setup.py +++ b/testsuite/setup.py @@ -87,7 +87,7 @@ def run(self): if __name__ == '__main__': # this must be in-sync with MDAnalysis - RELEASE = "2.7.0" + RELEASE = "2.8.0-dev0" with open("README") as summary: LONG_DESCRIPTION = summary.read() From a1c2615d761b5bc9eee78239f2dafd957773c027 Mon Sep 17 00:00:00 2001 From: Irfan Alibay Date: Wed, 27 Dec 2023 00:03:53 +0000 Subject: [PATCH 24/26] Update CHANGELOG (#4395) Start 2.8.0 changelog --- package/CHANGELOG | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/package/CHANGELOG b/package/CHANGELOG index 6b5ce608c20..815bd248ab8 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -14,9 +14,22 @@ The rules for this file: ------------------------------------------------------------------------------- -??/??/?? IAlibay, ianmkenney, PicoCentauri, pgbarletta, p-j-smith, - richardjgowers, lilyminium, ALescoulie, hmacdope, HeetVekariya, - ljwoods2, JoStoe, jennaswa +??/??/?? IAlibay + + * 2.8.0 + +Fixes + +Enhancements + +Changes + +Deprecations + + +12/26/23 IAlibay, ianmkenney, PicoCentauri, pgbarletta, p-j-smith, + richardjgowers, lilyminium, ALescoulie, hmacdope, HeetVekariya, + JoStoe, jennaswa, ljwoods2 * 2.7.0 From 72dd101d329b3249c18b0a6e87b4e882fdbd780f Mon Sep 17 00:00:00 2001 From: Irfan Alibay Date: Wed, 27 Dec 2023 00:09:36 +0000 Subject: [PATCH 25/26] Fix deploy action (#4396) * Fix deploy action, using the correct version number for the pypi upload method. --- .github/workflows/deploy.yaml | 4 ++-- package/CHANGELOG | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index ce3d55cd5e0..dda5b67e78f 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -200,7 +200,7 @@ jobs: mv dist/MDAnalysisTests-* testsuite/dist - name: upload_source_and_wheels - uses: pypa/gh-action-pypi-publish@v1.18.10 + uses: pypa/gh-action-pypi-publish@v1.8.10 upload_pypi_mdanalysistests: if: | @@ -226,7 +226,7 @@ jobs: mv dist/MDAnalysisTests-* testsuite/dist - name: upload_tests - uses: pypa/gh-action-pypi-publish@v1.18.10 + uses: pypa/gh-action-pypi-publish@v1.8.10 with: packages_dir: testsuite/dist diff --git a/package/CHANGELOG b/package/CHANGELOG index 815bd248ab8..ddce761bee0 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -19,6 +19,7 @@ The rules for this file: * 2.8.0 Fixes + * Fix deploy action to use the correct version of the pypi upload action. Enhancements From 471e2e7bcea9b71859688acd08d484f5a6416b85 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Thu, 28 Dec 2023 20:40:49 -0700 Subject: [PATCH 26/26] Updated CHANGELOG --- package/CHANGELOG | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/CHANGELOG b/package/CHANGELOG index ddce761bee0..3dea5da49db 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -14,12 +14,13 @@ The rules for this file: ------------------------------------------------------------------------------- -??/??/?? IAlibay +??/??/?? IAlibay, ljwoods2 * 2.8.0 Fixes * Fix deploy action to use the correct version of the pypi upload action. + * Fix groups.py doctests using sphinx directives (Issue #3925, PR #4374) Enhancements @@ -49,7 +50,6 @@ Fixes * Fix atom charge reading in PDBQT parser (Issue #4282, PR #4283) * Fix doctests failing from separated blocks of imports and execution and incorrectly formatted test output (Issue #3925, PR #4366) - * Fix groups.py doctests using sphinx directives (Issue #3925, PR #4374) Enhancements * Added a reader for GROMOS11 TRC trajectories (PR #4292 , Issue #4291)