get_num_formula_units
- emmet.core.utils.get_num_formula_units(composition)
Get the number of formula units in a dict-like composition.
This implementation differs slightly from how some pymatgen/atomate2 internals work. In those, certain formulas, e.g., N, will assume a smallest formula unit of N2. Thus even if a specified composition is {“N”: 1}, the reduced composition will be {“N”: 2}, and the number of formula units 1/2.
This always just returns the greatest common divisor of a composition.
- Return type:
int- Parameters:
composition (dict[Any, int | float])