class metallurgy.alloy.Alloy[source]

An alloy, a mixture of chemical elements with specific percentages.

composition[source]

Dictionary matching element symbols to atomic percentages.

structure[source]

String referring to a crystal structure prototype which defines atomic percentages.

constraints[source]

Dictionary of constraints to follow when adjusting atomic percentages.

alloy

class Composition(metallurgy.alloy.OrderedDict)[source]

Atomic percentages of elements in an alloy.

property composition : Composition[source]

Dictionary of elements and percentages in the alloy.

property elements : list[source]

List of elements in the alloy.

property elements_structure_order : list[source]

List of elements in the alloy in the order of the structure basis.

property num_elements : int[source]

Number of elements in the alloy.

property total_percentage : float[source]

Sum of percentages in the alloy composition.

add_element(element: str, percentage: float | None = 0.0)[source]

Adds an element to the alloy composition.

remove_element(element: str)[source]

Removes an element from the alloy composition.

Public members

Alloy(composition: str | dict | Alloy, ...)[source]

Initialize self. See help(type(self)) for accurate signature.

__repr__()[source]

Return repr(self).

__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).

property structure : str[source]
reorder_composition()[source]
constrain_max_elements()[source]

Removes elements from an alloy if there are more elements than allowed by the max_elements constraint.

constrain_min_elements()[source]

Adds elements to an alloy if there are fewer elements than allowed by the min_elements constraint.

alloy.utils

on_composition_change()[source]

Called when composition property changes.

ensure_constrained_elements_present()[source]

Adds to the composition any elements with minimum percentage constraints that are missing

rescale()[source]

Adjust elemental percentages to match constraints

constrain_num_elements()[source]

Applies max and min element count constraints.

constraints_satisfied() bool[source]

Check for satisfaction of the constraints acting on an alloy.

clamp_composition()[source]

Adjust elemental percentages such that they sum to 1

determine_percentage_constraints()[source]

Determine the current constraints on an alloy composition.

to_string() str[source]

Convert the alloy composition to a string

to_pretty_string() str[source]

Convert alloy composition to string with LaTeX formatting of subscripts

to_dict() dict[source]

Convert the alloy composition to a dictionary

round_composition()[source]

Round elemental percentages in composition while maintaining sum


Last update: Jun 08, 2023