get_formula_from_components

emmet.core.featurization.robocrys.condense.component.get_formula_from_components(components, molecules_first=False, use_iupac_formula=True, use_common_formulas=True)

Reconstructs a chemical formula from structure components.

The chemical formulas for the individual components will be grouped together. If two components share the same composition, they will be treated as equivalent.

Return type:

str

Parameters:
  • components (list[dict[str, Any]])

  • molecules_first (bool)

  • use_iupac_formula (bool)

  • use_common_formulas (bool)

Args:
components: A list of structure components, generated using

pymatgen.analysis.dimensionality.get_structure_components.

molecules_first: Whether to put any molecules (zero-dimensional

components) at the beginning of the formula.

use_iupac_formula (bool, optional): Whether to order formulas by the

iupac “electronegativity” series, defined in Table VI of “Nomenclature of Inorganic Chemistry (IUPAC Recommendations 2005)”. This ordering effectively follows the groups and rows of the periodic table, except the Lanthanides, Actanides and hydrogen. If set to False, the elements will be ordered according to the electronegativity values.

use_common_formulas: Whether to use the database of common formulas.

The common formula will be used preferentially to the iupac or reduced formula.

Returns:

The chemical formula.