mstk.chem.formula.Formula¶
- class mstk.chem.formula.Formula(mol_str)¶
Parse elements, numbers and charge from a non-standardized chemical formula.
e.g. H4C3(COH2)2 will be parsed as five carbon, eight hydrogen and two oxygen.
- Parameters:
mol_str (str) –
- atoms¶
Dict of the symbol and number of each chemical element.
- Type:
dict, [str, int]
- charge¶
Net charge of the molecule.
- Type:
int
Methods
__init__(mol_str)to_str()Return the standardized formula in hill order.
Attributes
Number of hydrogen atoms in this formula.
Number of heavy atoms (non-hydrogen atoms) in this formula.
- to_str()¶
Return the standardized formula in hill order.
- Returns:
formula_str
- Return type:
str
- property n_heavy¶
Number of heavy atoms (non-hydrogen atoms) in this formula.
- Returns:
n_heavy
- Return type:
int
- property n_h¶
Number of hydrogen atoms in this formula.
- Returns:
n_h
- Return type:
int