Unitful.jl
Unitful.jl copied to clipboard
AMU and g/mol are not dimensionally compatible??
I have some masses in atomic mass units and energy units that are kcal/mol. For some reason Unitful won't let me uconvert() atomic mass units into g/mol even though they are equivalent (e.g. mass of Carbon is 12.011 u or g/mol). This prevents the per mol quantity from canceling with the energy and its breaks everything.
Is there some way around this?
u is a unit of mass and g/mol is a unit of molar mass. These are different dimensions, so one cannot be converted to the other. Also, since 20 May 2019, 1 u and 1 g/mol are not exactly equivalent (see below).
To get an approximate result, you can multiply the mass by the avogadro constant before converting to g/mol:
julia> uconvert(u"g/mol", 1u"u*Na")
0.9999999996544214 g mol^-1
The reason that this is not exactly 1 g/mol is the following:
This package follows the latest version of the SI unit system. Since the 2019 redefinition of the base SI units, the molar mass of a substance in g/mol and the mass of one of its molecules in u have slightly different values.
In short, before 2019, the Avogadro constant was an inexact measurement and the molar mass constant was defined to be exactly 1 g/mol. In 2019, the Avogadro constant was defined to be exact (because its value forms the basis for one of the SI base units, the mol) and as a result, the molar mass constant is no longer exact.
For more information, see the following links:
https://en.wikipedia.org/wiki/Dalton_(unit)#2019_redefinition_of_the_SI_base_units https://en.wikipedia.org/wiki/2019_redefinition_of_the_SI_base_units#Mole https://en.wikipedia.org/wiki/Molar_mass_constant