Skip to content

Commit a4c6bb1

Browse files
authored
Merge branch 'develop' into feat/3341-add-crysin-support
2 parents edfa9c3 + 4c12f15 commit a4c6bb1

15 files changed

Lines changed: 128 additions & 26 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@ Changes made in this Pull Request:
88
<!-- Describe the changes that this PR makes. If applicable, use the following bullet list. -->
99
-
1010

11+
## LLM / AI generated code disclosure
12+
<!-- Please update this disclosure to reflect if you did or did not use LLMs / AI to generate code -->
13+
LLMs or other AI-powered tools (beyond simple IDE use cases) were used in this contribution: yes / no
14+
1115
## PR Checklist
1216
<!-- Please use the following checklist to ensure the PR is ready to be reviewed/merged. -->
1317
- [ ] Issue raised/referenced?
1418
- [ ] Tests updated/added?
1519
- [ ] Documentation updated/added?
1620
- [ ] `package/CHANGELOG` file updated?
1721
- [ ] Is your name in `package/AUTHORS`? (If it is not, add it!)
22+
- [ ] LLM/AI disclosure was updated.
1823

1924
## Developers Certificate of Origin
2025
<!--

.github/workflows/deploy.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ jobs:
3838
matrix:
3939
buildplat:
4040
- [ubuntu-22.04, manylinux_x86_64, x86_64]
41-
- [macos-13, macosx_*, x86_64]
4241
- [windows-2022, win_amd64, AMD64]
4342
- [macos-14, macosx_*, arm64]
4443
python: ["cp311", "cp312", "cp313", "cp314"]

.github/workflows/gh-ci-cron.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140
strategy:
141141
fail-fast: false
142142
matrix:
143-
os: [ubuntu-22.04, macos-13]
143+
os: [ubuntu-22.04, macos-14]
144144

145145
steps:
146146
- uses: actions/checkout@v4

.github/workflows/linters.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ jobs:
9393
micromamba: true
9494
full-deps: true
9595
numpy: numpy=1.26.0
96-
rdkit: rdkit=2023.09.3
9796

9897
- name: install
9998
run: |

package/CHANGELOG

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@ The rules for this file:
1515

1616
-------------------------------------------------------------------------------
1717
??/??/?? IAlibay, orbeckst, marinegor, tylerjereddy, ljwoods2, marinegor,
18-
spyke7, talagayev
18+
spyke7, talagayev, tanii1125, BradyAJohnston
1919

2020
* 2.11.0
2121

2222
Fixes
23+
* HydrogenBondAnalysis: Fixed `count_by_time()` when using `run(FrameIterator)` that
24+
results in `self.start` and `self.end` being None (Issue #5200, PR #5202)
25+
* NoJump shows a more informative message and fails when applied
26+
outside of the first frame (Issue #4915, PR #5201)
27+
* DSSP now explicitly checks for a minimum of 6 residues and raises a clear
28+
error message, unlike the previous behavior where it would fail with an
29+
incomprehensible broadcasting error at execution time (Issue #5046, PR #5163)
2330
* Fixes the verbose=False in EinsteinMSD, and only shows progress bar when
2431
verbose=True (Issue #5144, PR #5153)
2532
* Fix incorrect assignment of topology_format to format (and vice versa)

package/MDAnalysis/analysis/dssp/dssp.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class DSSP(AnalysisBase):
210210
Parameters
211211
----------
212212
atoms : Union[Universe, AtomGroup]
213-
input Universe or AtomGroup. In both cases, only protein residues will
213+
input Universe or AtomGroup with at least 6 protein residues. In both cases, only protein residues will
214214
be chosen prior to the analysis via `select_atoms('protein')`.
215215
Heavy atoms of the protein are then selected by name
216216
`heavyatom_names`, and hydrogens are selected by name
@@ -239,6 +239,8 @@ class DSSP(AnalysisBase):
239239
240240
Raises
241241
------
242+
ValueError
243+
If fewer than 6 residues are provided in the selection.
242244
ValueError
243245
if ``guess_hydrogens`` is True but some non-PRO hydrogens are missing.
244246
@@ -357,6 +359,12 @@ def __init__(
357359
)
358360
)
359361

362+
if len(ag.residues) < 6:
363+
raise ValueError(
364+
"DSSP requires at least 6 residues for secondary structure analysis, "
365+
f"but only {len(ag.residues)} residue(s) were provided in the selection."
366+
)
367+
360368
def _prepare(self):
361369
self.results.dssp_ndarray = []
362370

package/MDAnalysis/analysis/hydrogenbonds/hbond_analysis.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -911,17 +911,13 @@ def count_by_time(self):
911911
Can be used along with :attr:`HydrogenBondAnalysis.times` to plot
912912
the number of hydrogen bonds over time.
913913
"""
914+
hbond_frames = self.results.hbonds[:, 0].astype(int)
915+
frame_unique, frame_counts = np.unique(hbond_frames, return_counts=True)
916+
frame_min, frame_max = self.frames.min(), self.frames.max()
914917

915-
indices, tmp_counts = np.unique(self.results.hbonds[:, 0], axis=0,
916-
return_counts=True)
917-
918-
indices -= self.start
919-
indices /= self.step
920-
921-
counts = np.zeros_like(self.frames)
922-
counts[indices.astype(np.intp)] = tmp_counts
923-
924-
return counts
918+
counts = np.zeros(frame_max - frame_min + 1, dtype=int)
919+
counts[frame_unique - frame_min] = frame_counts
920+
return counts[self.frames - frame_min]
925921

926922
def count_by_type(self):
927923
"""Counts the total number of each unique type of hydrogen bond.

package/MDAnalysis/analysis/msd.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,34 @@
7070
7171
In MDAnalysis you can use the
7272
:class:`~MDAnalysis.transformations.nojump.NoJump`
73-
transformation.
73+
transformation to unwrap coordinates on-the-fly.
74+
75+
A minimal example:
76+
77+
.. code-block:: python
78+
79+
import MDAnalysis as mda
80+
from MDAnalysis.transformations import NoJump
81+
82+
u = mda.Universe(TOP, TRAJ)
83+
84+
# Apply NoJump transformation to unwrap coordinates
85+
u.trajectory.add_transformations(NoJump(u))
86+
87+
# Now the trajectory is unwrapped and MSD can be computed normally:
88+
from MDAnalysis.analysis.msd import EinsteinMSD
89+
MSD = EinsteinMSD(u, select="all", msd_type="xyz")
90+
MSD.run()
91+
92+
This example assumes that the trajectory contains periodic box
93+
dimensions. If no periodic boundary information is present, box
94+
dimensions must be defined before applying ``NoJump``, which can
95+
be accomplished by applying the
96+
:class:`~MDAnalysis.transformations.boxdimensions.set_dimensions`
97+
transformation *before* the
98+
:class:`~MDAnalysis.transformations.nojump.NoJump` transformation.
99+
100+
This replaces the need to preprocess trajectories externally.
74101
75102
In GROMACS, for example, this can be done using `gmx trjconv`_ with the
76103
``-pbc nojump`` flag.
@@ -382,14 +409,11 @@ def _parse_msd_type(self):
382409
"xyz": [0, 1, 2],
383410
}
384411

385-
self.msd_type = self.msd_type.lower()
386-
387412
try:
388-
self._dim = keys[self.msd_type]
389-
except KeyError:
413+
self._dim = keys[self.msd_type.lower()]
414+
except (AttributeError, KeyError):
390415
raise ValueError(
391-
"invalid msd_type: {} specified, please specify one of xyz, "
392-
"xy, xz, yz, x, y, z".format(self.msd_type)
416+
f"Invalid msd_type {self.msd_type}, must be a string and one of: xyz, xy, xz, yz, x, y, z"
393417
)
394418

395419
self.dim_fac = len(self._dim)

package/MDAnalysis/analysis/rms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def rmsd(a, b, weights=None, center=False, superposition=False):
244244
>>> _ = u.trajectory[-1] # forward to last frame
245245
>>> B = bb.positions.copy() # coordinates of last frame
246246
>>> rmsd(A, B, center=True)
247-
6.838544558398293
247+
np.float64(6.838544558398293)
248248
249249
250250
.. versionchanged:: 0.8.1

package/MDAnalysis/lib/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
import errno
203203
import functools
204204
import gzip
205-
import importlib
205+
import importlib.util
206206
import inspect
207207
import io
208208
import itertools

0 commit comments

Comments
 (0)