pkienzle / periodictable

Extensible periodic table for python
http://periodictable.readthedocs.org
Other
147 stars 37 forks source link

Use mhchem formula syntax #49

Closed pkienzle closed 8 months ago

pkienzle commented 2 years ago

The mhchem package used by mediawiki and stackexchange uses a similar ascii chemical formula language to the one used by periodictable.

Adjust the formula parser to accept mhchem syntax or document how it is different.

pkienzle commented 8 months ago

Bits of mhchem syntax from the manual that won't work in periodictable.

I'm not seeing anything particularly compelling, so closing the ticket.

example description
Hg^2+ ^ion
Fe^{II}Fe^{III}2O4 oxidation states
[Hg^{II}I4]^2- square bracket
H2O(l) solid/liquid/gas/aqueous; not needed until we have phase-based density
1/2 H2O fractions
(1/2) H2O parenthesized fraction
A-B=C#D bonds
A\bond{-}B\bond{=}C\bond{#}D bonds
A\bond{1}B\bond{2}C\bond{3}D bonds
A\bond{~}B\bond{~-}C bonds
A\bond{~--}B\bond{~=}C\bond{-~-}D bonds
A\bond{...}B\bond{....}C bonds
A\bond{->}B\bond{<-}C bonds
A - B subtraction, not bonding
A = B equality, not bonding
A \pm B plus/minus
OCO^{.-} unpaired electrons
NO^{(2.)-} radical dots
Li^x_{Li,1-2x}Mg^._{Li,x}$V$'_{Li,x}Cl^x_{Cl} kröger-vink notation
KCr(SO4)2*12H2O dot separator
KCr(SO4)2.12H2O dot separator (conflicts with fractional formulas)
KCr(SO4)2 * 12 H2O spacing to disambiguate
$n$ H2O variables
^{227}_{90}Th+ prefix isotope, z
^227_90Th+ prefix isotope, z without braces
H{}^3HO disambiguation of H{3+}HO and HH[3]O
NO_x variables
Fe^n+ variables
NH3 ^ gas
NaCl v precipitate
NaCl (v) precipitate
NO^* excited state
1s^2-N orbitals
iPr ??
~Fe approximate