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.
Could atoms change parameters on the fly?
- Peter Eastman
- Posts: 2607
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Could atoms change parameters on the fly?
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?
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.
Thanks.
- Peter Eastman
- Posts: 2607
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Could atoms change parameters on the fly?
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.