CustomExternalForce defined functions....

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Kasra Momeni
Posts: 23
Joined: Sat Nov 14, 2009 12:06 pm

CustomExternalForce defined functions....

Post by Kasra Momeni » Wed Jun 09, 2010 11:46 am

How can I define an external force which varies as a function of simulation time?

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

RE: CustomExternalForce defined functions....

Post by Peter Eastman » Wed Jun 09, 2010 11:50 am

If you want it to explicitly be a function of the time, that isn't possible. It's a good suggestion though, so go ahead and enter it into the feature request tracker.

What you can do, though, is define a global parameter and make the force depend on that. Then over the course of your simulation, you can periodically update it by calling setParameter() on the Context.

Peter

User avatar
Saurabh Belsare
Posts: 32
Joined: Sat Aug 14, 2010 8:43 am

Re: CustomExternalForce defined functions....

Post by Saurabh Belsare » Tue Sep 29, 2015 1:19 pm

Hi Dr. Eastman,

Has this feature been implemented? If not, if I use the global parameter, as you have suggested, is there a cost associated with setting the parameter at, say each time step?

Thank you.

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

Re: CustomExternalForce defined functions....

Post by Peter Eastman » Tue Sep 29, 2015 2:12 pm

The cost of doing that should be pretty small. Global parameters are designed to be efficient to update.

Peter

User avatar
Saurabh Belsare
Posts: 32
Joined: Sat Aug 14, 2010 8:43 am

Re: CustomExternalForce defined functions....

Post by Saurabh Belsare » Wed Sep 30, 2015 11:50 am

Hi Dr. Eastman,

I think I've been able to add the force I'm looking for using the global parameter update, as you've suggested.

Thank you.

POST REPLY