Helper Functions
This page contains various helper functions useful when working with pMuTT
get_molecular_weight
- pmutt.get_molecular_weight(elements)
Molecular mass (in g/mol) given the elemental composition. Data taken from: https://en.wikipedia.org/wiki/Standard_atomic_weight
- Parameters:
Elemental composition of species.
If a dictionary is passed, the keys are the element symbol, atomic number, or element name and the value is the stoichiometric coefficient. If a string is passed, the formula will be guessed using pmutt.parse_formula
- Returns:
molecular_weight – Molecular weight as float in kg/mol
- Return type:
pmutt_list_to_dict
- pmutt.pmutt_list_to_dict(pmutt_list, key='name')
Converts a pmutt list to a dictionary using a specified attribute. This allows for quicker searching.
- Parameters:
pmutt_list (list of objects) – List of pmutt objects to convert
key (str, optional) – Name of attribute used as the keys for the dictionary. Default is ‘name’
- Returns:
pmutt_dict – Dictionary of pmutt objects
- Return type:
- Raises:
KeyError – Raised if key is not an attribute of the pmutt objects