exatomic.formula module

Simple Formula

class exatomic.formula.SimpleFormula(data)[source]

Bases: Series

A simple way of storing a chemical formula that contains no structural information. Element symbols are in alphabetical order (e.g. ‘B’, ‘C’, ‘Cl’, ‘Uuo’)

>>> water = SimpleFormula('H(2)O(1)')
>>> naoh = SimpleFormula('Na(1)O(1)H(1)')
>>> naoh
SimpleFormula('H(1)Na(1)O(1)')
property mass

Returns: mass (float): Mass (in atomic units) of the associated formula

as_string()[source]
Returns:

formula (str) – String representation of the chemical formula.

exatomic.formula.string_to_dict(formula)[source]

Convert string formula to a dictionary.

Parameters:

formula (str) – String formula representation

Returns:

fdict (dict) – Dictionary formula representation

exatomic.formula.dict_to_string(formula)[source]

Convert a dictionary formula to a string.

Parameters:

formula (dict) – Dictionary formula representation

Returns:

fstr (str) – String formula representation