|
From: Geoffrey H. <ge...@ge...> - 2009-03-20 21:37:29
|
> for(int nat=0;nat<smarts.NumAtoms();nat++) {
> atom = mymol.GetAtom((*matches)[nat]); // at this point
> both (*matches)[nat] and atom.GetIdx() agree
> // and
> the numbers are as expected
> mymol.DeleteAtom(atom);
At the moment, index numbers are the direct index into a vector --
they're not unique ids for an atom. So once you delete an atom, the
vector is adjusted and the previous index numbers are invalid.
I don't have time to check this, but you want something like:
std::list <OBAtom*> deletedAtomList;
...
for (int nat = 0; nat < smarts.NumAtoms(); ++nat) {
atom = mymol.GetAtom((*matches)[nat]);
deletedAtomList.push_back(atom);
}
// Now, once you have deletedAtomList, iterate through *that* and
delete the atoms
Hope that helps,
-Geoff
|