Several Custom*Forces have the method getTabulatedFunction(). The method getTabulatedFunction returns an TabulatedFunction object. How can we call setFunctionParameters() on the returned TabulatedFunction object in Python? The TabulatedFunction class is a generic class and does not have the method setFunctionParameters(). Therefore, it has to be downcasted into the derived class Continuous2DFunction.
Thanks,
Xinqiang
How to downcast a TabulatedFunction class to a Continuos2DFunction class in Python?
- Xinqiang Ding
- Posts: 33
- Joined: Tue May 05, 2015 2:27 pm
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: How to downcast a TabulatedFunction class to a Continuos2DFunction class in Python?
That's a bug. It ought to return the correct subclass. It looks like the Python wrapper isn't handling that correctly. I'll see if I can fix it.
As a workaround, can you hold on to the original Continuous2DFunction object that you added to the force?
Peter
As a workaround, can you hold on to the original Continuous2DFunction object that you added to the force?
Peter
- Xinqiang Ding
- Posts: 33
- Joined: Tue May 05, 2015 2:27 pm
Re: How to downcast a TabulatedFunction class to a Continuos2DFunction class in Python?
Yes. The workaround works. Thanks!
Xinqiang
Xinqiang
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm