Page 1 of 1
Could atoms change parameters on the fly?
Posted: Tue Jan 19, 2021 4:27 pm
by luwei0917
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.
Re: Could atoms change parameters on the fly?
Posted: Thu Jan 21, 2021 11:28 am
by peastman
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.
Re: Could atoms change parameters on the fly?
Posted: Thu Jan 21, 2021 2:09 pm
by luwei0917
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.
Re: Could atoms change parameters on the fly?
Posted: Thu Jan 21, 2021 2:33 pm
by peastman
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.