-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add starrt of calc_bonds * refactor to use distopia inplace API * add in upcast * actually return the distances * distopia to ci * add initial docs * move to using _run backend * add upcast back in * fix yml CI files * change test_pairwise_dist to use allclose rather than equals * change another test to sue assert allclose * improve docs * change distance tests to use distopia backend * split numpy compliance test * changelog * fix merge issue in changelog * add note on varying precision to docs * Update testsuite/MDAnalysisTests/lib/test_distances.py Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com> * add warning for triclinic boxes * darker * add second importlib try block * return callable or ndarray * Revert "return callable or ndarray" This reverts commit 56e5091. * change docs on default * start of stub * Update package/MDAnalysis/lib/distances.py Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com> * add align * WIP on stub * finalise distopia stub * change calc_bonds to use distopia stub * fix type annotation * darker * darker distances.py * try to make black happier again * fix distances.py again * finally fix everything * fix versionchanged * remove try except * Update package/MDAnalysis/lib/distances.py Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com> * finalise merge --------- Co-authored-by: Hugo Macdermott <hugomacdermott@Hugos-MacBook-Air-2.local> Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com>
- Loading branch information
1 parent
94904b5
commit d27a32a
Showing
6 changed files
with
295 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; -*- | ||
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 | ||
# | ||
# MDAnalysis --- https://www.mdanalysis.org | ||
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors | ||
# (see the file AUTHORS for the full list of names) | ||
# | ||
# Released under the GNU Public Licence, v2 or any higher version | ||
# | ||
# Please cite your use of MDAnalysis in published work: | ||
# | ||
# R. J. Gowers, M. Linke, J. Barnoud, T. J. E. Reddy, M. N. Melo, S. L. Seyler, | ||
# D. L. Dotson, J. Domanski, S. Buchoux, I. M. Kenney, and O. Beckstein. | ||
# MDAnalysis: A Python package for the rapid analysis of molecular dynamics | ||
# simulations. In S. Benthall and S. Rostrup editors, Proceedings of the 15th | ||
# Python in Science Conference, pages 102-109, Austin, TX, 2016. SciPy. | ||
# doi: 10.25080/majora-629e541a-00e | ||
# | ||
# N. Michaud-Agrawal, E. J. Denning, T. B. Woolf, and O. Beckstein. | ||
# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. | ||
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 | ||
# | ||
|
||
"""Stub module for distopia --- :mod:`MDAnalysis.analysis.distopia` | ||
=================================================================== | ||
This module is a stub to provide distopia distance functions to `distances.py` | ||
as a selectable backend. | ||
""" | ||
|
||
# check for distopia | ||
try: | ||
import distopia | ||
except ImportError: | ||
HAS_DISTOPIA = False | ||
else: | ||
HAS_DISTOPIA = True | ||
|
||
from .c_distances import ( | ||
calc_bond_distance_triclinic as _calc_bond_distance_triclinic_serial, | ||
) | ||
import warnings | ||
import numpy as np | ||
|
||
|
||
def calc_bond_distance_ortho( | ||
coords1, coords2: np.ndarray, box: np.ndarray, results: np.ndarray | ||
) -> None: | ||
distopia.calc_bonds_ortho_float( | ||
coords1, coords2, box[:3], results=results | ||
) | ||
# upcast is currently required, change for 3.0, see #3927 | ||
|
||
|
||
def calc_bond_distance( | ||
coords1: np.ndarray, coords2: np.ndarray, results: np.ndarray | ||
) -> None: | ||
distopia.calc_bonds_no_box_float( | ||
coords1, coords2, results=results | ||
) | ||
# upcast is currently required, change for 3.0, see #3927 | ||
|
||
|
||
def calc_bond_distance_triclinic( | ||
coords1: np.ndarray, coords2: np.ndarray, box: np.ndarray, results: np.ndarray | ||
) -> None: | ||
# redirect to serial backend | ||
warnings.warn( | ||
"distopia does not support triclinic boxes, using serial backend instead." | ||
) | ||
_calc_bond_distance_triclinic_serial(coords1, coords2, box, results) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.