customHbondForce cannot take tabulated functions with defined indexes.
- Matthew Chen
- Posts: 7
- Joined: Tue Dec 04, 2018 1:35 am
customHbondForce cannot take tabulated functions with defined indexes.
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
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
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: customHbondForce cannot take tabulated functions with defined indexes.
Thanks! I just pushed a fix for the problem: https://github.com/pandegroup/openmm/pull/2232. I'll try to get it merged shortly.
- Matthew Chen
- Posts: 7
- Joined: Tue Dec 04, 2018 1:35 am
Re: customHbondForce cannot take tabulated functions with defined indexes.
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
Sincerely,
Mingchen
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: customHbondForce cannot take tabulated functions with defined indexes.
You can install the latest nightly build with this command:
Code: Select all
conda install -c omnia-dev openmm
- Matthew Chen
- Posts: 7
- Joined: Tue Dec 04, 2018 1:35 am
Re: customHbondForce cannot take tabulated functions with defined indexes.
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
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
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: customHbondForce cannot take tabulated functions with defined indexes.
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?
- Matthew Chen
- Posts: 7
- Joined: Tue Dec 04, 2018 1:35 am
Re: customHbondForce cannot take tabulated functions with defined indexes.
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
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
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: customHbondForce cannot take tabulated functions with defined indexes.
That means that somehow it didn't get installed correctly. I'd try again.
- Matthew Chen
- Posts: 7
- Joined: Tue Dec 04, 2018 1:35 am
Re: customHbondForce cannot take tabulated functions with defined indexes.
Thanks a lot for your help!
Enjoy the New Year.
Mingchen
Enjoy the New Year.
Mingchen
- Matthew Chen
- Posts: 7
- Joined: Tue Dec 04, 2018 1:35 am
Re: customHbondForce cannot take tabulated functions with defined indexes.
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
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