Fix modular simulator MTTK
authorPascal Merz <pascal.merz@me.com>
Mon, 28 Jun 2021 18:00:58 +0000 (14:00 -0400)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 7 Jul 2021 12:23:49 +0000 (12:23 +0000)
commit997d9e0240c17791142223c3e83da0e5b6327989
tree1632f81cf47b197b5ef555b3b605ce2c6f3e940f
parent155d81ac72d344c083fcd8a0ecc06193a518849b
Fix modular simulator MTTK

The modular simulator MTTK pressure coupling was slightly off due to
different reasons:
* The PV term was taken at the time of the update of the extended
  degree of freedom rather than at the time of reporting. This leads to
  slight differences when using nsttcoupling and nstpcoupling > 1.
* The NH chain coupled to the thermostat would alter the extended
  variable and hence the integral before it is reported. This NHC update
  already belongs to the next step, so shouldn't change the reported
  integral.
* The NH chain couple to the thermostat would not update the propagator
  scaling. Again, this leads to very slight differences when using
  nsttcoupling > 1.

These slight inaccuracies went undetected because they are minimal in
normal usage. To emphasize them in testing, the compressibility in the
simulator equivalence tests was strongly increased. This shows the
differences and would make the tests fail without the fixes in the
current change.

To implement these changes, the responsibility to calculate the
integral and set the scaling factor was moved from the elements to the
MTTK data structure which is accessed by all elements changing the
external degree of freedom and the box.
src/gromacs/modularsimulator/modularsimulator.cpp
src/gromacs/modularsimulator/mttk.cpp
src/gromacs/modularsimulator/mttk.h
src/gromacs/modularsimulator/nosehooverchains.cpp
src/gromacs/modularsimulator/nosehooverchains.h
src/programs/mdrun/tests/simulator.cpp