Overwriting mass and invmass in MDAtoms

GROMACS version: 2024-dev-20250214-ff3c9783e7-dirty-unknown
Commit: 84a5f710734aed6725ee15cae6565a8e5e2110ed

Using the above version, we’ve implemented the Path MD algorithm (see https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.125.026001 and <A href="https://gitlab.com/gromacs/gromacs/-/issues/4571">Gromacs issue #4571 </A> - HackMD) in GROMACS.

Briefly, the algorithm samples the Boltzmann distribution of a “fictitious polymer” that (in its length) represents a standard MD trajectory. Since we are propagating the dynamics of the polymer, we assign it a “fictitious mass” that must be used for integration and all other purposes within GROMACS.

For this, I’ve implemented a hack in which I overwrite mdAtoms_->mdatoms()->massT.data() with the value of the fictitious mass and mdAtoms_->mdatoms()->invmass.data() with its inverse value. When DD is active, I repeat this overwriting in a post-re-partitioning callback.

Is this sufficient or should I do something else to ensure that only the fictitious mass is available to GROMACS everywhere else in code?

Thanks in advance,
Nitin Malapally

It depends on which algorithms are active. In particular the constraints store the masses. SETTLE does this at initialization, LINCS does this at domain decomposition steps. Then there are many other special algorithms that might store masses.

Thanks for the reply. OK, this means the hack will not be sufficient, since we want to use as many features as possible, including constraints.

Could you please point out the first instance in which masses are read and stored, so that I can make my changes there? I mean, which function/.cpp or such similar details that can help me implement the necessary detail.

Look in constr.cpp to see how the masses are passed around.