openmm / openmm-ml

High level API for using machine learning models in OpenMM simulations
Other
75 stars 25 forks source link

waterbox translation #79

Closed wiederm closed 1 month ago

wiederm commented 2 months ago

Hi everyone,

We have been running waterbox simulations and noticed that the CMMotionRemover force is not set by default in the createSystem() method. While calculating diffusion coefficient we noticed that the mean square displacement of waters in the simulation increases exponentially (this happens in simulations with MACE and ANI).

I was expecting some drift, but not necessarily a drift that is steadily increasing. Anyways, adding the CMMotionRemover force to the simulation resulted in expected mean squared displacement. I have added a script to reproduce the issue. Would it make sense to add the CMMotionRemover as default?

mace_msd.zip

peastman commented 2 months ago

I think that would make sense. Similar to ForceField, there should be a removeCMMotion argument you can use to disable it.

createMixedSystem() should behave differently. If your original system has a CMMotionRemover, the new one will as well. If the original one doesn't have one, it shouldn't add one. I believe that's how it works now.

JMorado commented 2 months ago

I agree this would make sense. Should we go ahead and create a PR for this?

peastman commented 1 month ago

Sounds good to me.

peastman commented 1 month ago

This is implemented in #80.

jchodera commented 1 month ago

Do we have a hypothesis for why this happens, @wiederm and @peastman?

With a Langevin integrator, this absolutely should not happen with a conservative force field. The fact that this appears to be happening suggests that there may be a uniform force component erroneously being applied here.