Skip to content

Commit b768d02

Browse files
authored
Merge branch 'develop' into develop
2 parents a3e778d + 35d9d2e commit b768d02

File tree

5 files changed

+41
-26
lines changed

5 files changed

+41
-26
lines changed

package/AUTHORS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ Chronological list of authors
249249
2025
250250
- Joshua Raphael Uy
251251
- Namir Oues
252-
- BHM-Bob G
252+
- Lexi Xu
253+
- BHM-Bob G
253254

254255
External code
255256
-------------

package/CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The rules for this file:
1414

1515

1616
-------------------------------------------------------------------------------
17-
??/??/?? IAlibay, BHM-Bob G
17+
??/??/?? IAlibay, orbeckst, BHM-Bob
1818

1919

2020
* 2.10.0

package/MDAnalysis/lib/distances.py

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@
4848
4949
"OpenMP" :mod:`c_distances_openmp` parallel implementation in C/Cython
5050
with OpenMP
51-
"distopia" `_distopia` SIMD-accelerated implementation
51+
52+
"distopia" `_distopia` SIMD-accelerated implementation
53+
with the `distopia`_ library
5254
========== ========================= ======================================
5355
56+
5457
Use of the distopia library
5558
---------------------------
5659
@@ -65,25 +68,27 @@
6568
.. table:: Functions available using the `distopia`_ backend.
6669
:align: center
6770
68-
+-----------------------------------------------+
69-
| Functions |
70-
+===============================================+
71-
| MDAnalysis.lib.distances.calc_bonds |
72-
+-----------------------------------------------+
73-
| MDAnalysis.lib.distances.calc_angles |
74-
+-----------------------------------------------+
75-
| MDAnalysis.lib.distances.calc_dihedrals |
76-
+-----------------------------------------------+
77-
| MDAnalysis.lib.distances.distance_array |
78-
+-----------------------------------------------+
79-
| MDAnalysis.lib.distances.self_distance_array |
80-
+-----------------------------------------------+
71+
+-------------------------------------------------------+
72+
| Functions |
73+
+=======================================================+
74+
| :func:`MDAnalysis.lib.distances.calc_bonds` |
75+
+-------------------------------------------------------+
76+
| :func:`MDAnalysis.lib.distances.calc_angles` |
77+
+-------------------------------------------------------+
78+
| :func:`MDAnalysis.lib.distances.calc_dihedrals` |
79+
+-------------------------------------------------------+
80+
| :func:`MDAnalysis.lib.distances.distance_array` |
81+
+-------------------------------------------------------+
82+
| :func:`MDAnalysis.lib.distances.self_distance_array` |
83+
+-------------------------------------------------------+
8184
8285
If `distopia`_ is installed, the functions in this table will accept the key
83-
'distopia' for the `backend` keyword argument. If the distopia backend is
84-
selected the `distopia` library will be used to calculate the distances. Note
85-
that for functions listed in this table **distopia is not the default backend
86-
and must be selected.**
86+
'distopia' for the `backend` keyword argument. The variable
87+
:data:`HAS_DISTOPIA` is set to ``True`` if distopia is available.
88+
89+
If the distopia backend is selected the `distopia` library will be used to
90+
calculate the distances. Note that for functions listed in this table
91+
**distopia is not the default backend and must be explicitly selected.**
8792
8893
8994
.. Note::
@@ -109,6 +114,14 @@
109114
.. versionchanged:: 2.9.0
110115
Distopia support greatly expanded (with distopia ≥ 0.4.0).
111116
117+
Constants
118+
---------
119+
.. data:: HAS_DISTOPIA
120+
121+
This variable is ``True`` if the :mod:`distopia` package has been
122+
installed and is available as a `backend`. Otherwise it is
123+
``False``.
124+
112125
Functions
113126
---------
114127
.. autofunction:: distance_array
@@ -124,6 +137,7 @@
124137
.. autofunction:: augment_coordinates(coordinates, box, r)
125138
.. autofunction:: undo_augment(results, translation, nreal)
126139
.. autofunction:: minimize_vectors(vectors, box)
140+
127141
"""
128142
import numpy as np
129143
import numpy.typing as npt

testsuite/MDAnalysisTests/lib/test_distances.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,7 @@ def test_input_unchanged_transform_RtoS_and_StoR(
19731973
res = distances.transform_RtoS(crd, box, backend=backend)
19741974
assert_equal(crd, ref)
19751975
crd = res
1976-
ref = crd.copy()
1976+
np.copyto(ref, crd)
19771977
res = distances.transform_StoR(crd, box, backend=backend)
19781978
assert_equal(crd, ref)
19791979

testsuite/MDAnalysisTests/transformations/test_positionaveraging.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_posavging_fwd(posaveraging_universes):
4545
)
4646
avgd = np.empty(size)
4747
for ts in posaveraging_universes.trajectory:
48-
avgd[..., ts.frame] = ts.positions.copy()
48+
np.copyto(avgd[..., ts.frame], ts.positions)
4949

5050
assert_array_almost_equal(ref_matrix_fwd, avgd[1, :, -1], decimal=5)
5151

@@ -63,7 +63,7 @@ def test_posavging_bwd(posaveraging_universes):
6363
)
6464
back_avgd = np.empty(size)
6565
for ts in posaveraging_universes.trajectory[::-1]:
66-
back_avgd[..., 9 - ts.frame] = ts.positions.copy()
66+
np.copyto(back_avgd[..., 9 - ts.frame], ts.positions)
6767
assert_array_almost_equal(ref_matrix_bwd, back_avgd[1, :, -1], decimal=5)
6868

6969

@@ -78,7 +78,7 @@ def test_posavging_reset(posaveraging_universes):
7878
)
7979
avgd = np.empty(size)
8080
for ts in posaveraging_universes.trajectory:
81-
avgd[..., ts.frame] = ts.positions.copy()
81+
np.copyto(avgd[..., ts.frame], ts.positions)
8282
after_reset = ts.positions.copy()
8383
assert_array_almost_equal(avgd[..., 0], after_reset, decimal=5)
8484

@@ -99,7 +99,7 @@ def test_posavging_specific(posaveraging_universes):
9999
specr_avgd = np.empty(size)
100100
idx = 0
101101
for ts in posaveraging_universes.trajectory[fr_list]:
102-
specr_avgd[..., idx] = ts.positions.copy()
102+
np.copyto(specr_avgd[..., idx], ts.positions)
103103
idx += 1
104104
assert_array_almost_equal(
105105
ref_matrix_specr, specr_avgd[1, :, -1], decimal=5
@@ -122,7 +122,7 @@ def test_posavging_specific_noreset(posaveraging_universes_noreset):
122122
specr_avgd = np.empty(size)
123123
idx = 0
124124
for ts in posaveraging_universes_noreset.trajectory[fr_list]:
125-
specr_avgd[..., idx] = ts.positions.copy()
125+
np.copyto(specr_avgd[..., idx], ts.positions)
126126
idx += 1
127127
assert_array_almost_equal(
128128
ref_matrix_specr, specr_avgd[1, :, -1], decimal=5

0 commit comments

Comments
 (0)