AFAIK, all OBMol's are self-consistent. I'm guessing this is not the answer you are looking for. Perhaps the following is (taken from my notes at https://gist.github.com/baoilleach/4232459):
""" In the Open Babel world, the "valence" methods of an atom refer to the number of bonds, rather than the sum of BOs (which is actual valence). GetValence() -> Num explicit bonds GetImplicitValence() -> Num explicit bonds plus num implicit bonds (i.e. total number of bonds) (_impval property on OBAtom) GetHvyAtomValence() -> Num explicit bonds to non-H atoms To find the number of implicit Hs, GetImplicitValence() - GetValence() BOSum() -> The sum of the BOs of explicit bonds (otherwise known as ExplicitValence) To find the actual valence: BOSum() + GetImplicitHydrogenCount() """ - Noel On 7 November 2013 09:23, Rafel Israels <rafelisra...@googlemail.com> wrote: > Hello, > > what would be the correct method to check the consistency of bonds in a > molecule ? > > My first try (below) is wrong: e.g. Aspirin fails this test and if I > understand correctly the reason seems that I compare total number of bonds > (i.e. counting double bonds twice) with maximum/expected number of > neighbors, which (for me unexpected but probably correct) considers > hybridization and equals 3 for SP2-carbons ? > > Is there something like atom->GetImplicitBOSum() and/or what would be the > correct implementation to check basic chemistry rules ? > > regards, > > Rafel > > > FOR_ATOMS_OF_MOL(atom, obMol) > if (atom->BOSum() > atom->GetImplicitValence()) > return false; > return true; > > > > ------------------------------------------------------------------------------ > November Webinars for C, C++, Fortran Developers > Accelerate application performance with scalable programming models. Explore > techniques for threading, error checking, porting, and tuning. Get the most > from the latest Intel processors and coprocessors. See abstracts and > register > http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk > _______________________________________________ > OpenBabel-discuss mailing list > OpenBabel-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > ------------------------------------------------------------------------------ November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss