How to get molar masses of elements?
spizwhiz opened this issue · 4 comments
Thanks for putting this package together, it is useful!
I'm trying to get the mass fraction of each constituent element of a substance, which I had hoped I could do from the substance object itself but haven't figured that one out.
More generally, how can I access the text name or attributes of an element.
I could do this using the dict from Substance.composition, but it returns a dict with keys of z number rather than element name, which seems to be required by chempy.mass_fractions
any way to map z number back to the text element name? it seems like this dictionary probably exits in the code somewhere to return the Substance.composition dictionary in the first place..
Thanks,
Glad to hear that you find it useful,
You can split the composition dictionary into multiple ones with just a single key in each, and then use:
chempy/chempy/util/periodic.py
Line 94 in 6e20085
Oh and the symbol names are in the same file: from chempy.util.periodic import symbols
I'm closing this, feel free to re-open if need be. Also, a PR with additions to e.g. documentation or README is of course always welcomed.