Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ The rules for this file:

-------------------------------------------------------------------------------
??/??/?? IAlibay, ChiahsinChu, RMeli, tanishy7777, talagayev, tylerjereddy,
marinegor, hmacdope, jauy123
marinegor, hmacdope, jauy123, al42and

* 2.9.0

Fixes
* Add support for TPR files produced by GROMACS 2024.4
* Add support for TPR files produced by GROMACS 2024.4 and GROMACS 2025.0
* Fixes invalid default unit from Angstrom to Angstrom^{-3} for convert_density() function. (Issue #4829)
* Fixes deprecation warning Array to scalar convertion. Replaced atan2() with np.arctan2() (Issue #4339)
* Replaced mutable defaults with None and initialized them within
Expand Down
1 change: 1 addition & 0 deletions package/MDAnalysis/topology/TPRParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
129 28 2023 yes
133 28 2024.1 yes
134 28 2024.4 yes
137 28 2025.0 yes
========== ============== ==================== =====

.. [*] Files generated by the beta versions of Gromacs 2020 are NOT supported.
Expand Down
6 changes: 4 additions & 2 deletions package/MDAnalysis/topology/tpr/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
129,
133,
134,
137,
)

# Some constants
Expand Down Expand Up @@ -94,12 +95,12 @@
F_DIHRESVIOL, F_CONSTR, F_CONSTRNC, F_SETTLE, F_VSITE1,
F_VSITE2, F_VSITE2FD, F_VSITE3, F_VSITE3FD, F_VSITE3FAD,
F_VSITE3OUT, F_VSITE4FD, F_VSITE4FDN, F_VSITEN,
F_COM_PULL, F_DENSITYFITTING, F_EQM, F_EPOT, F_EKIN,
F_COM_PULL, F_DENSITYFITTING, F_EQM, F_ENNPOT, F_EPOT, F_EKIN,
F_ETOT, F_ECONSERVED, F_TEMP, F_VTEMP_NOLONGERUSED,
F_PDISPCORR, F_PRES, F_DHDL_CON, F_DVDL,
F_DKDL, F_DVDL_COUL, F_DVDL_VDW, F_DVDL_BONDED,
F_DVDL_RESTRAINT, F_DVDL_TEMPERATURE, F_NRE
) = list(range(95))
) = list(range(96))
# fmt: on

#: Function types from ``<gromacs_dir>/src/gmxlib/tpxio.c``
Expand Down Expand Up @@ -127,6 +128,7 @@
(tpxv_GenericInternalParameters, F_DENSITYFITTING),
(tpxv_VSite1, F_VSITE1),
(tpxv_VSite2FD, F_VSITE2FD),
(137, F_ENNPOT),
]
# fmt: on

Expand Down
4 changes: 4 additions & 0 deletions package/MDAnalysis/topology/tpr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ def do_iparams(data, functypes, fver):
elif i in [setting.F_CMAP]:
data.unpack_int() # cmap.cmapA
data.unpack_int() # cmap.cmapB
elif i in [setting.F_ENNPOT]:
# TODO: handle the new neural network potentials
# supported from GROMACS 2025.0
pass
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this and other new v2025.0 bells and whistles, cc @al42and for possible generation of new test files that have the new bells and whistles.

I don't now if we really need a new test file with i.e., the new PyTorch potential handling + reference coordinate scaling with multiple centers of mass + init-histogram-counts to enable continuation of expanded ensemble runs.

Probably would be good to have eventually, if only to make sure we don't need to skip over any other bits of information when "seeking" through the file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we think there are attributes we will be missing if we're not properly parsing the NN potential things? i.e. what I'm asking is if we need a warning here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this and other new v2025.0 bells and whistles, cc @al42and for possible generation of new test files that have the new bells and whistles.

I can make a TPR with a bunch of things turned on, but there are issues if we want to stick with existing test sets:

  • 2lyz: they only have TPR, which is neither editable nor "decompilable" into parts; can't change settings there (and looks like the original receipt is lost in time, since the new are just converted from the old ones, per 336ff1d).
  • bonded/dummy: currently, for NN, we need something with "physical" element names.

If that's ok, I can create a new TPR roughly based on GROMACS's own tests.
Reconstructing 2lyz and making a test based on it is doable, but I'd rather avoid that as long as you're ok with adding a new test system.

else:
raise NotImplementedError(f"unknown functype: {i}")
return
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
11 changes: 11 additions & 0 deletions testsuite/MDAnalysisTests/datafiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
"TPR2023",
"TPR2024",
"TPR2024_4",
"TPR2025_0",
"TPR510_bonded",
"TPR2016_bonded",
"TPR2018_bonded",
Expand All @@ -147,6 +148,7 @@
"TPR2023_bonded",
"TPR2024_bonded",
"TPR2024_4_bonded",
"TPR2025_0_bonded",
"TPR_EXTRA_2021",
"TPR_EXTRA_2020",
"TPR_EXTRA_2018",
Expand All @@ -156,6 +158,8 @@
"TPR_EXTRA_2023",
"TPR_EXTRA_2024",
"TPR_EXTRA_2024_4",
"TPR_EXTRA_2025_0",
"TPR_NNPOT_2025_0",
"PDB_sub_sol",
"PDB_sub_dry", # TRRReader sub selection
"TRR_sub_sol",
Expand Down Expand Up @@ -553,6 +557,7 @@
TPR2023 = (_data_ref / "tprs/2lyz_gmx_2023.tpr").as_posix()
TPR2024 = (_data_ref / "tprs/2lyz_gmx_2024.tpr").as_posix()
TPR2024_4 = (_data_ref / "tprs/2lyz_gmx_2024_4.tpr").as_posix()
TPR2025_0 = (_data_ref / "tprs/2lyz_gmx_2025_0.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 Expand Up @@ -584,7 +589,11 @@
TPR2023_bonded = (_data_ref / "tprs/all_bonded/dummy_2023.tpr").as_posix()
TPR2024_bonded = (_data_ref / "tprs/all_bonded/dummy_2024.tpr").as_posix()
TPR2024_4_bonded = (_data_ref / "tprs/all_bonded/dummy_2024_4.tpr").as_posix()
TPR2025_0_bonded = (_data_ref / "tprs/all_bonded/dummy_2025_0.tpr").as_posix()
# all interactions
TPR_EXTRA_2025_0 = (
_data_ref / "tprs/virtual_sites/extra-interactions-2025_0.tpr"
).as_posix()
TPR_EXTRA_2024_4 = (
_data_ref / "tprs/virtual_sites/extra-interactions-2024_4.tpr"
).as_posix()
Expand Down Expand Up @@ -612,6 +621,8 @@
TPR_EXTRA_407 = (
_data_ref / "tprs/virtual_sites/extra-interactions-4.0.7.tpr"
).as_posix()
# ALA dipeptide with neural network potential and a few other options
TPR_NNPOT_2025_0 = (_data_ref / "tprs/ala_nnpot_gmx_2025_0.tpr").as_posix()

XYZ_psf = (_data_ref / "2r9r-1b.psf").as_posix()
XYZ_bz2 = (_data_ref / "2r9r-1b.xyz.bz2").as_posix()
Expand Down
35 changes: 32 additions & 3 deletions testsuite/MDAnalysisTests/topology/test_tprparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
TPR2016, TPR2018, TPR2019B3, TPR2020,
TPR2020B2, TPR2021, TPR2022RC1,
TPR2023, TPR2024, TPR2024_4,
TPR2025_0,
TPR_EXTRA_407, TPR_EXTRA_2016,
TPR_EXTRA_2018, TPR_EXTRA_2020,
TPR_EXTRA_2021, TPR_EXTRA_2022RC1,
TPR_EXTRA_2023, TPR_EXTRA_2024,
TPR_EXTRA_2024_4, XTC, TPR334_bonded,
TPR_EXTRA_2025_0,
TPR455Double, TPR510_bonded,
TPR2016_bonded, TPR2018_bonded,
TPR2019B3_bonded, TPR2020_bonded,
Expand All @@ -47,7 +49,8 @@
TPR2021_bonded, TPR2021_double_bonded,
TPR2021Double, TPR2022RC1_bonded,
TPR2023_bonded, TPR2024_4_bonded,
TPR2024_bonded)
TPR2025_0_bonded, TPR2024_bonded,
TPR_NNPOT_2025_0)
from numpy.testing import assert_equal

# fmt: on
Expand All @@ -66,6 +69,8 @@
TPR2023_bonded,
TPR2024_bonded,
TPR2024_4_bonded,
TPR2025_0_bonded,
TPR_EXTRA_2025_0,
TPR_EXTRA_2024_4,
TPR_EXTRA_2024,
TPR_EXTRA_2023,
Expand Down Expand Up @@ -148,7 +153,8 @@ class TestTPRGromacsVersions(TPRAttrs):
TPR400, TPR402, TPR403, TPR404, TPR405, TPR406, TPR407, TPR450,
TPR451, TPR452, TPR453, TPR454, TPR455, TPR502, TPR504, TPR505,
TPR510, TPR2016, TPR2018, TPR2019B3, TPR2020, TPR2020Double,
TPR2021, TPR2021Double, TPR2022RC1, TPR2023, TPR2024, TPR2024_4
TPR2021, TPR2021Double, TPR2022RC1, TPR2023, TPR2024, TPR2024_4,
TPR2025_0,
]
)
# fmt: on
Expand Down Expand Up @@ -206,6 +212,19 @@ def filename(self, request):
return request.param


class TestTPRNnpot(TPRAttrs):
expected_n_atoms = 23
expected_n_residues = 2
expected_n_segments = 1
ref_moltypes = np.array(["Protein_chain_A"] * 2, dtype=object)
ref_molnums = np.array([0] * 2)
ref_chainIDs = ["A"]

@pytest.fixture(params=[TPR_NNPOT_2025_0])
def filename(self, request):
return request.param


def _test_is_in_topology(name, elements, topology_path, topology_section):
"""
Test if an interaction appears as expected in the topology
Expand Down Expand Up @@ -315,7 +334,7 @@ def test_all_impropers(topology, impr):
@pytest.fixture(params=(
TPR400, TPR402, TPR403, TPR404, TPR405, TPR406, TPR407, TPR450,
TPR451, TPR452, TPR453, TPR454, TPR502, TPR504, TPR505, TPR510,
TPR2016, TPR2018, TPR2023, TPR2024, TPR2024_4,
TPR2016, TPR2018, TPR2023, TPR2024, TPR2024_4, TPR2025_0,
)
)
# fmt: on
Expand All @@ -338,6 +357,16 @@ def test_settle(bonds_water):
assert bonds_water[-1][1] == 2262


@pytest.mark.parametrize("tpr_path", [TPR_NNPOT_2025_0])
def test_ala2(tpr_path):
topology = MDAnalysis.topology.TPRParser.TPRParser(tpr_path).parse()
# Check that bonds etc are read correctly
assert len(topology.bonds.values) == 22 # 12 Bond + 10 Connect
assert len(topology.angles.values) == 21 # 21 Angle
assert len(topology.dihedrals.values) == 26 # 26 Proper Dih.
assert len(topology.impropers.values) == 1 # 1 Per. Imp. Dih.


@pytest.mark.parametrize(
"tpr_path, expected_exception",
(
Expand Down
Loading