Repository navigation
GROMACS 2020-2024 patches: follow-up of #1505 (GPU buffer operations with 2020-2023, constraint virial with MTS, messages and CHANGES) - #1508
Merged
carlocamilloni merged 3 commits intoOct 15, 2026
Conversation
…t runs after do_force() In GROMACS 2020-2023, do_force() sets up the domain workload on the pair-search steps, and it read plumedswitch, which md.cpp sets to 0 while PLUMED runs after do_force() (on the virial and energy steps, and in the HREX energy evaluation). Step 0 is always such a step, so with GPU force buffer operations PLUMED's forces could still be lost until the next pair search, or in the whole run when every pair-search step computes the virial. A flag that is never switched off, plumedIsUsed, now decides it. GROMACS 2024 sets up the workload in md.cpp, before the switch, and was already right. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…normal force buffer On the slow MTS steps when PLUMED runs after do_force() (the virial and energy steps), it applies its forces to the combined MTS buffer, which the update uses. GROMACS computes the constraint virial from the normal buffer (and writes it to the trajectory), which then lacked the part of PLUMED's forces that the constraints pass on: e.g. 2.7, -0.5 and 3.8 kJ/mol on the virial of a restraint between two water oxygens, against the GROMACS pull code. The difference PLUMED made to the combined buffer is now added to the normal one too. With a bias on ENERGY the slow forces in the normal buffer are then rescaled as in the combined one, which only affects the constraint virial, not the dynamics. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ions to CHANGES - The error for shells also fires with flexible constraints, which use the same relaxation: say so. The error for thread-MPI suggests -ntmpi 1. - The forces on virtual sites are spread whenever PLUMED runs after do_force(), not only in the energy path. - CHANGES: the virial was counted twice also with the patches for GROMACS older than 2019; after a stop request, mdrun runs one more step after the next communication of signals, which between simulations happens every 200 steps or more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 15, 2026
Regression tests for GROMACS, and GROMACS 2024, 2025 and 2026
plumed-testcenter/plumed-testcenter#95
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up of #1505, which was merged while I was still running a last review. That review found two more bugs, one of them in a fix of #1505, plus some messages and CHANGES entries to correct. #1509 is the follow-up for v2.10; both can reach master with the merges of v2.10, as #1505 and #1506 did.
GPU force buffer operations, GROMACS 2020-2023 (the fix of #1505 did not work there)
#1505 made PLUMED count as force work on the CPU, through
plumedswitch. In GROMACS 2020-2023,do_force()sets up that workload itself on the pair-search steps. Butmd.cppsetsplumedswitchto 0 while PLUMED runs afterdo_force(), which happens on the virial and energy steps. Step 0 is always both, so PLUMED's forces were still lost with GPU buffer ops, at least until the next pair search: in the whole run when every pair search is on a virial step, e.g. with the nstlist that mdrun picks on the GPU. A flag that is never switched off,plumedIsUsed, now decides it. GROMACS 2024 sets up the workload inmd.cpp, before the switch, so it was already right.Constraint virial with multiple time stepping, GROMACS 2021-2024
On the slow MTS steps when PLUMED runs after
do_force(), it applies its forces to the combined MTS buffer, which the update uses. GROMACS computes the constraint virial from the normal buffer, and writes that one to the trajectory. So the constraint virial lacked the part of PLUMED's forces that the constraints pass on to the other atoms. The difference PLUMED made to the combined buffer is now added to the normal one too. With a bias on ENERGY, the slow forces in the normal buffer are then rescaled as in the combined one; this affects only the constraint virial, not the dynamics.Messages, a comment and CHANGES
-ntmpi 1.do_force().Target release
I would like my code to appear in release v2.9
Type of contribution
Copyright
COPYRIGHTfile with the correct license information. Code should be released under an open source license. I also used the commandcd src && ./header.sh mymodulenamein order to make sure the headers of the module are correct.Tests
With the regression tests of plumed-testcenter/plumed-testcenter#95, which now also check the virial at step 0 within 0.1 kJ/mol and the forces with MTS:
pull-mtsfails for 2021.7-2024.3 (5.2 kJ/mol).🤖 Generated with Claude Code