Integer overflow in dispersion correction
from the developer mailing list:
I noticed the following mdrun (version 2020) warning in a run with dispersion corrections switched on (dispcorr = EnerPres):
WARNING: There are no atom pairs for dispersion correction
accordingly, the Disper. corr. contribution is 0.00000e+00 in that simulation.
In contrast, the same tpr does not trigger this warning with gromacs2018 or 2019, and the expected Disper. corr. contribution is found in the output (for this particular run -8.67338e+03 at step 0).
A comparison between the 2019 and 2020 versions suggests this to be connected with the variables npair, npair_ij, iCount and jCount in dispersioncorrection.cpp having switched from int64_t in 2019 to int in version 2020. Indeed, monitoring these variables showed these to turn negative, suggesting an int overflow. Switching these variables back to int64_t as in the attached dispersioncorrection.cpp gives back the expected, non-zero dispersion correction.