Module:MolarMass/doc
MyWikiBiz, Author Your Legacy — Saturday January 11, 2025
Jump to navigationJump to searchThis is the documentation page for Module:MolarMass
Template:Module rating This module computes the molar mass (in grams per mole) from a simple chemical formula.
Usage
Exported function :
mm(frame)
– returns the molar mass (in grams per mole)
Uses :
mw.frame
– args[1] = chemical formula
Examples
Example | Wiki code | Result |
---|---|---|
C0.5•1.5H2O | {{#invoke:MolarMass|mm|C0.5•1.5H2O}} | 33.02827 |
Mo | {{#invoke:MolarMass|mm|Mo}} | 95.94 |
H2SO4 | {{#invoke:MolarMass|mm|H2SO4}} | 98.07948 |
Whitespace allowed but cannot break atom-symbols or numbers | {{#invoke:MolarMass|mm|H 2 S O 4}} | 98.07948 |
{{#invoke:MolarMass|mm|C 4 H 1 0}} | 49.05074 | |
Wrong: {{#invoke:MolarMass|mm|C a O}} | Lua error in Module:MolarMass at line 38: Invalid character in formula beginning at 'a O'. | |
Si(OH)4 | {{#invoke:MolarMass|mm|Si(OH)4}} | 96.11486 |
H(C(OH)2)2H | {{#invoke:MolarMass|mm|H(C(OH)2)2H}} | 94.06664 |
CuSO4•H2O[1] | {{#invoke:MolarMass|mm|CuSO4•H2O}} | 159.6096 |
CuSO4•5H2O[1][2] | {{#invoke:MolarMass|mm|CuSO4•5H2O}} | 249.686 |
{{#invoke:MolarMass|mm|CuSO4(H2O)5}} | 249.686 | |
HO0.5 | {{#invoke:MolarMass|mm|HO0.5}} | 9.00764 |
Error: Unknown element symbol | {{#invoke:MolarMass|mm|ZxPo4}} | Lua error in Module:MolarMass at line 49: Unknown element : Zx. |
Error: Unbalanced parentheses | {{#invoke:MolarMass|mm|((Na)Cl}} | Lua error in Module:MolarMass at line 64: Too many '(' in ((Na)Cl. |
{{#invoke:MolarMass|mm|Si(OH))4}} | Lua error in Module:MolarMass at line 53: Too many ')' in Si(OH))4. | |
Error: Misc unrecognized character | {{#invoke:MolarMass|mm|Si(OH)4q}} | Lua error in Module:MolarMass at line 38: Invalid character in formula beginning at 'q'. |
Leading numbers ignored[2] | {{#invoke:MolarMass|mm|H}} | 1.00794 |
{{#invoke:MolarMass|mm|2H}} | 2.01588 | |
Error: Unknown bracket type[3] | {{#invoke:MolarMass|mm|2[AlCl3]}} | Lua error in Module:MolarMass at line 38: Invalid character in formula beginning at '[AlCl3]'. |
Error: Only accepts unformatted text | {{#invoke:MolarMass|mm|H<sub>2</sub>O}} | Lua error in Module:MolarMass at line 38: Invalid character in formula beginning at '<sub>2</sub>O'. |
Notes and references