Skip to content

Commit

Permalink
deprecate bond guessing
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyminium committed Oct 20, 2024
1 parent 101008b commit 9914b98
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ Changes
numpy.testing.assert_allclose #4438)

Deprecations
* The `guess_bonds`, `vdwradii`, `fudge_factor`, and `lower_bound` kwargs
are deprecated for Universe creation.
* Unknown masses are set to 0.0 for current version, this will be depracated
in version 3.0.0 and replaced by :class:`Masses`' no_value_label attribute(np.nan)
(PR #3753)
Expand Down
11 changes: 11 additions & 0 deletions package/MDAnalysis/core/universe.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,17 @@ def __init__(self, topology=None, *coordinates, all_coordinates=False,
self._trajectory.add_transformations(*transformations)

if guess_bonds:
warnings.warn(
"Bond guessing through the `guess_bonds` keyword is deprecated "
"and will be removed in MDAnalysis 3.0. "
"Instead, pass 'bonds', 'angles', and 'dihedrals' to "
"the `to_guess` keyword in Universe for guessing these. "
"The kwargs `fudge_factor`, `vdwradii`, and `lower_bound` "
"are also deprecated and will be removed in MDAnalysis 3.0, "
"where they should be passed into Context creation "
"or guess_TopologyAttrs instead.",
DeprecationWarning
)
force_guess = list(force_guess) + ['bonds', 'angles', 'dihedrals']

self.guess_TopologyAttrs(
Expand Down
5 changes: 5 additions & 0 deletions testsuite/MDAnalysisTests/guesser/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,8 @@ def test_partial_guess_attr_with_unknown_no_value_label(self):
top = Topology(4, 1, 1, attrs=[names, types, ])
u = mda.Universe(top, to_guess=['types'])
assert_equal(u.atoms.types, ['', '', '', ''])


def test_Universe_guess_bonds_deprecated():
with pytest.warns(DeprecationWarning, match='`guess_bonds` keyword is deprecated'):
u = mda.Universe(datafiles.PDB_full, guess_bonds=True)

0 comments on commit 9914b98

Please sign in to comment.