Re: [Rdkit-discuss] How to get coordinates for each atom in molecule?
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
From: sereina r. <ser...@gm...> - 2014-01-24 12:08:46
|
Hi Michael, You can get the atom positions via the conformer: m = Chem.MolFromSmiles('c1ccccc1') AllChem.Compute2DCoords() pos = m.GetConformer().GetAtomPosition(0) # position of atom 0 This gives you a rdGeometry.Point3D - e.g. the x coordinates you get with: x = pos.x I hope this is what you were looking for. Best, Sereina 2014/1/24 Michał Nowotka <mm...@gm...> > Hi, > > Let's say I loaded a molfile containing coordinates to RDKit mol > object or loaded it from smiles but called > AllChem.Compute2DCoords(mol). > Now I would like to get coordinates for each atom. Unfortunately Atom > class doesn't have any GetCoords method but this is understandable > since position is optional. I tried to look into properties but it > seems that they are stored in some stage container exported from C++: > > for atom in mol.GetAtoms(): > print atom.GetPropNames() > ....: > <rdkit.rdBase._vectSs object at 0xa455aec> > <rdkit.rdBase._vectSs object at 0xa455aec> > ... > > > Some blind guesses such as: atom.GetProp('x'), atom.GetProp('X') > failed. Mol object itself doesn't provide any method that would > suggest that it can return coordinates.... > > So is there any way to get this data without parsing original molfile? > > > Regards, > > Michal Nowotka > > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Rdkit-discuss mailing list > Rdk...@li... > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > |