Could atoms change parameters on the fly?

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Wei Lu
Posts: 45
Joined: Sat Nov 10, 2018 7:54 pm

Could atoms change parameters on the fly?

Post by Wei Lu » Tue Jan 19, 2021 4:27 pm

In CustomNonBonded force, we can specify the parameters for each atoms. But If I want to simulate a possible reaction: when two atoms come close enough, they react to each other, how can I change the parameters after the step the reaction happened. It will be great if OpenMM can support this.
Thanks.

User avatar
Peter Eastman
Posts: 2607
Joined: Thu Aug 09, 2007 1:25 pm

Re: Could atoms change parameters on the fly?

Post by Peter Eastman » Thu Jan 21, 2021 11:28 am

You can call setParticleParameters() on the CustomNonbondedForce to set the new values for the parameters, then call updateParametersInContext() to copy the values to the Context. This is a slightly expensive operation, so you don't want to do it every time step, but occasional updates are fine.

User avatar
Wei Lu
Posts: 45
Joined: Sat Nov 10, 2018 7:54 pm

Re: Could atoms change parameters on the fly?

Post by Wei Lu » Thu Jan 21, 2021 2:09 pm

Can I update the parameter when some condition are met. for example, when two atom are close to each other and their total kinetic energy is larger than certain threshold?
Thanks.

User avatar
Peter Eastman
Posts: 2607
Joined: Thu Aug 09, 2007 1:25 pm

Re: Could atoms change parameters on the fly?

Post by Peter Eastman » Thu Jan 21, 2021 2:33 pm

Not automatically. You would have to write code to check for that condition. That again involves overhead, so you'll want to limit how frequently you do it.

POST REPLY