Fix bug resetting mdatoms masses to lambda=0 state
authorPascal Merz <pascal.merz@me.com>
Tue, 29 Sep 2020 19:47:35 +0000 (19:47 +0000)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 29 Sep 2020 19:47:35 +0000 (19:47 +0000)
commit3f54624d78d01753e13f3e8b7eb9e9d061df3cb7
treeef237774435843f9ad3510f2a417e7bea3f7104f
parent7e4ad730ba6610f69d0d111847688ee1b778ea00
Fix bug resetting mdatoms masses to lambda=0 state

Following the reorganization in !384, the TopologyHolder reset the masses
in mdatoms after they were set by the FreeEnergyPerturbationElement. This
lead to having the masses equal to state A independently of the actual
lambda state.

This change fixes this bug by moving the mass setting into the setup
phase ensuring that it is set by the FEP element independently of the
build order of the elements.

When DD is used, the mdatoms masses were reset to their lambda=0 state
after every DD step. This is fixed by making the DomDecHelper aware of
the FEP element.

Note that the use of MDAtoms should likely be revisited to allow for a
more elegant solution, but this would likely require changes which are
less local than the proposed solution here. Further development is
therefore deferred to #3700.
src/gromacs/modularsimulator/domdechelper.cpp
src/gromacs/modularsimulator/domdechelper.h
src/gromacs/modularsimulator/freeenergyperturbationdata.cpp
src/gromacs/modularsimulator/freeenergyperturbationdata.h
src/gromacs/modularsimulator/simulatoralgorithm.cpp