match problem with hypervalent C atoms

User 870ab5b546

04-03-2005 02:31:44

The structure CH5 (five explicit H atoms added to C) is coming up as an exact match to CH4 (with the four H atoms either explicit or implicit). Any reason why? I have reproduced the problem in another case, too.





If this feature is intentional, can we turn it off?

ChemAxon a3d59b832c

04-03-2005 07:43:27

Hi Bob!





The reason is that search expects valid input molecules.





CH5 does not exist, and the valence violation may confuse the search.





I suggest to check the molecule drawn by the student for valence errors before doing the search:





Code:
Molecule m;


boolean valenceError = false;





m.valenceCheck();


for(int i=0; i < m.getAtomCount(); i++) {


    MolAtom ma = m.getAtom(i);


    if(ma.hasValenceError()) {


        // VALENCE ERROR at atom i:


        valenceError = true;


    }


}








But you have to be careful in cases where you ask for only a fragment of a molecule. (In this case the valence in the fragment may be incorrect, but it will be correct when the whole molecule is sketched.)

User 870ab5b546

06-03-2005 02:11:26

Thanks, Szabolcs. Your code worked great for us.