Bug #3400

Updated by Pascal Merz 3 months ago

A student in our group found that using rerun in GROMACS 2019, neither the Coulomb nor the LJ reciprocal terms are recalculated. These energies are 0, and consequently, the *potential energy is missing these terms and is off compared to the original run*.

The bug can be retraced to #1868, where rerun was split off and restricted to explicitly only calculate forces and potential energies, omitting kinetic energies, virial, pressure, constraints, etc. Consequently, within do_rerun, do_force did not get the @GMX_FORCE_VIRIAL@ flag anymore. In @gmx_pme_do@, called from the lower level functions within do_force, the reciprocal terms are however only calculated if @GMX_FORCE_VIRIAL@ was originally passed. I don't see a compelling reason why reciprocal energy terms and virial should be intimately linked, but maybe I'm overlooking a detail here.

Note that due to #2649, the @GMX_FORCE_VIRIAL@ flag was reintroduced if GROMACS was compiled with for GPU support, runs, so GPU enabled builds runs are not affected by this bug.

The easy solution to fix this bug is to pass @GMX_FORCE_VIRIAL@ in all cases. Moving forward, we should check whether these options can be disentangled.