smact.metallicity module#

Utility functions for handling intermetallic compounds in SMACT.

smact.metallicity.get_d_block_element_fraction(composition: str | Composition) float[source]#

Calculate the fraction of d-block elements in a composition.

Implemented using get_element_fraction helper with smact.d_block set.

smact.metallicity.get_distinct_metal_count(composition: str | Composition) int[source]#

Count the number of distinct metallic elements in a composition.

smact.metallicity.get_element_fraction(composition: str | Composition, element_set: Collection[str]) float[source]#

Calculate the fraction of elements from a given set in a composition.

This helper function is used to avoid code duplication in functions that calculate fractions of specific element types (e.g., metals, d-block elements).

Parameters:
  • composition – Chemical formula as string or pymatgen Composition

  • element_set – Set of element symbols to check for

Returns:

Fraction of the composition that consists of elements from the set (0-1)

Return type:

float

smact.metallicity.get_metal_fraction(composition: str | Composition) float[source]#

Calculate the fraction of metallic elements in a composition.

Implemented using get_element_fraction helper with smact.metals set.

smact.metallicity.get_pauling_test_mismatch(composition: str | Composition) float[source]#

Calculate a score for how much the composition deviates from ideal Pauling electronegativity ordering.

Higher mismatch => more difference (ionic, e.g. NaCl). Lower mismatch => metal-metal bonds (e.g. Fe-Al).

Returns:

Mismatch score (0=perfect match, higher=more deviation, NaN=missing data)

Return type:

float

smact.metallicity.metallicity_score(composition: str | Composition) float[source]#

Calculate a score (0-1) indicating the degree of a compound’s metallic/alloy nature.

  1. Fraction of metallic elements

  2. Number of distinct metals

  3. d-block element fraction

  4. Electronegativity difference (Pauling mismatch)

  5. Valence electron count proximity to 8

Parameters:

composition – Chemical formula or pymatgen Composition