Menu

#635 Stoichiometric formula is incorrect wrt hydrogen count

v_1.2.x
open
nobody
None
1
2012-10-08
2012-10-08
Anonymous
No

Loading the following piece of CML into 1.1.0 Win7 (x86_64)

(see attached)

and then obtaining the stoichiometric formula via View-->Properties-->Molecular Properties
give an incorrect result of C37H37FeN5O6S ; it is missing a hydrogen atom... it should be C37H38FeN5O6S:

mw529@cyclops:~/code/avogadro$ grep 'elementType="C"' C37H38O6N5S1FE1.cml | wc -l
37
mw529@cyclops:~/code/avogadro$ grep 'elementType="H"' C37H38O6N5S1FE1.cml | wc -l
38
mw529@cyclops:~/code/avogadro$ grep 'elementType="O"' C37H38O6N5S1FE1.cml | wc -l
6
mw529@cyclops:~/code/avogadro$ grep 'elementType="N"' C37H38O6N5S1FE1.cml | wc -l
5
mw529@cyclops:~/code/avogadro$ grep 'elementType="S"' C37H38O6N5S1FE1.cml | wc -l
1
mw529@cyclops:~/code/avogadro$ grep 'elementType="Fe"' C37H38O6N5S1FE1.cml | wc -l

Note, if one trys to add a hydrogen to any carbon, the program crashes... I'm also seeing this on the git HEAD with Linux.

Also, if the bondArray element is removed completely from the CML, then the correct formula is obtained, however, a crash is still observed when hydrogen is added to a random carbon.

Could this be an off-by-one issue in that CML starts counting its atom id from 1, whereas C++ will be starting from 0?

1 Attachments

Discussion