From 5a992d7706cd7d280f6b9d36a4d4212d4bc88119 Mon Sep 17 00:00:00 2001 From: Heet Vekariya <91054457+HeetVekariya@users.noreply.github.com> Date: Wed, 31 Jan 2024 01:47:23 +0530 Subject: [PATCH 1/4] Feat: Add `n_initial_contacts` attribute and document ```Contacts``` class attributes (#4415) --- package/CHANGELOG | 2 ++ package/MDAnalysis/analysis/contacts.py | 10 ++++++++++ testsuite/MDAnalysisTests/analysis/test_contacts.py | 10 ++++++++++ 3 files changed, 22 insertions(+) diff --git a/package/CHANGELOG b/package/CHANGELOG index af64b815d1c..6370f7278ed 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -27,6 +27,8 @@ Fixes * Fix deploy action to use the correct version of the pypi upload action. Enhancements + * Documented the r0 attribute in the `Contacts` class and added the + `n_initial_contacts` attribute, with documentation. (Issue #2604, PR #4415) Changes * As per NEP29, the minimum version of numpy has been raised to 1.23. diff --git a/package/MDAnalysis/analysis/contacts.py b/package/MDAnalysis/analysis/contacts.py index c51f96d5222..7d6804f1a73 100644 --- a/package/MDAnalysis/analysis/contacts.py +++ b/package/MDAnalysis/analysis/contacts.py @@ -405,6 +405,13 @@ def __init__(self, u, select, refgroup, method="hard_cut", radius=4.5, Show detailed progress of the calculation if set to ``True``; the default is ``False``. + Attributes + ---------- + n_initial_contacts : int + Total number of initial contacts. + r0 : list[numpy.ndarray] + List of distance arrays between reference groups. + Notes ----- @@ -455,6 +462,9 @@ def __init__(self, u, select, refgroup, method="hard_cut", radius=4.5, box=self._get_box(refA.universe))) self.initial_contacts.append(contact_matrix(self.r0[-1], radius)) + self.n_initial_contacts = self.initial_contacts[0].sum() + + @staticmethod def _get_atomgroup(u, sel): select_error_message = ("selection must be either string or a " diff --git a/testsuite/MDAnalysisTests/analysis/test_contacts.py b/testsuite/MDAnalysisTests/analysis/test_contacts.py index b4fbbf45797..26c053ae32b 100644 --- a/testsuite/MDAnalysisTests/analysis/test_contacts.py +++ b/testsuite/MDAnalysisTests/analysis/test_contacts.py @@ -375,6 +375,16 @@ def test_warn_deprecated_attr(self, universe): with pytest.warns(DeprecationWarning, match=wmsg): assert_equal(CA1.timeseries, CA1.results.timeseries) + @pytest.mark.parametrize("datafiles, expected", [((PSF, DCD), 0), + ([TPR, XTC], 41814)]) + def test_n_initial_contacts(self, datafiles, expected): + """Test for n_initial_contacts attribute""" + u = mda.Universe(*datafiles) + select = ('protein', 'not protein') + refgroup = (u.select_atoms('protein'), u.select_atoms('not protein')) + + r = contacts.Contacts(u, select=select, refgroup=refgroup) + assert_equal(r.n_initial_contacts, expected) def test_q1q2(): u = mda.Universe(PSF, DCD) From 6ba76822ce0f0f250fc4a11c1340e39236b09019 Mon Sep 17 00:00:00 2001 From: Irfan Alibay Date: Tue, 30 Jan 2024 21:49:20 +0000 Subject: [PATCH 2/4] add 3.12 to cron runners (#4443) --- .github/workflows/gh-ci-cron.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gh-ci-cron.yaml b/.github/workflows/gh-ci-cron.yaml index 641a3b3e76c..20969ab80b6 100644 --- a/.github/workflows/gh-ci-cron.yaml +++ b/.github/workflows/gh-ci-cron.yaml @@ -224,7 +224,7 @@ jobs: fail-fast: false matrix: os: [ubuntu, macos] - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 @@ -270,7 +270,7 @@ jobs: fail-fast: false matrix: os: [ubuntu, macos, windows] - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] wheels: ['true', 'false'] steps: # Checkout to have access to local actions (i.e. setup-os) From dc34a08cc433850c43fabffe6bfe5eeebca2dc44 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Sun, 4 Feb 2024 17:04:28 +0100 Subject: [PATCH 3/4] Add new M1 macOS GitHub runner to CI (#4442) * Add macos-14 runners to CI --------- Co-authored-by: Irfan Alibay --- .github/actions/build-src/action.yaml | 4 ++-- .github/workflows/gh-ci-cron.yaml | 7 +++++-- .github/workflows/gh-ci.yaml | 7 ++++++- package/CHANGELOG | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/actions/build-src/action.yaml b/.github/actions/build-src/action.yaml index fa6885abd9c..8abab0f13e9 100644 --- a/.github/actions/build-src/action.yaml +++ b/.github/actions/build-src/action.yaml @@ -63,8 +63,8 @@ runs: which python which pip pip list - conda info - conda list + micromamba info + micromamba list - name: build_mda_main shell: bash -l {0} diff --git a/.github/workflows/gh-ci-cron.yaml b/.github/workflows/gh-ci-cron.yaml index 20969ab80b6..fdfbf58905e 100644 --- a/.github/workflows/gh-ci-cron.yaml +++ b/.github/workflows/gh-ci-cron.yaml @@ -264,14 +264,17 @@ jobs: pypi-latest-release: # A set of runner to check that the latest conda release works as expected if: "github.repository == 'MDAnalysis/mdanalysis'" - runs-on: ${{ matrix.os }}-latest + runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: fail-fast: false matrix: - os: [ubuntu, macos, windows] + os: [ubuntu-latest, macos-latest, macos-14, windows-latest] python-version: ["3.9", "3.10", "3.11", "3.12"] wheels: ['true', 'false'] + exclude: + - os: "macos-14" + python-version: "3.9" steps: # Checkout to have access to local actions (i.e. setup-os) - uses: actions/checkout@v4 diff --git a/.github/workflows/gh-ci.yaml b/.github/workflows/gh-ci.yaml index d4878849680..13fdfc743c7 100644 --- a/.github/workflows/gh-ci.yaml +++ b/.github/workflows/gh-ci.yaml @@ -34,9 +34,14 @@ jobs: include: - name: macOS_monterey_py311 os: macOS-12 - python-version: "3.11" + python-version: "3.12" full-deps: true codecov: true + - name: macOS_14_arm64_py312 + os: macOS-14 + python-version: "3.12" + full-deps: false + codecov: true - name: numpy_min os: ubuntu-latest python-version: 3.9 diff --git a/package/CHANGELOG b/package/CHANGELOG index 6370f7278ed..d4ba2ca05e7 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -14,7 +14,7 @@ The rules for this file: ------------------------------------------------------------------------------- -??/??/?? IAlibay, HeetVekariya, marinegor, lilyminium +??/??/?? IAlibay, HeetVekariya, marinegor, lilyminium, RMeli * 2.8.0 From c4ffb7ed1d13d56f379c4d1b960256607f698502 Mon Sep 17 00:00:00 2001 From: Irfan Alibay Date: Sun, 4 Feb 2024 16:05:17 +0000 Subject: [PATCH 4/4] Adding arm64-osx to gh deploy action (#4445) * Adding arm64-osx to gh deploy action --- .github/workflows/deploy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index dda5b67e78f..8891b9c7e25 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -40,6 +40,7 @@ jobs: - [ubuntu-22.04, manylinux_x86_64, x86_64] - [macos-11, macosx_*, x86_64] - [windows-2019, win_amd64, AMD64] + - [macos-14, macosx_*, arm64] python: ["cp39", "cp310", "cp311", "cp312"] defaults: run: @@ -50,7 +51,7 @@ jobs: fetch-depth: 0 - name: Build wheels - uses: pypa/cibuildwheel@v2.16.2 + uses: pypa/cibuildwheel@v2.16.5 with: package-dir: package env: