Page 1 of 1

Update TabulatedFunction in a Custom*Force without reinitialize the Context

Posted: Tue Aug 29, 2017 8:19 am
by negelis
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

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

Posted: Tue Aug 29, 2017 9:38 am
by peastman
Currently, no, you can't do that. In principle we could add a feature to do it though.

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

Posted: Tue Aug 29, 2017 9:58 am
by negelis
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

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

Posted: Tue Aug 29, 2017 10:26 am
by peastman
Yes, it would be a major new feature. But it might be worth doing.