Rerun does not calculate reciprocal energies - Redmine #3400
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 GPU support, so GPU enabled builds 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.
*(from redmine: issue id 3400, created on 2020-02-25 by ptmerz, closed on 2020-02-28)*
* Relations:
* relates #1868
* relates #2649
* Changesets:
* Revision cc055a76cac976ba56ed9fb8607aeb885a533d28 on 2020-02-26T02:15:09Z:
```
Fix calculation of reciprocal terms in rerun
This at least temporarily fixes #3400.
Change-Id: I04d67d9bb3edbd66049573de71940e4bb7fa1ad4
```
issue