I am trying to work out this issue in a molecular caluclator that I am trying to develop. I would like to go from mass to formula.

So I am given a mass, ie 120.3433. And an equation could have up to 8 C, 3 H, 11 N, 6 S but they have to reasonable close to 120.3433. Just letting a person get a reasonable idea of what a formula could be if they were only given a mass. How do I get the different combinations?
for instance, C8H3N4S6, C7H3N4S6, C6H3N4S6, or something like that. Any help you could offer would be greatly appreciated.

If there is some clarification that you need, please let me know...

Recommended Answers

All 2 Replies

You must also take into account the valence bond of the different elements !
For example : a you can write a simple formule like CH2 but this can never exist as an molecule on it's own. A carbon atom has 4 "hooks" so CH4 can exist as a molecule. CH2 cannot. When the number of atoms increase so will their combinations most of wich cannot be a real molecule.

Member Avatar for diafol

Don't think this idea'll fly. As mentioned, the number of permutations will be staggering, especially if all elements (below or equal to the molecular/formula mass) can be valid. Even organic molecules could be metallo-organic, so it doesn't help v. much unless you specify the constituent elements of the compound.

Also, I assume you're referring to Mr/Fr rather than mass in grams??!

The fact that C can form triple, double bonds as well as multiple aromatic rings (heterogeneous/homogeneous) as well as alicylic rings, will just confuse matters. I don't think you'll find an algorithm to weed out the possible and impossible answers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.