On 10/11/2011 15:35, David Lonie wrote:
>But I'm still confused as to why
> index and idx are both included in the API.

(Tim has just posted all this.)

idx is the original and still the most used and starts at 1. It changes 
if you delete an atom with a lower idx.

index starts at 0 (because really serious arrays do - and and to be 
consistent with the bond index).

id is unique within a molecule, and remains the same even after 
deletions. It is a number but but it is dangerous to increment it to get 
the next atom.

The confusion caused by too much choice and the deficiencies in all of 
the above mean that MolCore API (the proposed re-writing of the central 
part of the toolkit) deserves better. I am pushing for no atom indexes 
at all, and only one way for a user to reference an atom - a sort of 
atom pointer which remains valid whatever you do to the molecule. It is 
also an iterator that can be can be incremented in various interesting 
ways.

Chris

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to