Page 1 of 1

customHbondForce cannot take tabulated functions with defined indexes.

Posted: Thu Dec 20, 2018 8:28 pm
by matchen
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

Re: customHbondForce cannot take tabulated functions with defined indexes.

Posted: Fri Dec 21, 2018 11:37 am
by peastman
Thanks! I just pushed a fix for the problem: https://github.com/pandegroup/openmm/pull/2232. I'll try to get it merged shortly.

Re: customHbondForce cannot take tabulated functions with defined indexes.

Posted: Fri Dec 21, 2018 9:39 pm
by matchen
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

Re: customHbondForce cannot take tabulated functions with defined indexes.

Posted: Sat Dec 22, 2018 12:09 pm
by peastman
You can install the latest nightly build with this command:

Code: Select all

conda install -c omnia-dev openmm

Re: customHbondForce cannot take tabulated functions with defined indexes.

Posted: Sat Dec 22, 2018 9:50 pm
by matchen
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

Re: customHbondForce cannot take tabulated functions with defined indexes.

Posted: Mon Dec 24, 2018 2:29 pm
by peastman
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?

Re: customHbondForce cannot take tabulated functions with defined indexes.

Posted: Mon Dec 24, 2018 7:36 pm
by matchen
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

Re: customHbondForce cannot take tabulated functions with defined indexes.

Posted: Thu Dec 27, 2018 5:40 pm
by peastman
That means that somehow it didn't get installed correctly. I'd try again.

Re: customHbondForce cannot take tabulated functions with defined indexes.

Posted: Fri Dec 28, 2018 12:09 am
by matchen
Thanks a lot for your help!

Enjoy the New Year.
Mingchen

Re: customHbondForce cannot take tabulated functions with defined indexes.

Posted: Sun Jan 06, 2019 9:05 pm
by matchen
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