Update TabulatedFunction in a Custom*Force without reinitialize the Context

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Xinqiang Ding
Posts: 33
Joined: Tue May 05, 2015 2:27 pm

Update TabulatedFunction in a Custom*Force without reinitialize the Context

Post by Xinqiang Ding » Tue Aug 29, 2017 8:19 am

Can we update a TabulatedFunction in a Custom*Force without reinitializing the Context?

I have tried to do it using the following procedure, but it does not work.

Code: Select all

OpenMM::Continuous1DFunction* func = (OpenMM::Continuous1DFunction*) &(Custom*Force -> getTabulatedFunction(0));
func -> setFunctionParameters(new_value, min, max);
After assigning a new_value to the TabulatedFunction, I calculated the energy. The energy is still based on the old values of the TabulatedFunction, not the new_value.

Thanks,
Xinqiang

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

Re: Update TabulatedFunction in a Custom*Force without reinitialize the Context

Post by Peter Eastman » Tue Aug 29, 2017 9:38 am

Currently, no, you can't do that. In principle we could add a feature to do it though.

User avatar
Xinqiang Ding
Posts: 33
Joined: Tue May 05, 2015 2:27 pm

Re: Update TabulatedFunction in a Custom*Force without reinitialize the Context

Post by Xinqiang Ding » Tue Aug 29, 2017 9:58 am

This feature would be very helpful for running many meta dynamics like algorithms, which need to repetitively modify the biasing potential and these biasing potential can be represented by the tabulated functions.

Will adding this feature involve a lot work?

Thanks,
Xinqiang

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

Re: Update TabulatedFunction in a Custom*Force without reinitialize the Context

Post by Peter Eastman » Tue Aug 29, 2017 10:26 am

Yes, it would be a major new feature. But it might be worth doing.

POST REPLY