You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to make a polymer starting from the monomer, you get a BadConformerID error from RDKit. Upon further inspection, I have found this is due to the call to mol.GetConformer() in _copy_mol() from module linear_polymer/linear_polymer.py. I suspect that when no conformers are embedded in the mol object, GetConformer() tries to generate them - I'm not sure using which RDKit method - and fails.
As a workaround, I added an explicit call to generate 1 conformer:
def_copy_mol(self):
"""Function to replicate super_monomers. Parameters ----------- mol : rdkit.Chem.rdchem.Mol RDKit Mol object Return -------- fragments : `list` List of RDKit Mol objects """mol=self.molcids=AllChem.EmbedMultipleConfs(mol,1) # <-- HERE - explicit call to generate conformsCanonicalizeConformer(mol.GetConformer())
n_copies=self.n_copiesfragments=[molfor_inrange(int(n_copies))]
returnfragments
With this modification, now PySoftK works also with Agarose. Nevertheless, while correctly functioning, it would still take hours to generate the polymer. I identified the source of this in the WeightedRotorSearch() call in function rotor_opt() from module tools/utils_ob.py. I think it may take a very long time for large molecules with lots of rotatable bonds. Commenting this out and adding a call to RDKit make3D() function before running OpenBabel Relaxation and Rotor optimization seems to be returning perfectly reasonable geometries anyway.
Is it ok if I send a pull request so that you can review these modifications and evaluate whether to integrate them into PySoftK?
Thank you!
The text was updated successfully, but these errors were encountered:
Many thanks for your issue and I apologise for my belated answer. Many thanks also for pointing out this issue and finding a suitable way of improving the code. I am checking your example and I am going to have a go with that molecule.
I am interested to see why it is failing. Once I do that, I can review the code and accept a PR. Many thanks for collaborating and enhance the code!
I am very pleased to announce that all my tests are passing with your suggested change. I understood the problem. Since you have a molecule with a complicated chirality, RDkit builds many possible structures due to this degree of freedom. This is a very good example to add it also in my pytests, would you allow me to do this?. Please feel free to send me a PR whenever you have the time. Thanks again and happy new year!
absolutely no problem :) I'm happy to contribute. Sure you can use the molecule for the tests! As for the fix, I will make a PR in the next days so you can assess whether everything's in order.
Dear Alejandro,
thank you very much for sharing PySoftK, I found it very useful for easily building polymers.
I have run into some difficulties with some molecules unfortunately, such as Agarose:
When trying to make a polymer starting from the monomer, you get a
BadConformerID
error from RDKit. Upon further inspection, I have found this is due to the call tomol.GetConformer()
in_copy_mol()
from modulelinear_polymer/linear_polymer.py
. I suspect that when no conformers are embedded in the mol object,GetConformer()
tries to generate them - I'm not sure using which RDKit method - and fails.As a workaround, I added an explicit call to generate 1 conformer:
With this modification, now PySoftK works also with Agarose. Nevertheless, while correctly functioning, it would still take hours to generate the polymer. I identified the source of this in the
WeightedRotorSearch()
call in functionrotor_opt()
from moduletools/utils_ob.py
. I think it may take a very long time for large molecules with lots of rotatable bonds. Commenting this out and adding a call to RDKitmake3D()
function before running OpenBabel Relaxation and Rotor optimization seems to be returning perfectly reasonable geometries anyway.Is it ok if I send a pull request so that you can review these modifications and evaluate whether to integrate them into PySoftK?
Thank you!
The text was updated successfully, but these errors were encountered: