Hi Seth,
On Tue, Nov 3, 2015 at 7:26 AM, Seth Axen <[email protected]> wrote: > I was wondering why, when I request the conformers (or atoms) from a mol, > and then request the owning mol of the conformer or atom, the two mols are > not the same instance: > >>> mol.GetConformers()[0].GetOwningMol() == mol > False > > I'd expect that they would be equal. Or, is there another way to retrieve > the mol instance from an atom or conformer instance? > They actually are the same, it just doesn't look like they are because the pointers are different (this is an implementation detail). Here's a little demo showing this for atoms : In [26]: m = Chem.MolFromSmiles('CCC') In [27]: at = m.GetAtomWithIdx(0) In [29]: at2 = m.GetAtomWithIdx(0) # they look different: In [28]: at Out[28]: <rdkit.Chem.rdchem.Atom at 0x106031d48> In [30]: at2 Out[30]: <rdkit.Chem.rdchem.Atom at 0x106031528> In [31]: at==at2 Out[31]: False # but are the same: In [32]: at.SetAtomicNum(7) In [33]: at2.GetAtomicNum() Out[33]: 7 It's certainly worth exploring whether or not it's possible to make this a bit more transparent and enable either "==" or "is" to work with these objects. That investigation is now on the todo list. :-) -greg
------------------------------------------------------------------------------
_______________________________________________ Rdkit-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

