Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package/MDAnalysis/topology/tpr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ def do_moltype(data, symtab, fver):
bonds += list(ik_obj.process(ias))
elif ik_obj.name in ['ANGLES', 'G96ANGLES', 'CROSS_BOND_BOND',
'CROSS_BOND_ANGLE', 'UREY_BRADLEY', 'QANGLES',
'RESTRANGLES', 'TABANGLES']:
'RESTRANGLES', 'TABANGLES', 'LINEAR_ANGLES']:
angles += list(ik_obj.process(ias))
elif ik_obj.name in ['PDIHS', 'RBDIHS', 'RESTRDIHS', 'CBTDIHS',
'FOURDIHS', 'TABDIHS']:
Expand Down
10 changes: 10 additions & 0 deletions testsuite/MDAnalysisTests/coordinates/test_tpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
TPR2020B2,
INPCRD,
TPR_gh_5145,
TPR_linear_angle,
)
import MDAnalysis as mda

Expand All @@ -80,6 +81,15 @@
@pytest.mark.parametrize(
"tpr_file, exp_first_atom, exp_last_atom, exp_shape, exp_vel_first_atom, exp_vel_last_atom",
[
# see gh-5361 for CO2/linear angle:
(
TPR_linear_angle,
[1.250, 1.250, 1.250],
[1.250, 1.260, 1.136],
Comment thread
tylerjereddy marked this conversation as resolved.
(3, 3),
[0, 0, 0],
[0, 0, 0],
),
# this case is an alanine dipeptide
# with neural network potential active
# and nonzero velocities
Expand Down
Binary file not shown.
2 changes: 2 additions & 0 deletions testsuite/MDAnalysisTests/datafiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"TPR2024_4",
"TPR2025_0",
"TPR2026_0",
"TPR_linear_angle",
"TPR510_bonded",
"TPR2016_bonded",
"TPR2018_bonded",
Expand Down Expand Up @@ -574,6 +575,7 @@
TPR2024_4 = (_data_ref / "tprs/2lyz_gmx_2024_4.tpr").as_posix()
TPR2025_0 = (_data_ref / "tprs/2lyz_gmx_2025_0.tpr").as_posix()
TPR2026_0 = (_data_ref / "tprs/2lyz_gmx_2026_0.tpr").as_posix()
TPR_linear_angle = (_data_ref / "tprs/Linear_Angle.tpr").as_posix()
# double precision
TPR455Double = (_data_ref / "tprs/drew_gmx_4.5.5.double.tpr").as_posix()
TPR460 = (_data_ref / "tprs/ab42_gmx_4.6.tpr").as_posix()
Expand Down
12 changes: 11 additions & 1 deletion testsuite/MDAnalysisTests/topology/test_tprparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
TPR2023_bonded, TPR2024_4_bonded,
TPR2025_0_bonded, TPR2024_bonded,
TPR2026_0_bonded,
TPR_NNPOT_2025_0, TPR_NNPOT_2026_0)
TPR_NNPOT_2025_0, TPR_NNPOT_2026_0,
TPR_linear_angle)
from numpy.testing import assert_equal

# fmt: on
Expand Down Expand Up @@ -438,3 +439,12 @@ def test_resids(resid_from_one, resid_addition):
resids,
err_msg="tpr_resid_from_one kwarg not switching resids",
)


def test_gh_5361():
# GROMACS linear angle potential handling with CO2 example
u = mda.Universe(TPR_linear_angle)
actual = u.angles.to_indices()
expected = [[1, 0, 2]]
assert_equal(u.atoms.names, ["C", "O1", "O2"])
assert_equal(actual, expected)
Loading