ANN: UnitfulMoles.jl

Announcing UnitfulMoles.jl!

UnitfulMoles.jl allows you to use and define specific molar quantities in your equations. Instead of using u"mol/mol" and similar, you can use u"molCO2/molH20". You can also do conversion to mass automatically for all the standard elements, and for compounds you define with @compound.

julia> 3u"mmolFe" / 10u"molC"
0.3 mmolFe molC⁻¹

julia> @compound CH₄
molCH₄

julia> 1molCH₄ |> u"g"
16.043 g

You can also define custom mol types with @mol, and fractional moles like Cmol with @xmol. Again mass conversion and mol/cmol conversion just work.

I wrote this package a few years ago and didn’t do anything with it, so many thanks go to @briochemc for getting it ready to publish, and doing great work setting up subscript numbering, which looks very slick!

Anyway, check it out, hopefully someone finds it useful.

Next weeks ANN: GeoData.jl

11 Likes

Great work! Perhaps we could abstract Compound parsing interface from ChemEquations and UnitfulMoles into a separate Compounds package. Both have their specifics which could be combined for an ultimately better parsing.

4 Likes

That sounds like a good idea - just robust compound string parsing.

1 Like