I'm baffled by the following, and can only assume I have some misunderstanding of how atom Idx's are stored.
I asked for an SSSR using GetSSSR(), then take the first ring from the SSSR. Then I wanted something simple: one atom from that ring. So I take the first IDX from ring->_path, like this: int start_idx = ring->_path[0]; OBAtom *start_atom = GetAtomById(start_idx); Segmentation fault. Hmmm... so after digging around in mol.cpp, I can't see why this should be. Adding a bit of debugging to see what the heck is going on, I find: int start_idx = ring->_path[0]; cout << " start_idx: " << start_idx << ", _atomIds.size: " << _atomIds.size() << endl; for (int i = 0; i < _atomIds.size(); i++) cout << " " << i << ":" << _atomIds[i] << "(" << _atomIds[i]->GetId() <<") "; cout << endl; OBAtom *start_atom = GetAtomById(start_idx); And it prints: start_idx: 10, _atomIds.size: 10 0:0x624ef0(0) 1:0x626ae0(1) 2:0x625350(2) 3:0x6254c0(3) 4:0x624700(4) 5:0x624610(5) 6:0x654e50(6) 7:0x654f60(7) 8:0x624ac0(8) 9:0x656d10(9) So what gives here? I thought Atom Idx's were from 1..N, but this looks like in OBMol::_atomIds, they're 0 to N-1, and the same in ring->_path. I expected _atomIds[0] to be NULL. BTW, all I'm really trying to do is get one atom from each ring in the SSSR as a starting point for assigning the single/double bonds in kekule.cpp, so if someone could point out how to do this seemingly-simple code, I'd appreciate it. I probably just need more sleep or something... Thanks! Craig ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel