Hi Tim, First off, it's good to hear from you again :-) I'm glad you're still active in the community.
On Thu, Nov 10, 2011 at 11:23 AM, Tim Vandermeersch <tim.vandermeer...@gmail.com> wrote: > On Thu, Nov 10, 2011 at 4:32 PM, David Lonie <lonieda...@gmail.com> wrote: >> In atom.h, there are the following three functions: >> >> //! \return the internal atom index (e.g., inside an OBMol) >> unsigned int GetIdx() const { return((int)_idx); } >> unsigned int GetIndex() const { return _idx - 1; } >> unsigned long GetId() const { return _id; } >> >> Can someone explain and/or document these in a bit more detail? I was >> quite surprised that GetIdx and GetIndex are defined differently. What >> is the role of _idx vs _id? Is there a reason that in GetIdx _idx is >> cast from uint->int, then (implicitly) back to a uint? > > The idx is an atom index that goes from 1 to N (N = number of atoms). > This is the _idx field and can be retreived using GetIdx(). > > The index (GetIndex()) is also an atom index but starts from 0 (0 to > N-1). This is the _idx - 1 field. This function was added for more > conformance to the bond indexes which start from 0. > > The _id (GetId()) field is a unique id that does not change if atoms > are deleted and can be to identify atoms during an OBMol's lifespan. > >> The reason I ask is that I'm trying to limit an OBFF calculation with >> OBForceField::AddInt[er,ra]Group[s], which takes the atom index, but >> it's not clear to me whether this means the index, the idx, or the id. > > You usually have to see at the specific code. That is much clearer. I'll add this to the docs later today. Thanks, Dave ------------------------------------------------------------------------------ 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