On 16/09/2011 22:34, andi wrote:
> I'm trying to see if a one fragment is a sub-structure of a molecule and am
> using *OBIsomorphismMapper*, however when I start modifying the molecule
> (deleting atoms etc..), i start getting strange results, including some
> segmentation faults.
>
> First I want to verify that the *map object* contains the atom *index* and
> not *idx*, is this correct?
>
> Also, right now the way I access the matched atoms in the molecule/fragment,
> I add 1 to the element in the *map object *
> i.e.)
>      map.at[0].first+1 or map.at[0].second+1
>      OBAtom* atom = m->GetAtom( map.at[0].first+1 )
>
> Is this a good way to access the matched atoms, or is there a better way to
> access them in order to modify, delete etc..?

It is my understanding that the zero-based index (rather than the 
one-based idx) is used in the mappings, although the documentation is 
not very clear on this.

The atom indices (both zero or one based) are not valid after an atom 
deletion. This may be what is causing your problem. You may be able to 
work around this by deleting atoms in decreasing order of their indices.

Incidentally, the third type of atom index from OBAtom::GetId() remains 
valid after a deletion.

Chris

------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to