I tested your code on several structures and noticed that it failed on molecules with only one element (NH3, OH2...). Then I checked https://www.rdkit.org/docs/source/rdkit.Chem.rdMolTransforms.html and saw that the default ignores hydrogens. So try Chem.rdMolTransforms.ComputeCanonicalTransform(conf, ignoreHs=False) in the last line and see if it fixes your problem. Regards
Em qua., 21 de abr. de 2021 às 07:21, Pablo Ramos <pablo.ra...@covestro.com> escreveu: > 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 > > > > > > covestro.com <http://www.covestro.com/> > > *Telephone* > > +49 214 6009 7356 > > > > Covestro Deutschland AG > > COVDEAG-Chief Commer-PUR-R&D-EMEA-PMD > > B103, R164 > > 51365 Leverkusen, Germany > > *pablo.ra...@covestro.com <pablo.ra...@covestro.com>* > > > > > _______________________________________________ > Rdkit-discuss mailing list > Rdkit-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > -- Rafael da Fonseca Lameiro [image: orcid logo 16px] https://orcid.org/0000-0003-4466-2682 PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED) São Carlos Institute of Chemistry - University of São Paulo - Brazil Av. Trabalhador Sancarlense, 400 - ZIP code: 13566-590 - São Carlos/SP
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss