It's a long shot, but would anyone out there know how to write a program that can interpret chemical formulas? I am trying to make a computer program to convert chemical formulas to dot diagrams. Ive gotten it to be able to tell how many atoms of each element are in a reactant. The problem I'm struggling with is telling how they are bonded. I need to know which atom is bonded to which, not just how many there are. I can't seam to get it to work. For example: I enter in H2O, what it should show is both hydrogen atoms covalently bonded to the oxygen. Sometimes however the hydrogens diatomicly bond with each other, and leave a lone oxygen. How is the program supposed to know what to do? I accept that what I am trying to do could simply be impossible, if you think so too, or have any suggestions please tell.