class AlloySite(**site_info)

Represents a type of site in an alloy. It is an equivalent to the role PeriodicTableElement plays in configurations.

Parameters:site_info (dict) – A dictionary that maps element symbols or name strings to fractional occupancies.
Returns:The elements that belongs to this site.
Return type:list of type PeriodicTableElement | Vacancy
Parameters:element (PeriodicTableElement | Vacancy) – The element to find the fractional occupancy of.
Returns:The fractional occupation for a given element.
Return type:float
Returns:The average color of the elements (equal weighting).
Type:numpy array
sample(num_atoms, rng=None)

For a given total number of atoms return a random permutation of the elements in this site.

  • num_atoms (int) – The total number of elements that will be returned.
  • rng (numpy.random.RandomState | None) – The random number generator to use. If “None” then the global rng is used.

A randomly permuted list of elements of length num_atoms.

Return type:

list of type PeriodicTableElement | Vacancy

Usage Examples

Define an alloy sites with a single element, two elements with fractional occupancies, and an element and a vacancy.

# Site type with fixed occupancy, sites of these type will NOT be optimized
# in EvolutionarySQS.
site_a = AlloySite(Arsenic=1.0)

# Site type with fractional occupancy, site of these type will be optimized
# in EvolutionarySQS.
site_b = AlloySite(Gallium=0.5, Indium=0.5)

# Site type with an element and a vacancy.
site_c = AlloySite(Silicon=0.8, Vacancy=0.2)


AlloySite types can be used instead of elements to specify sites with fractional occupancies in alloys. These sites can be passed to an AlloyConfiguration which can be used in EvolutionarySQS to generate an optimized random alloy, based on the special quasi-random structure (SQS) method [vdWTdJ+13].

The occupancies of an alloy site are specified by passing the element names as an argument names and the fractional occupancies as argument values to the constructor of the AlloySite object. In addition to elements, vacancies can be given to the constructor, as well, using Vacancy as argument name.

If a lattice site has an AlloySite containing only one element with an occupancy of 1, the element will remain fixed during the SQS optimization, whereas for AlloySite objects with fractional occupancies (i.e. more than one elements and occupancies < 1) this occupation of this site will be optimized according the element ratio specified in the AlloySite object. Currently only a single type of alloy site with fractional is supported and an alloy site can only have binary composition, i.e. at maximum be composed of two elements, or one element and one vacancy.

[vdWTdJ+13]A. van de Walle, P. Tiwary, M. de Jong, D.L. Olmsted, M. Asta, A. Dick, D. Shin, Y. Wang, L.-Q. Chen, and Z.-K. Liu. Efficient stochastic generation of special quasirandom structures. Calphad, 42:13 – 18, 2013. URL: