[Rdkit-discuss] Error when embedding Cl with hydrogens
Dear community, I just found out that adding hydrogens to hydrochloride to later embed it and use MMFF force field results on a force field that is not set up (convergency = -1): m = Chem.MolFromSmiles('Cc1c1NC(=O)Cl.Cl') m = Chem.AddHs(m) AllChem.EmbedMultipleConfs(m, numConfs=5, useRandomCoords=True, randomSeed=43, maxAttempts=5000) res1 = AllChem.MMFFOptimizeMoleculeConfs(m, ignoreInterfragInteractions= False) print(res1) On the other hand, if hydrogens are already provided in the smiles (without having to add hydrogens) works. I think this is a bug since it does not happen with other simple molecules such as water. m2 = Chem.MolFromSmiles('[H]Cl.[H]c1c([H])c([H])c(C([H])([H])[H])c(N([H])C(=O)Cl)c1[H]') AllChem.EmbedMultipleConfs(m2, numConfs=5, useRandomCoords=True, randomSeed=43, maxAttempts=5000) res2 = AllChem.MMFFOptimizeMoleculeConfs(m2, ignoreInterfragInteractions= False) print(res2) One way of solving this is by 1) getting the mol from smiles without hydrogens, 2) adding hydrogens to the mol, 3) going back to smiles (now with hydrogens), 4) getting a mol from smiles with hydrogens. It works, but it should not be solved like that. m3= Chem.MolFromSmiles('Cc1c1NC(=O)Cl.Cl') m3= Chem.AddHs(m3) m3 = Chem.MolToSmiles(m3) print("now it has Hs", m3) m3= Chem.MolFromSmiles(m3) AllChem.EmbedMultipleConfs(m3, numConfs=5, useRandomCoords=True, randomSeed=43, maxAttempts=5000) res3 = AllChem.MMFFOptimizeMoleculeConfs(m3, ignoreInterfragInteractions= False) print(res3) Is there some other place to report this kind of stuff? Best regards, Pablo Ramos Ph.D. at Covestro Deutschland AG [cid:image001.png@01D77801.4B425DE0] covestro.com<http://www.covestro.com/> Telephone +49 214 6009 7356 Covestro Deutschland AG COVDEAG-Chief Commer-PUR-R B103, R164 51365 Leverkusen, Germany pablo.ra...@covestro.com<mailto:pablo.ra...@covestro.com> ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] FW: Problems when aligning the moment of inertia with the principal axes
I just solve it, Just in case someone also needs it. You can compute the inertia tensor after aligning with the principal axes with CanonicalizeConformer(). This tensor is now therefore diagonal, and the symbol of the ii components tell you the direction they are pointing out. Just rotate in those directions so the principal moment of inertia components coincide. Best regards, Pablo Ramos Ph.D. at Covestro Deutschland AG [cid:image001.png@01D73C2E.E0FB5990] covestro.com<http://www.covestro.com/> Telephone +49 214 6009 7356 Covestro Deutschland AG COVDEAG-Chief Commer-PUR-R B103, R164 51365 Leverkusen, Germany pablo.ra...@covestro.com<mailto:pablo.ra...@covestro.com> From: Pablo Ramos Sent: Wednesday, 28 April 2021 13:11 To: rdkit-discuss@lists.sourceforge.net Subject: Problems when aligning the moment of inertia with the principal axes Dear community, There is the function CanonicalizeConformer() that allows you to align molecules based in the moment of inertia. I want to use it to align molecules that are exactly the same, but whose atom indices are different. rdkit.Chem.rdMolAlign module contains functions that take symmetry into account, so atoms are indistinguishable and end up just creating the same molecule with the same atom indices, which is not what I want to get. Using CanonicalizeConformer() I get the left picture. What I want to get is the right one. Right one can be obtained by performing a 180° rotation along the X and Y axes. I was wondering if there is a way to get right picture directly, without habving to perform the rotation. [cid:image002.png@01D73C34.CFEC6120][cid:image003.png@01D73C34.CFEC6120] Best regards, Pablo Ramos Ph.D. at Covestro Deutschland AG [cid:image001.png@01D73C2E.E0FB5990] covestro.com<http://www.covestro.com/> Telephone +49 214 6009 7356 Covestro Deutschland AG COVDEAG-Chief Commer-PUR-R B103, R164 51365 Leverkusen, Germany pablo.ra...@covestro.com<mailto:pablo.ra...@covestro.com> ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] Problems when aligning the moment of inertia with the principal axes
Dear community, There is the function CanonicalizeConformer() that allows you to align molecules based in the moment of inertia. I want to use it to align molecules that are exactly the same, but whose atom indices are different. rdkit.Chem.rdMolAlign module contains functions that take symmetry into account, so atoms are indistinguishable and end up just creating the same molecule with the same atom indices, which is not what I want to get. Using CanonicalizeConformer() I get the left picture. What I want to get is the right one. Right one can be obtained by performing a 180° rotation along the X and Y axes. I was wondering if there is a way to get right picture directly, without habving to perform the rotation. [cid:image002.png@01D73C2F.FD67B280][cid:image003.png@01D73C2F.FD67B280] Best regards, Pablo Ramos Ph.D. at Covestro Deutschland AG [cid:image001.png@01D73C2E.E0FB5990] covestro.com<http://www.covestro.com/> Telephone +49 214 6009 7356 Covestro Deutschland AG COVDEAG-Chief Commer-PUR-R B103, R164 51365 Leverkusen, Germany pablo.ra...@covestro.com<mailto:pablo.ra...@covestro.com> ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] compute canonical transform of a conformer fails
Dear community, I want to pick a fragment from a molecule, and canonicalize its conformer in order to align its principal moments of inertia. However, this does not seem to work. Any idea why this could be happening? mol1 = Chem.MolFromSmiles('[H]C([H])=O.[H]N([H])[H]') mol1 = Chem.AddHs(mol1) for fragment in Chem.GetMolFrags(mol1, asMols=True): AllChem.EmbedMolecule(fragment, useRandomCoords=False) conf = fragment.GetConformer() Chem.rdMolTransforms.ComputeCanonicalTransform(conf) RuntimeError: Invariant Violation Violation occurred on line 298 in file Code/GraphMol/MolTransforms/MolTransforms.cpp Failed Expression: dim >= 1 RDKIT: 2021.03.1 BOOST: 1_74 Best regards, Pablo Ramos Ph.D. at Covestro Deutschland AG [cid:image001.png@01D736A7.2701D9B0] covestro.com<http://www.covestro.com/> Telephone +49 214 6009 7356 Covestro Deutschland AG COVDEAG-Chief Commer-PUR-R B103, R164 51365 Leverkusen, Germany pablo.ra...@covestro.com<mailto:pablo.ra...@covestro.com> ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] atom index changes after embedding
Dear community, I want to embed a molecule. For my personal application, I really need the atom indices to be respected, even if they are indistinguishable. The problem is that, because of symmetry, some atoms may be indistinguishable. This is something you can see by using CanonicalRankAtoms(): mol = Chem.MolFromSmiles('[H]C([H])=O.[H]N([H])[H]') print("canonical rank atoms for mol:", list(Chem.CanonicalRankAtoms(mol, breakTies=False))) --> canonical rank atoms for mol: [6, 5, 7, 0, 0, 2, 2, 2] In the above example we have one group of two identical atoms (labelled as 0), and another one of three identical atoms (labelled as 2). Therefore, the mol object created after embedding may have swapped indistinguishable atoms, losing the track of the initial indexes I had. Such problem was discussed in the link bellow. Unfortunately, I cannot find any solution from it more than understanding where my problem comes from… Is there, for the new RDKit version, any way to prevent atom labelling changes when embedding / some available solution to this? https://github.com/rdkit/rdkit/issues/3219 Thank you, and have a nice day :) Best regards, Pablo Ramos Ph.D. at Covestro Deutschland AG [cid:image001.png@01D709F7.5A3AE420] covestro.com<http://www.covestro.com/> Telephone +49 214 6009 7356 Covestro Deutschland AG COVDEAG-Chief Commer-PUR-R B103, R164 51365 Leverkusen, Germany pablo.ra...@covestro.com<mailto:pablo.ra...@covestro.com> ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] Failing when embeding molecule with several fragments
Hello everybody, I am trying to generate 3D coordinates and optimize the system with MM. When optimizing, atoms overlap for one of the O=C(Cl)Cl fragments. This is my code: smiles = 'Cc1ccc(N)cc1N.O=C(Cl)Cl.O=C(Cl)Cl' m = Chem.MolFromSmiles(smiles) m = Chem.AddHs(m) AllChem.EmbedMolecule(m, useRandomCoords = True) ffu = AllChem.UFFGetMoleculeForceField(m, ignoreInterfragInteractions = False) ffu.Initialize() ffu.Minimize(maxIts = 500) In order to be sure that this is not a problem of convergency, I unsuccessfully set ffu.Minimize(maxIts) with a high value, as well as trying with a high number of maxAttempts for the embedding. Thanks a lot, Best regards, Pablo Ramos Ph.D. at Covestro Deutschland AG [cid:image003.png@01D6B383.D58D8E40] covestro.com<http://www.covestro.com/> Telephone +49 214 6009 7356 Covestro Deutschland AG COVDEAG-Chief Commer-PUR-R B103, R164 51365 Leverkusen, Germany pablo.ra...@covestro.com ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] Sanitize molecule with explicit Hydrogens to catch an error
Dear all, I am trying to catch an error every time that a smiles associated to a mol object does not exist. To do this, I want to use sanitize function: if the smiles is incorrect I will get my error. My smiles with explicit hydrogens is the next one: [H]C([H])O I want it to provide an error since valences do not match the ones specified for Carbon and Oxygen beingHydrogens already explicit: C_val = 4 ; O_val = 2 However, sanitizing this object creates automatically the missing Hydrogens providing a valid smiles: [H]OC([H])([H])[H] and therefore it assumes the smiles is correct. Is there any way to specify that my Hydrogens are already explicit during sanitazion so I get my error message? Thank you so much :) Best regards, Pablo Ramos Ph.D. at Covestro Deutschland AG [cid:image003.png@01D627A1.2B0B0A10] covestro.com<http://www.covestro.com/> Telephone +49 214 6009 7356 Covestro Deutschland AG COVDEAG-Chief Commer-PUR-R B103, R164 51365 Leverkusen, Germany pablo.ra...@covestro.com ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] Drawing the sum of reactive molecules
Dear all, I am trying to draw a nice picture with the sum of two molecules that react giving some product. Let´s assume the next SMARTS, in which ammonia and formaldehyde react (Hydrogen atoms are omitted): Reaction = C=O.N>>NC=O.[H][H] I know that rdkit contains the rdkit.Chem.rdChemReactions module. This allows me to display the reaction picture by providing the above SMARTS according to AllChem.ReactionFromSmarts(Reaction). However, I just want to display the left part from the reaction (Ammonia + Formaldehyde), without the arrow and the products. I am especially interested in this module because the molecular structures look quite beautiful and I have the '+' symbol in the picture. There is another issue regarding this. I would like to express the bonds with straight lines instead of dotted ones (that come up by default) Thank you! Best regards, Pablo Ramos Ph.D. at Covestro Deutschland AG [cid:image002.png@01D5DDBE.863395B0] covestro.com<http://www.covestro.com> Telephone +49 214 6009 7356 Covestro Deutschland AG COVDEAG-Chief Commer-PUR-R B103, R164 51365 Leverkusen, Germany pablo.ra...@covestro.com The processing of personal data is necessary to communicate and provide our services. Read more here: privacy-information<https://www.covestro.com/-/media/covestro/country%20sites/global/documents/Data_Privacy_Note%202018_EN>. Please manually add the sentence in your language here. Please make sure that this link is not lost when the sentence is transferred (Copy --> Paste --> "Merge Formatting"). ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] Converting Bond Order Matrices to SMILES format
Hello everybody, Bond Order matrices represent the connectivity between atoms in a molecule. Single bonds are represented with value equal to 1, double bonds with value equal to 2, etc. Does anybvody know about an implementation in RDKit that allows the convertion from Bond Order matrix format to SMILES format? Thank you. Best regards, Pablo Ramos Ph.D. at Covestro Deutschland AG [cid:image003.png@01D5A8FF.78F3FB40] covestro.com<http://www.covestro.com> Telephone +49 214 6009 7356 Covestro Deutschland AG COVDEAG-Chief Commer-PUR-R B103, R164 51365 Leverkusen, Germany pablo.ra...@covestro.com The processing of personal data is necessary to communicate and provide our services. Read more here: privacy-information<https://www.covestro.com/-/media/covestro/country%20sites/global/documents/Data_Privacy_Note%202018_EN>. Please manually add the sentence in your language here. Please make sure that this link is not lost when the sentence is transferred (Copy --> Paste --> "Merge Formatting"). ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss