Closed raimis closed 4 years ago
This makes me very nervous. It opens the door to a lot of problems!
Whether the masses are nonphysical is beside the point. All MD simulations are nonphysical in a lot of ways. But they're still well defined models, and they produce useful results in many cases despite their nonphysical features.
Mass repartitioning is an approximation. If it's good enough for your purposes then you can use it, and if it isn't then you don't, but it needs to be used consistently. If you use repartitioned masses in some parts of the calculation but not in others, then you no longer have a well defined model. You're likely to get all sorts of subtle but vitally important artifacts. For example, equations of motion that don't conserve energy, which invalidates the assumptions behind most sampling methods.
For example, a metadynamics simulation where a CV needs a COM and the integration is done without the mass repartitioning. Assuming, it is valid to use the mass repartitioning in case of an MD simulation, it should be a case for the metadynamics simulation too. And the results shouldn't change significantly, but it won't be the case, if the the integrator setup affects the CV definition.
So the problem I want to solve with this PR is to decouple the integrator setup in OpenMM and the collective variable definitions in PLUMED.
@peastman this is ready!
It still makes me nervous, but I guess as long as PLUMED never tries to do anything with a momentum or kinetic energy it will be ok.
PLUMED allows to set particle via its API (https://www.plumed.org/doc-v2.6/developer-doc/html/_how_to_plumed_your_m_d.html):
This PR implements a corresponding functionality for OpenMM-PLUMED API:
By default, OpenMM-PLUMED uses the masses from
OpenMM::System
. If the hydrogen mass repartitioning is used, these masses are nonphysical and shouldn't be used to compute CVs.