customHbondForce cannot take tabulated functions with defined indexes.

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Matthew Chen
Posts: 7
Joined: Tue Dec 04, 2018 1:35 am

customHbondForce cannot take tabulated functions with defined indexes.

Post by Matthew Chen » Thu Dec 20, 2018 8:28 pm

Hi Peter,

I met with this problem when I tried to implement a position dependent Hydrogen Bonding term in openmm. However, I met with the problem of "unknown particle res_i". I don't have this problem when I access tabulated functions in other custom forces before. Is hydrogen bonding term different from other custom forces?

Many thanks in advance.

Sincerely,

Here is the code:

def beta_term_1(self, k_beta = 0.25*4.184):
print("new beta_1 term ON");
r_ON = .298
sigma_NO = .068
r_OH = .206
sigma_HO = .076
lambda_1 = np.zeros((self.nres, self.nres))
for i in range(self.nres):
for j in range(self.nres):
lambda_1[j] = self.get_lambda_by_index(i, j, 0);
theta_ij = f"exp(-(r_Oi_Nj-{r_ON})^2/(2*{sigma_NO}^2)-(r_Oi_Hj-{r_OH})^2/(2*{sigma_HO}^2))"
beta_string_1 = f"-k_beta*lambda_1(res_i,res_j)*theta_ij;theta_ij={theta_ij};r_Oi_Nj=distance(d1,a1);r_Oi_Hj=distance(d1,a2);"
beta_1 = CustomHbondForce(beta_string_1);
beta_1.addGlobalParameter("k_beta", k_beta)
beta_1.addPerDonorParameter("res_i");
beta_1.addPerAcceptorParameter("res_j");
beta_1.addTabulatedFunction("lambda_1", Discrete2DFunction(self.nres, self.nres, lambda_1.T.flatten()))
print(lambda_1)
for i in range(2):
if self.o!= -1:
beta_1.addDonor(self.o, -1, -1, );
if self.n!=-1 and self.h!=-1:
beta_1.addAcceptor(self.n, self.h, -1, )
beta_1.setCutoffDistance(1.0);
beta_1.setForceGroup(23)
return beta_1

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

Re: customHbondForce cannot take tabulated functions with defined indexes.

Post by Peter Eastman » Fri Dec 21, 2018 11:37 am

Thanks! I just pushed a fix for the problem: https://github.com/pandegroup/openmm/pull/2232. I'll try to get it merged shortly.

User avatar
Matthew Chen
Posts: 7
Joined: Tue Dec 04, 2018 1:35 am

Re: customHbondForce cannot take tabulated functions with defined indexes.

Post by Matthew Chen » Fri Dec 21, 2018 9:39 pm

Thanks a lot! I have noticed the changes, but could you tell me how to update the openmm suite (maybe through conda) with the most updated changes?

Sincerely,
Mingchen

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

Re: customHbondForce cannot take tabulated functions with defined indexes.

Post by Peter Eastman » Sat Dec 22, 2018 12:09 pm

You can install the latest nightly build with this command:

Code: Select all

conda install -c omnia-dev openmm

User avatar
Matthew Chen
Posts: 7
Joined: Tue Dec 04, 2018 1:35 am

Re: customHbondForce cannot take tabulated functions with defined indexes.

Post by Matthew Chen » Sat Dec 22, 2018 9:50 pm

Hello,
I met with further problem when I updated my openmm using the above command: conda install -c omnia-dev openmm

python -m simtk.testInstallation
/Users/mingchenchen/anaconda2/envs/py36/bin/python: Error while finding module specification for 'simtk.testInstallation' (ModuleNotFoundError: No module named 'simtk')

It seems that simtk will not be available then. Any solutions?

Thanks and Best,
Mingchen

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

Re: customHbondForce cannot take tabulated functions with defined indexes.

Post by Peter Eastman » Mon Dec 24, 2018 2:29 pm

That means it didn't get installed correctly. Take a look in your site-packages directory. That should be something along the lines of /Users/mingchenchen/anaconda2/envs/py36/lib/python3.6/site-packages. Is the simtk directory there? If so, what does it contain?

User avatar
Matthew Chen
Posts: 7
Joined: Tue Dec 04, 2018 1:35 am

Re: customHbondForce cannot take tabulated functions with defined indexes.

Post by Matthew Chen » Mon Dec 24, 2018 7:36 pm

Hello,

simtk is not there after installing the dev version. However, previously simtk was under that folder.

What does that mean? Do I need to install differently?

Thanks and Merry Xmas,
Mingchen

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

Re: customHbondForce cannot take tabulated functions with defined indexes.

Post by Peter Eastman » Thu Dec 27, 2018 5:40 pm

That means that somehow it didn't get installed correctly. I'd try again.

User avatar
Matthew Chen
Posts: 7
Joined: Tue Dec 04, 2018 1:35 am

Re: customHbondForce cannot take tabulated functions with defined indexes.

Post by Matthew Chen » Fri Dec 28, 2018 12:09 am

Thanks a lot for your help!

Enjoy the New Year.
Mingchen

User avatar
Matthew Chen
Posts: 7
Joined: Tue Dec 04, 2018 1:35 am

Re: customHbondForce cannot take tabulated functions with defined indexes.

Post by Matthew Chen » Sun Jan 06, 2019 9:05 pm

Hello,

I am afraid this problem of installing DEV version has not been solved. I would very much appreciate your help to look into my issue.

Thanks and best,
Mingchen

POST REPLY