Hi there,

The OBElementTable has some problems, and I propose a replacement.
Conversion of element numbers to symbols and vice versa is one of the
operations that should be optimal in a cheminf toolkit but is not
currently. Here's what I propose:

1. No global etab is necessary, just a collection of namespaced
functions, e.g. OBElement::GetAtomicNum(). There's no need for a class
to store state, as the state will be compiled in.
2. The GetAtomicNum() will be a compiled prefix tree using switch
statements. Right now, if you ask what is the atomic number of Fermium
(element 100), it will do 100 string comparisons.
3. The GetSymbol() will be a array lookup returning compiled-in const
char*. It'll be a whisker more efficient than the current code.
4. We can add an enum for atomic symbols, in anticipation (perhaps) of
removing OBAtom::IsCarbon() and friends in place of
OBAtom::GetAtomicNum() == OBElem:Carbon

The current OBElementTable can be implemented in terms of these new
functions, but ideally it would be deprecated or better still removed.

Regards,
- Noel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to