Ling,

On Mon, Jun 3, 2013 at 12:52 AM, S.L. Chan <[email protected]> wrote:

> Dear Greg and others,
>
> I am looking for a function that returns all the atom
> keys of a molecule. I thought GetAtoms was it. But then
> it does not seem to give a stable list of atom keys.
> For example:
>
> >>> mol = Chem.MolFromSmiles('CCCC')
> >>> for c in mol.GetAtoms():
> ...   print c
> ...
> <rdkit.Chem.rdchem.Atom object at 0x02BA65E0>
> <rdkit.Chem.rdchem.Atom object at 0x02BA6618>
> <rdkit.Chem.rdchem.Atom object at 0x02BA65E0>
> <rdkit.Chem.rdchem.Atom object at 0x02BA6618>
>
> >>> allat = []
> >>> for c in mol.GetAtoms():
> ...   allat.append(c)
> ...
>
> >>> mol = Chem.MolFromSmiles('CCCC')
> >>> for c in mol.GetAtoms():
> ...   print c
> ...
> <rdkit.Chem.rdchem.Atom object at 0x02BA6810>
> <rdkit.Chem.rdchem.Atom object at 0x02BA6848>
> <rdkit.Chem.rdchem.Atom object at 0x02BA6810>
> <rdkit.Chem.rdchem.Atom object at 0x02BA6848>
>
>
> Hence the list given by GetAtoms have evolved.
> Am I missing something?
>

The numbers following "object at" in the lines above are the addresses of
the atom data structure in memory, they are definitely not anything you
should be using in your code.

What are you trying to do with a list of "atom keys"? Are atom indices
enough?

-greg
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to