A parser for molecule formula. Nested brackets are supported.
Project description
pymolecule-parser: A parser for a molecule formula that supports nested brackets
Installation
pip install pymolecule-parser
Usage
from pymolecule_parser import parse
parse("H2O") # {'H': 2, 'O': 1}
parse("3H2O") # {'H': 6, 'O': 3}
parse("H2O2(OH)2") # {'H': 4, 'O': 4}
parse("[Co(NH3)6]Cl3") # {'Co': 1, 'N': 6, 'H': 18, 'Cl': 3}
Limitations
The following notations are not supported.
- Ion notations
- For example,
[Cu(NH3)4]2+
is not supported. UseCu(NH3)4
instead.
- For example,
- middle dot
·
- For example,
CuSO4·5H2O
is not supported. UseCuSO4(H2O)5
instead.
- For example,
License
Apache License 2.0
Author
Kohei Noda
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pymolecule_parser-0.0.0.tar.gz
(10.1 kB
view hashes)
Built Distribution
Close
Hashes for pymolecule_parser-0.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 082271d93a78f485b5875f38ece0dcae2f9ac9e87d6ffa7f7d72a48649f5dced |
|
MD5 | 8b5808a26319325921d46c4eed6fab3d |
|
BLAKE2b-256 | 8537cb820b785ca77279e727550fab64510cc23b8e3956d0cf529da83ed00a80 |