CHEMIO / chemistry_rails

A gem for validating chemical formula and calculating analysis
MIT License
5 stars 3 forks source link

Not every formula is parsed correct #2

Closed azranel closed 9 years ago

azranel commented 9 years ago

Check formula like 'C3H6(OH)2' (Propylene Glycol). Creating object with that formula returns

formula = ChemistryRails::Formula.new('C3H6(OH)2')
#<ChemistryRails::Formula:0x000000028d9eb8 @formula="C3H6(OH)2", @options={}, @is_OH=false, @elements={"C"=>3, "H"=>1, "O"=>1}>
alexined commented 9 years ago

We made it so that only molecular formulas are accepted. For propylene glylcol it will be C3H8O2. The reason we did this is because we are using it for elemental analysis calculations in which case structure is irrelevant.