## Abstract

Crystalline materials have atomic-scale fluctuations in their chemical composition that modulate various mesoscale properties. Establishing chemistry–microstructure relationships in such materials requires proper characterization of these chemical fluctuations. Yet, current characterization approaches (e.g., Warren–Cowley parameters) make only partial use of the complete chemical and structural information contained in local chemical motifs. Here we introduce a framework based on E(3)-equivariant graph neural networks that is capable of completely identifying chemical motifs in arbitrary crystalline structures with any number of chemical elements. This approach naturally leads to a proper information-theoretic measure for quantifying chemical short-range order (SRO) in chemically complex materials and a reduced representation of the chemical motif space. Our framework enables the correlation of any per-atom property with their corresponding local chemical motif, thereby enabling the exploration of structure–property relationships in chemically complex materials. Using the MoTaNbTi high-entropy alloy as a test system, we demonstrate the versatility of this approach by evaluating the lattice strain associated with each chemical motif, and computing the temperature dependence of chemical-fluctuations length scale.

### Similar content being viewed by others

## Introduction

Metallic^{1} and ceramic^{2} alloys are often synthesized in phases where the chemical elements are dispersed almost randomly on a crystal lattice, namely solid solution (SS) phases. Characterizing the spatial distribution of chemical elements at the atomic scale is critical in establishing structure–property relationships in SSs. For example, spatial variations in chemistry cause strengthening via solute-dislocation-like interactions^{3}, while the percolation of locally passive chemical regions is associated with corrosion resistance^{4}. In a truly random SS the spatial distribution of chemical elements is defined by the underlying geometry of the crystal lattice and its associated symmetries. However, in real materials, thermal effects induce a trade-off between enthalpy and entropy that favors low-energy chemical motifs^{5,6,7,8} (Fig. 1a), thereby affecting the spatial distribution of chemical elements. This deviation from randomness is known as chemical short-range order (SRO).

The state of SRO is often characterized using the first nearest neighbors (1NN) Warren–Cowley (WC) parameters^{9,10,11,12,13,14,14,15,16,17,18,19}, defined as

where A and B are chemical elements, *c*_{A} is the average concentration of atoms of type A, *N* is the total number of atoms, and *p*(A∣B) is the probability of finding an atom of type A in the 1NN shell of a B atom, which can be broken down into a per-chemical-motif contribution *p*^{(i)}(A∣B). When considering only the 1NN, these *n*_{c}(*n*_{c} + 1)/2 independent WC parameters (where *n*_{c} is the number of chemical elements in the system) provide an incomplete^{8} description of SRO at the first-neighbor shell since distinct chemical motifs with the same chemical concentration are indistinguishable and contribute equally to the WC parameters. For example, Fig. 1b illustrates several chemical motifs with different bonding environments that all have the same contribution to WC parameters. Consequently, as shown in our previous work (ref. ^{8}), reverse-engineered atomic configurations from WC parameters yield unphysical degenerate solutions, and the lack of non-degenerate descriptors prevents the connection of per-atom properties (e.g., generalized stacking fault energy^{20} and magnetic moments^{15}) with their corresponding chemical motif. Meanwhile, multi-shell WC parameters can be seen as a full characterization of the *chemical concentration* variation with distance^{21,22}. Despite the completeness of this description (for chemical concentration), understanding and quantifying the compatibility conditions among WC parameters across different shells remains a longstanding challenge^{23}.

To move beyond the characterization of bonding preferences provided by WC parameters, experimental efforts have employed transmission electron microscopy techniques^{24,25,26,27,28,29,30,31} to assess spatial correlations among atomic columns’ chemistry. Yet, these methods are unable to access the complete 3D spatial chemical distribution, and the signals associated with SRO may have originated from other atomistic features^{32,33,34}. Meanwhile, atom probe tomography approaches^{35,36,37,38} are nascent and provide complete 3D characterization, but are still limited in accuracy and by anisotropic resolution^{39,40}. As experimental efforts evolve in their ability to capture the spatial distribution of chemical elements and correlate them with material properties, they would benefit from a framework for the non-degenerate identification of chemical motifs and quantification of SRO beyond WC parameters.

Here, we propose an approach to characterize the state of SRO using all of the 3D atomistic information available. By employing machine learning (ML) and group theory together, we are able to extend the local chemical motif method introduced in ref. ^{8} into a framework that is applicable to arbitrary crystal lattices with any number of elements; the mathematical foundation for such generalization is provided. This approach naturally leads to a proper information-theoretic measure for quantifying SRO and a reduced—but complete (i.e. non-degenerate)—representation of the chemical motif space. We demonstrate the application of this approach by identifying all possible chemical motifs in face-centered cubic (fcc), body-centered cubic (bcc), and hexagonal close-packed (hcp) systems containing up to five chemical elements, and quantitatively characterizing the state of SRO in the bcc MoTaNbTi high-entropy alloy using a machine learning potential.

## Results

### Representation and enumeration of chemical motifs

The local chemical motif \({{\mathcal{M}}}_{i}\) is defined as the group of atoms composed of a central atom *i* and its first coordination polyhedron (1CP), as illustrated in Fig. 1a. The resulting polyhedron is the cornerstone of our atomic-scale analysis because it completely characterizes the local atomic environment surrounding atom *i*. In a fcc lattice, the 1CP (Fig. 1a) takes the form of a cuboctahedron with octahedral symmetry point group *O*_{h}. This cuboctahedron is comprised of eight triangular faces, six square faces, and 12 vertices, representing the *N*_{a} = 12 1NN surrounding the central atom. Consequently, the chemical motif consists of 36 edges connecting 13 atoms (including the central atom). Out of these edges, 24 correspond to connections among the 1NN, while the remaining 12 edges account for the connections between the central atom and the 1NN. A similar description of the geometry of bcc (Fig. 2b) and hcp (Fig. 2c) motifs is provided in Supplementary Section 1.

A chemical motif \({{\mathcal{M}}}_{i}\) is deemed equivalent to another motif \({{\mathcal{M}}}_{j}\) (i.e., \({{\mathcal{M}}}_{i} \sim {{\mathcal{M}}}_{j}\)) if they are related through Euclidean symmetry operations. Conversely, two motifs are said to be distinct (i.e., \({{\mathcal{M}}}_{i}\nsim {{\mathcal{M}}}_{j}\)) if they cannot be related to each other by any Euclidean symmetry. Figure 1c illustrates how a particular motif is equivalent to two other motifs and distinct from a third motif.

Consider a system with *n*_{c} chemical elements in a crystal structure in which atoms have *N*_{a} 1NN. Out of the \({n}_{{\rm{c}}}^{{N}_{{\rm{a}}}+1}\) possible chemical motifs that can be constructed, only a select few are distinct. To analytically count the number of distinct chemical motifs, we apply Polya’s *pattern inventory* formula (Eq. (7)), which stems from Polya’s enumeration theory (see the “Methods” subsection “Polya’s enumeration theory”). This approach is a general mathematical formalism based on group theory for counting the number of distinct colorings of objects under the action of a permutation group. When adapting Polya’s theory to the counting of distinct chemical motifs, the objects being counted are only the 1CPs because the role of the central atom (Fig. 1a) is trivial to account for as a simple multiplicative factor given by the number of atom types *n*_{c} (represented here by the number of different colors). The symmetry of the 1CP is defined by the crystal lattice, which also defines the permutation group under consideration.

We illustrate this approach by applying it to fcc, bcc, and hcp three-element (*n*_{c} = 3) systems. The outcome of Polya’s pattern inventory formula (Eq. (7)) is a polynomial in which the coefficients indicate the chemical composition of the 1CP, while the prefactors are the number of distinct 1CPs with that same composition. While these polynomials are given in Supplementary Section 2, the information contained in them is better represented in a ternary diagram (Fig. 2) that indicates the chemical composition of the 1CP along with the corresponding number of distinct 1CPs with that composition. The number of distinct 1CPs for a fixed chemical composition quantifies the degeneracy of the WC representation for that 1CP. For example, for the three-element fcc system (Fig. 2a), there are 768 distinct equiatomic 1CPs, which all have the same WC parameters given a specific central atom type. Summing the number of distinct motifs across this compositional diagram (i.e., all of the 91 possible 1CP compositions) results in a total of only 3 × 12, 111 = 36, 333 distinct chemical motifs, out of the 3^{13} = 1,594,323 possible ones.

The enumeration of distinct motifs reveals the incomplete description of WC-like parameters, which may result in the misleading characterization of the diversity of chemical motifs in physical systems. This problem becomes particularly alarming for chemically complex materials, such as high-entropy alloys and ceramics. In Table 1 we have applied our approach to up to *n*_{c} = 5 chemical elements. Consider, for example, that for a five-element hcp system, there are only 9, 100 distinct chemical motif compositions but more than 100 million distinct chemical motifs: a difference of *four orders of magnitude* in the complexity of the chemical representation.

### Classifying chemical motifs with machine learning

While Polya’s theory enables the counting of distinct chemical motifs, it is not capable of classifying an unidentified motif, which is a fundamental component of the framework illustrated in Fig. 1c. Classification of an unknown chemical motif requires finding which distinct motif is equivalent to the unknown motif. However, rigorously establishing this equivalency requires the determination of graph isomorphisms, which is a computational task not typically solvable within polynomial time. Here we circumvent this computational limitation by employing a randomly initialized E(3)-equivariant graph neural network^{41} (E(3)-GNN, see the “Methods” subsection “E(3)—equivariant graph neural network”). GNNs are often capable of creating representations that capture intra-graph relationships and topology, effectively distinguishing between graph structures^{42}. This capability can also be understood by the similarity between GNNs’ message-passing algorithm to the Weisfeiler–Lehman test for graph isomorphism^{43,44}.

Our E(3)-GNN employs a graph convolutional neural network on the 1CP, where nodes represent atoms and edges represent the connections between them. The network processes this data through hidden layers where graph features undergo transformations adhering to the principles of irreducible representations of 3D rotations and spatial inversion; in the end, a fingerprint **z**_{i} that encodes the chemical motif \({{\mathcal{M}}}_{i}\) is generated. With this neural network architecture, any two *equivalent* chemical motifs (i.e., motifs that can be related to each other by an E(3) symmetry operation) are guaranteed to have the same fingerprint; or, if \({{\mathcal{M}}}_{i} \sim {{\mathcal{M}}}_{j}\) then **z**_{i} = **z**_{j}.

One nuanced point of this approach is that it does not guarantee that any two *distinct* chemical motifs will have different fingerprints, i.e., if \({{\mathcal{M}}}_{i} \nsim {{\mathcal{M}}}_{j}\) then it is not guaranteed that **z**_{i} ≠;**z**_{j}. Thus, validation is required. Here, we accomplish this by evaluating the pattern inventories in Table 1 with E(3)-GNN as follows. First we create a data set with all possible 1CPs for a given crystal lattice and number of chemical elements, then we compute the fingerprint of each 1CP with E(3)-GNN. A grouping algorithm is employed to cluster all equivalent 1CPs, from which the number of distinct 1CPs with the same composition can be counted. This ML-obtained pattern inventory matches exactly each of the analytically obtained pattern inventories in Table 1, confirming that our framework is able to differentiate between any possible chemical motifs in these systems. Notice how this approach can quickly become computationally intractable: a five-element HCP system requires the creation of 1.2 billion graphs. This is addressed in Supplementary Section 3, where we discuss how to significantly reduce the computational cost by validating the network’s expressivity solely on a symmetrically complete subset of the data set, resulting in orders of magnitude savings.

### Information-theoretic quantification of short-range order

The probability of observing a distinct motif \({{\mathcal{M}}}_{i}\) at temperature *T* is

where \(N({{\mathcal{M}}}_{i},T)\) is the number of times that \({{\mathcal{M}}}_{i}\) is observed in the thermally equilibrated system at temperature *T*, and the sum in the denominator is over all *N*_{dm} distinct motifs \({{\mathcal{M}}}_{j}\). A random SS (indicated here by *T* = *∞*) is such that \(N({{\mathcal{M}}}_{i},\infty )\) is proportional to the total number of motifs equivalent to \({{\mathcal{M}}}_{i}\), given by \(m({{\mathcal{M}}}_{i})\). For example, Fig. 3a illustrates one motif for each of the possible values of \(m({{\mathcal{M}}}_{i})\) observed in the three-element systems of Fig. 2. Meanwhile Fig. 3b shows the fraction of distinct motifs with a given value of \(m({{\mathcal{M}}}_{i})\).

Thermal effects in a real SS induce a trade-off between enthalpy and entropy that favors low-energy chemical motifs^{5,6,7,8}. This deviation from randomness—namely, chemical SRO—can be quantified with proper information-theoretic measurement of the difference between \(P({\mathcal{M}},T)\) and \(P({\mathcal{M}},\infty )\), known as the Kullback–Leibler (KL) divergence^{45}:

To illustrate the capabilities of this approach, we have evaluated \(P({{\mathcal{M}}}_{i},T)\) through Monte Carlo (MC) simulations for the bcc high-entropy alloy MoTaNbTi across a wide range of temperatures (see the Methods section “Monte Carlo simulations”). The KL divergence (Fig. 4a) is seen to approach zero at high temperatures, indicating that the probability of observing motifs is converging towards a random SS (i.e., entropy-dominated). Conversely, at low temperatures, the KL divergence is significantly different from zero, indicating deviations from a random SS due to SRO (i.e., an entropy–enthalpy trade-off). Figure 4a shows that Eq. (2) is a convenient form of summarizing the complex information about all motifs—provided by \(P({{\mathcal{M}}}_{i},T)\)—into a single quantity.

This approach also enables the association of any per-atom property with their corresponding motif and \(P({{\mathcal{M}}}_{i},T)\). For example, Fig. 4b shows the distribution of local lattice strains^{46,47} for the entire system (see the “Methods” subsection “Local lattice strains”), with no atomic-scale granularity in understanding. Meanwhile, using our approach, we obtain Fig. 4c, where representative chemical motifs are associated with their corresponding local lattice strain. In this figure it can be seen that lower strains are associated with motifs that are observed much more often in thermal equilibrium when compared to a random SS, as measured by the probability ratio \(P({{\mathcal{M}}}_{i},T)/P({{\mathcal{M}}}_{i},\infty )\) that is part of Eq. (2).

The inset in Fig. 4c further illustrates the nuanced characterization of SRO provided by our approach. It is commonly accepted that chemical SRO is the precursor of ordered structures (or precipitates), such as the B2 structure shown in Fig. 4c (inset on the left). In this figure, we quantify this concept by showing that the two motifs associated with the TaMo B2 exhibit lower than average local lattice strain while being significantly more frequent in the thermally equilibrated system than in a random SS. Notice that because the system is still in the SS phase (Fig. 4c, inset on the right), the B2 motif with Ta at the center is more often observed in “defected” states (i.e., with one Ti or Nb atom substituting the site of a Mo) than in their ideal configuration expected from the B2 ordered structure. Supplementary Section 5 shows the decomposition of other ordered crystal structures into local chemical motifs.

### Motifs dissimilarity

The relative probability of motifs (Eq. (2)) is not a complete characterization of SRO because it does not contain any information about the spatial distribution of these motifs. This missing information can be provided by rigorously defined correlation functions^{8} between a motif \({{\mathcal{M}}}_{i}\) and other motifs at a distance *r* from \({{\mathcal{M}}}_{i}\):

where *d*_{ij} is a dissimilarity measure between motifs \({{\mathcal{M}}}_{i}\) and \({{\mathcal{M}}}_{j}\) (i.e., it quantifies how different these two motifs are), with \({ \langle \ldots \rangle }_{| {{\bf{r}}}_{i}-{{\bf{r}}}_{j}| = r}\) being an average that includes only motifs \({{\mathcal{M}}}_{j}\) (located at **r**_{j}) at a distance *r* from \({{\mathcal{M}}}_{i}\) (located at **r**_{i}). While the framework developed in ref. ^{8} is still applicable, the dissimilarity measure *d*_{ij} needs to be extended to account for arbitrary lattice geometries and a number of elements.

Here we generalize the definition of *d*_{ij} (Eq. (4) in ref. ^{8}) by rewriting it as the sum of three separate terms:

where the weights *w*_{1}, *w*_{2}, and *w*_{3} govern the importance of each term, which are all normalized to fall within the closed interval [0, 1]. The definition of each dissimilarity component in Eq. (4) is described next, with the support of Supplementary Fig. 3 as a visual guide to the calculation of each component.

The first term (\({d}_{ij}^{{\rm{cat}}}\)) captures the dissimilarity between the central atoms

where *τ*_{i} is the central atom type of \({{\mathcal{M}}}_{i}\), and *δ* is the Kronecker delta.

The second term (\({d}_{ij}^{{\rm{com}}}\)) represents the dissimilarity between the chemical compositions of the 1CPs:

where **k**_{i} are the Cartesian coordinates obtained from the barycentric coordinates of a (*n*_{c}−1)-simplex (see the “Methods” subsection “Simplex and barycentric coordinates”). For example, for a ternary alloy the motifs at different vertices of the composition triangle are separated by a dissimilarity distance of one (see the section “Chemical composition space" in Supplementary Fig. 3).

Finally, \({d}_{ij}^{{\rm{dmo}}}\) represents the dissimilarity between distinct motifs with the same 1CP chemical composition:

where **z**_{i} is the E(3)-GNN embedding of the \({{\mathcal{M}}}_{i}\) graph, and *M* is a normalization factor set to the maximum *L*_{2} distance among all possible motifs.

The weights (*w*_{1}, *w*_{2}, and *w*_{3}) for each dissimilarity component are chosen to be proportional to the number of chemical bonds associated with their corresponding structures in the motif:

where *N*_{a} is the number of atoms in the 1CP, and *N*_{b} is the number of bonds within the 1CP. For example, the fcc crystal structure has *N*_{a} = 12 and *N*_{b} = 24, while in bcc *N*_{a} = 8 and *N*_{b} = 12.

Using this generalized approach, we have completed the characterization of SRO in MoTaNbTi, which was initiated in Fig. 4. Figure 5a shows the spatial correlation function for a representative motif in this system. With correlation functions such as this one, it is possible to evaluate the length scale^{8} (*ξ*_{i}) of chemical fluctuations for each motif \({{\mathcal{M}}}_{i}\), which is an important materials parameter in the understanding of various chemistry–microstructure relationships^{3,4}. Figure 5b shows the probability distribution of the length scale of chemical fluctuations, where it can be seen that the effect of SRO is to decrease the average length scale. Figure 5 also shows that the distribution of chemical fluctuations converges towards the distribution of a random SS (i.e., entropy-dominated) at high temperatures, similar to what was observed in Fig. 4a for the probability distribution of chemical motifs.

Notice that \({d}_{ij}^{{\rm{dmo}}}\) (Eq. (6)) directly depends on the E(3)-GNN embedding, which makes the correlation functions implicitly depend on the model parameters. In Supplementary Section 7, we demonstrate that the chemical fluctuation length scale is robust against different random initializations of the E(3)-GNN. The authors believe that this robustness originates from the correlation function \({C}_{i}(r,T)={\phi }_{i}(r,T)-{\phi }_{i}^{0}(r,T)\) definition^{8}, which is relative to a “baseline” \({\phi }_{i}^{0}(r,T)\) that is also influenced by the random initialization:

where \({ \langle \ldots \rangle }_{P({\mathcal{M}},T)}\) indicates an average evaluated with motifs \({{\mathcal{M}}}_{j}\) randomly sampled from the thermally equilibrated distribution \(P({\mathcal{M}},T)\).

## Discussion

The generalized framework presented here characterizes chemical fluctuations in arbitrary crystal lattices with any number of chemical elements, with a rigorous mathematical foundation for the generalization being provided. The framework culminates in a reduced representation of the chemical space (Supplementary Fig. 3) and an information-theoretic quantification of SRO. Analytical results using group theory demonstrate that this approach eliminates degeneracies present in other representations of SRO (Fig. 1b). Our framework can identify motifs in atomistic data with a computational speed of 1.2 × 10^{6} atoms per hour in a single CPU core with an Apple Silicon M1 processor, or 63 × 10^{6} atoms per hour on a NVIDIA V100s GPU. While this is indeed more computationally expensive than computing first nearest-neighbors Warren–Cowley parameters, the computational cost is still negligible for typical large-scale atomistic simulations with tens of millions of atoms. The application of this framework to arbitrary crystal structures can be automated by employing symmetry finder algorithms^{48} to determine the symmetry group of chemical motifs. It is important to consider the neural network expressivity and memory constraints when expanding the scope of this method, especially when working with high-entropy materials. In Supplementary Section 3 we provide a series of strategies for validating the expressivity on a symmetrically complete subset of the data set, which enables the application of this approach to systems with at least 1.2 billion motifs.

The approach introduced here is complete for the first-coordination environment of an atom, while the WC parameters are not (Fig. 1b). Yet, our approach is *not complete* beyond the first-coordination environment, and this subtle point warrants some discussion as it remains a long-standing challenge in the field. The incompleteness of our approach beyond first-neighbors is due to the fact that the full set of correlation functions (Eq. (3)) is still not enough to completely reconstruct the chemical state of the system. Fundamentally, this originates from the aggregation of the contribution of all motifs \({{\mathcal{M}}}_{j}\) to the correlation function of motif \({{\mathcal{M}}}_{i}\) in Eq. (3). A complete description would require pairwise correlation functions (i.e., individual correlations between all motif pairs), and possibly higher-order correlation functions (e.g., between motif triplets), which might be computationally impractical to evaluate. Perhaps more importantly than computational feasibility: the authors are not aware of experimental measurements on this complete set of correlation functions or any suggestion in the literature of how they affect materials' properties. Meanwhile, the set of correlation functions evaluated here (Eq. (3)) is, in principle, physically equivalent to approaches currently in use to evaluate SRO length scale with electron microscopy^{27,30}, and have been historically employed to evaluate experimental observables such as scattering cross sections and susceptibilities in statistical physics^{27,30,49,50}.

A discussion is also warranted regarding the interpretability of our approach beyond the first-coordination environment when compared to WC parameters. By aggregating (Eq. (4)) the contribution of the central atom chemical species (\({d}_{ij}^{{\rm{cat}}}\), Eq. (5)) with the other contributions (namely, 1CP chemical composition \({d}_{ij}^{{\rm{com}}}\) and motif structure \({d}_{ij}^{{\rm{dmo}}}\)) in the calculation of the correlation function (Eq. (3)) we end up with a description beyond the first-coordination environment that is less interpretable than WC parameters, which describe the variation in chemical composition with distance in a physically intuitive manner. This reduced interpretability is traded by an increase in the physical fidelity of the evaluation of SRO length scales by the inclusion of effects beyond chemical composition (i.e., \({d}_{ij}^{{\rm{com}}}\) and \({d}_{ij}^{{\rm{dmo}}}\)).

Extending our current framework to account for long-range order would be a natural continuation of the work presented here because this would allow the investigation of phenomena where ordered compounds and solid solutions are both present (e.g., precipitation hardening). This could be accomplished, for example, with motif-node-based graphs^{51,52}, where each node in the graph describes an entire chemical motif, or with variational autoencoder-based order parameters^{53}. In Supplementary Section 8 we show that the chemical fluctuation length scale (Fig. 5b) shows variations that are compatible with peaks in the specific heat of CrCoNi that have been attributed to transitions to long-range order (i.e., a order–disorder transition).

The capabilities developed here facilitate the evaluation of chemistry–microstructure relationships that will be valuable for materials theory and experiments alike. For example, this approach is useful for augmenting the visualization of large-scale atomistic simulations^{13,14,17,18,19,54} or experimental imaging at the atomic scale^{24,25,26,27,28,29,30,35,36,37,38}, leading to better characterization of chemical SRO and its connection with physical properties (e.g., Fig. 5b, c). Our approach could also better inform the chemistry during the development of machine learning interatomic potentials for chemically complex systems^{55,56,57,58,59}, which is currently a challenge for the state-of-the-art in the field. The results presented here demonstrate how data science and machine learning can be employed to uncover chemical complexity in large atomic-scale data sets and transform these findings into quantities of relevance for the physical modeling of these materials.

## Methods

### Polya’s enumeration theory

Consider a system with *n*_{c} chemical elements in a specified crystal structure, which defines the 1CP. We define *S* to be the set of vertices of a 1CP, *C* to be the set of possible atom types (i.e., chemical elements), and *G* to be a group isomorphic to the 1CP symmetry group. The 1CP pattern inventory is given by Polya’s enumeration theory^{60}:

where *P*_{G} is the cycle index polynomial of *G*, *w*(*c*) is the atomic type label of *c* ∈ *C* (e.g., "Mo”, "Ta”, “Nb”, or “Ti” for MoTaNbTi), and *d* = ∣*S*∣ is the cardinality of *S* (i.e., number of elements in the set). The pattern inventories for fcc, hcp, and bcc lattices with three elements are given in Supplementary Section 2. Pattern inventories for arbitrary lattices and the number of elements can be evaluated using our Polya Python package^{61}.

Equation (7) contains all of the information required to enumerate (i.e., count) the number of distinct 1CPs for each of its possible chemical compositions. For example, the pattern inventory of an ABC ternary hcp system (Supplementary Section 2) allows us to easily read from the polynomial coefficients that there are 1444 distinct 1CPs with chemical composition A_{5}B_{2}C_{5}. Similarly, the total number of distinct 1CPs (*N*_{dm}/*n*_{c}, also known in group theory as the number of orbits) can be obtained by setting *w*(*c*) = 1 for all *c* ∈ *C* in the polynomial:

### E(3)-equivariant graph neural network

Local chemical motifs were converted to graphs in which nodes represent atoms and have as attribute the atomic type (i.e., chemical element) as a one-hot encoding. Graph edges store the direction (unit) vector \({\hat{{\bf{r}}}}_{ij}\) between atoms *i* and *j*. Graph embeddings are made invariant to local lattice distortions by remapping atoms to their ideal positions before constructing the graphs. Each graph is then processed through a randomly initialized E(3)-GNN^{41} (implemented using the e3nn package^{62}) composed of \({\mathbb{E}}(3)-\) equivariant convolutions and gates, generating a fingerprint \({{\bf{z}}}_{i}\in {{\mathbb{R}}}^{4}\) of the chemical motifs \({{\mathcal{M}}}_{i}\).

Our E(3)-GNN architecture is composed of three convolutions using spherical harmonics \({Y}_{\ell }^{m}\left({\hat{{\bf{r}}}}_{ij}\right)\) as edge attributes, with degrees as large as \({\ell }_{\max }=2\). A total of 10 cosine radial basis functions are employed, with ranges evenly spread from zero to three distance units (measured as multiples of the nearest-neighbor distance). The final output length is four, i.e., \({{\bf{z}}}_{i}\in {{\mathbb{R}}}^{4}\). The hidden-layers irreducible representation, in the e3nn notation, were set to 3 × 2*o* + 3 × 2*e* + 3 × 1*o* + 3 × 1*e* + 3 × 0*o* + 3 × 0*e*. Equivariant neural networks have been shown to be capable symmetry compilers, enabling the representation of important features of atomic geometry even with random initialization^{63}. Our choice here of randomly initializing the network and not training it is meant to maximize the influence of each weight. This is also supported by the agreement between the pattern inventories obtained with this computational approach and the analytical results using Polya’s enumeration theory.

### Monte Carlo simulations

Monte Carlo simulations using the machine learning moment tensor potential^{64} from ref. ^{65} were employed to sample the thermal-equilibrium chemical configurations for the bcc MoTaNbTi high-entropy alloy. Starting configurations were composed of 13 × 13 × 13 chemically random supercells at the equiatomic composition. The simulations were performed for a total of 30 Monte Carlo steps per atom, with acceptance probabilities based on the Metropolis-Hastings algorithm^{66,67}. Periodic boundary conditions were enforced in all dimensions.

Simulations were carried out for temperatures ranging from 300 to 1700 K in 100 K increments; the lattice parameter at each temperature accounted for thermal expansion. A total of 20 independent simulations were performed for each temperature, and only the final configuration of each simulation was employed in our analyses, which resulted in a data set of 87,880 motifs per temperature. The nearest-neighbor Warren–Cowley parameters of this system (calculated using our Ovito^{68}WarrenCowleyParameters Python modifier (github.com/killiansheriff/WarrenCowleyParameters) are shown in Supplementary Section 4 as a function of temperature.

### Local lattice strain

The final configuration of each Monte Carlo simulation was relaxed with fixed simulation box dimensions, and the local lattice strain of each atom *n* was evaluated:

where \({{\bf{r}}}_{n}^{{\rm{f}}}\) is the atom’s position after relaxation, \({{\bf{r}}}_{n}^{{\rm{i}}}\) is the position before relaxation (i.e., in the ideal bcc structure), ∥…∥_{2} is the *L*^{2} norm, and *a*_{NN}(*T*) is the nearest-neighbor distance at temperature *T*.

### Simplex and barycentric coordinates

A simplex^{69} is a generalization of triangles (2-simplex) and tetrahedra (3-simplex) to higher dimensions. It represents the simplest possible polytope in any given dimension. Mathematically, the standard *n*-simplex is defined as the subset of \({{\mathbb{R}}}^{n+1}\) given by

A barycentric coordinate system specifies the location of a point with respect to a simplex. In our case, the barycentric coordinates correspond to the chemical composition of a 1CP. For example, consider a motif \({{\mathcal{M}}}_{j}\) and its associated 1CP. The barycentric coordinates for the composition of this 1CP are

where *N*_{a} is the number of atoms in the 1CP, *N*^{(i)} is the number of atoms of type “*i*”, and *n*_{c} is the number of chemical elements in the system. While the barycentric coordinates are a convenient form to express the chemical composition, they can be converted into the more conventional Cartesian coordinates \({{\bf{k}}}_{j}\in {{\mathbb{R}}}^{({n}_{{\rm{c}}}-1)}\) with the following equation:

where **v**_{i} are vertices of the (*n*_{c}−1)-simplex (in Cartesian coordinates). The numerical implementation of *n*-simplex objects can be found in our Simplex Python package^{70}.

## Data availability

The data that support the findings of this study are available from the corresponding authors upon reasonable request.

## Code availability

The software for chemical motif identification and SRO quantification can be found in our ChemicalMotifIdentifier Python package^{71} (github.com/killiansheriff/ChemicalMotifIdentifier). Our figure style is implemented in LovelyPlots^{72} under the paper style. For convenience, we have compiled the list of all Python packages developed in this work in a GitHub repository list^{73} (github.com/stars/killiansheriff/lists/chemical-motif-characterization), which includes our ChemicalMotifIdentifier^{71}, Polya^{61}, Simplex^{70}, NShellFinder^{74}, and WarrenCowleyParameters^{75} Python packages.

## References

George, E. P., Raabe, D. & Ritchie, R. O. High-entropy alloys.

*Nat. Rev. Mater.***4**, 515–534 (2019).Oses, C., Toher, C. & Curtarolo, S. High-entropy ceramics.

*Nat. Rev. Mater.***5**, 295–309 (2020).Varvenne, C., Luque, A. & Curtin, W. A. Theory of strengthening in fcc high entropy alloys.

*Acta Mater.***118**, 164–176 (2016).Xie, Y. et al. A percolation theory for designing corrosion-resistant alloys.

*Nat. Mater.***20**, 789–793 (2021).Yang, Z. & Tang, L.-H. Coordination motifs and large-scale structural organization in atomic clusters.

*Phys. Rev. B***79**, 045402 (2009).Polak, W. & Patrykiejew, A. Local structures in medium-sized Lennard-Jones clusters: Monte Carlo simulations.

*Phys. Rev. B***67**, 115402 (2003).Clapp, P. C. Atomic configurations in binary alloys.

*Phys. Rev. B***4**, 255–270 (1971).Sheriff, K., Cao, Y., Smidt, T. & Freitas, R. Quantifying chemical short-range order in metallic alloys.

*Proc. Natl Acad. Sci. USA***121**, e2322962121 (2024).Cowley, J. M. An approximate theory of order in alloys.

*Phys. Rev.***77**, 669–675 (1950).Ding, J., Yu, Q., Asta, M. & Ritchie, R. O. Tunable stacking fault energies by tailoring local chemical order in CrCoNi medium-entropy alloys.

*Proc. Natl Acad. Sci. USA***115**, 8919–8924 (2018).Yu, P., Du, J.-P., Shinzato, S., Meng, F.-S. & Ogata, S. Theory of history-dependent multi-layer generalized stacking fault energy—a modeling of the micro-substructure evolution kinetics in chemically ordered medium-entropy alloys.

*Acta Mater.***224**, 117504 (2022).Sun, Z., Shi, C., Liu, C., Shi, H. & Zhou, J. The effect of short-range order on mechanical properties of high entropy alloy Al0.3CoCrFeNi.

*Mater. Design***223**, 111214 (2022).Li, Q. J., Sheng, H. & Ma, E. Strengthening in multi-principal element alloys with local-chemical-order roughened dislocation pathways.

*Nat. Commun.***10**, https://doi.org/10.1038/s41467-019-11464-7 (2019).Ghosh, S., Sotskov, V., Shapeev, A. V., Neugebauer, J. & Körmann, F. Short-range order and phase stability of CrCoNi explored with machine learning potentials.

*Phys. Rev. Mater.***6**, 113804 (2022).Walsh, F., Asta, M. & Ritchie, R. O. Magnetically driven short-range order can explain anomalous measurements in CrCoNi.

*Proc. Natl Acad. Sci. USA***118**, e2020540118 (2021).Feng, W., Qi, Y. & Wang, S. Effects of short-range order on the magnetic and mechanical properties of FeCoNi(AlSi)

_{x}high entropy alloys.*Metals***7**, 482 (2017).Du, J.-P. et al. Chemical domain structure and its formation kinetics in CrCoNi medium-entropy alloy.

*Acta Mater.***240**, 118314 (2022).Yin, S. et al. Atomistic simulations of dislocation mobility in refractory high-entropy alloys and the effect of chemical short-range order.

*Nat. Commun.***12**, https://doi.org/10.1038/s41467-021-25134-0 (Springer Science and Business Media LLC, 2021).Kostiuchenko, T., Körmann, F., Neugebauer, J. & Shapeev, A. Impact of lattice relaxations on phase transitions in a high-entropy alloy studied by machine-learning potentials.

*npj Comput. Mater.***5**, https://doi.org/10.1038/s41524-019-0195-y (2019).Utt, D. et al. The origin of jerky dislocation motion in high-entropy alloys.

*Nat. Commun.***13**, https://doi.org/10.1038/s41467-022-32134-1 (2022).Ceguerra, A. V., Powles, R. C., Moody, M. P. & Ringer, S. P. Quantitative description of atomic architecture in solid solutions: a generalized theory for multicomponent short-range order.

*Phys. Rev. B***82**, 132201 (2010).Singh, P., Smirnov, A. V. & Johnson, D. D. Atomic short-range order and incipient long-range order in high-entropy alloys.

*Phys. Rev. B***91**, 224204 (2015).Walsh, F., Abu-Odeh, A. & Asta, M. Reconsidering short-range order in complex concentrated alloys.

*MRS Bull.***48**, 753–761 (2023).Zhou, L. et al. Atomic-scale evidence of chemical short-range order in CrCoNi medium-entropy alloy.

*Acta Mater.***224**, 117490 (2022).Zhang, R. et al. Short-range order and its impact on the CrCoNi medium-entropy alloy.

*Nature***581**, 283–287 (2020).Chen, X. et al. Direct observation of chemical short-range order in a medium-entropy alloy.

*Nature***592**, 712–716 (2021).Xu, M., Wei, S., Tasan, C. C. & LeBeau, J. M. Determination of short-range order in TiVNbHf(Al).

*Appl. Phys. Lett.***122**, https://doi.org/10.1063/5.0145289 (2023).Hsiao, H.-W. et al. Data-driven electron-diffraction approach reveals local short-range ordering in CrCoNi with ordering effects.

*Nat. Commun.***13**, https://doi.org/10.1038/s41467-022-34335-0 (2022).Wang, J., Jiang, P., Yuan, F. & Wu, X. Chemical medium-range order in a medium-entropy alloy.

*Nat. Commun.***13**, https://doi.org/10.1038/s41467-022-28687-w (2022).Xu, M., Kumar, A. & LeBeau, J. M. Correlating local chemical and structural order using Geographic Information Systems-based spatial statistics.

*Ultramicroscopy***243**, 113642 (2023).Rakita, Y. et al. Mapping structural heterogeneity at the nanoscale with scanning nano-structure electron microscopy (SNEM).

*Acta Mater.***242**, 118426 (2023).Walsh, F., Zhang, M., Ritchie, R. O., Minor, A. M. & Asta, M. Extra electron reflections in concentrated alloys do not necessitate short-range order.

*Nat. Mater.***22**, 926–929 (2023).Joress, H. et al. Why is EXAFS for complex concentrated alloys so hard? Challenges and opportunities for measuring ordering with X-ray absorption spectroscopy.

*Matter***6**, 3763–3781 (2023).Coury, F. G., Miller, C., Field, R. & Kaufman, M. On the origin of diffuse intensities in fcc electron diffraction patterns.

*Nature***622**, 742–747 (2023).Hu, R., Jin, S. & Sha, G. Application of atom probe tomography in understanding high entropy alloys: 3D local chemical compositions in atomic scale analysis.

*Prog. Mater. Sci.***123**, 100854 (2022).Moniri, S. et al. Three-dimensional atomic structure and local chemical order of medium- and high-entropy nanoalloys.

*Nature***624**, 564–569 (2023).Li, Y. et al. Machine learning-enabled tomographic imaging of chemical short-range atomic ordering.

*Adv. Mater*. 2407564, https://doi.org/10.1002/adma.202407564 (2023).Li, Y. et al. Convolutional neural network-assisted recognition of nanoscale L12 ordered structures in face-centred cubic alloys.

*npj Comput. Mater.***7**, https://doi.org/10.1038/s41524-020-00472-7 (2021).Gault, B. et al. Spatial resolution in atom probe tomography.

*Microsc. Microanal.***16**, 99–110 (2010).Gault, B. et al. Atom probe tomography.

*Nat. Rev. Methods Primers***1**, https://doi.org/10.1038/s43586-021-00047-w (2021).Rackers, J. A., Tecot, L., Geiger, M. & Smidt, T. E. A recipe for cracking the quantum scaling limit with machine learned electron densities.

*Mach. Learn.: Sci. Technol.***4**, 015027 (2023).Xu, K., Hu, W., Leskovec, J. & Jegelka, S. How powerful are graph neural networks?

*International Conference on Learning Representations*https://openreview.net/forum?id=ryGs6iA5Km (2019).Weisfeiler, B. & Lehman, A. A. A reduction of a graph to a canonical form and an algebra arising during this reduction.

*Nauchno-Technicheskaya Informatsia*https://www.iti.zcu.cz/wl2018/pdf/wl_paper_translation.pdf (1968).Morris, C. et al. Weisfeiler and Leman go neural: higher-order graph neural networks.

*AAAI***33**, 4602–4609 (2019).Joyce, J. M. Kullback–Leibler divergence. In

*International Encyclopedia of Statistical Science*(ed. Lovric, M.) (Springer, 2011).Owen, L. R. & Jones, N. G. Lattice distortions in high-entropy alloys.

*J. Mater. Res.***33**, 2954–2969 (2018).Owen, L. et al. An assessment of the lattice strain in the CrMnFeCoNi high-entropy alloy.

*Acta Materialia***122**, 11–18 (2017).Gabor, C. & Tamas, N. The igraph software package for complex network research.

*Inter. J. Complex Syst***1695**, 1–9 (2006).Keen, D. A. & Goodwin, A. L. The crystallography of correlated disorder.

*Nature***521**, 303–309 (2015).Schneidman, E., Still, S., Berry, M. J. & Bialek, W. Network information and connected correlations.

*Phys. Rev. Lett.***91**, 238701 (2003).Banjade, H. R. et al. Structure motif-centric learning framework for inorganic crystalline systems.

*Sci. Adv*.**7**, eabf1754 (2021).Wang, Y. et al. Motif-based graph representation learning with application to chemical molecules.

*Informatics***10**, 8 (2023).Yin, J., Pei, Z. & Gao, M. C. Neural network-based order parameter for phase transitions and its applications in high-entropy alloys.

*Nat. Comput. Sci.***1**, 686–693 (2021).Cao, P. Maximum strength and dislocation patterning in multi-principal element alloys.

*Sci. Adv.***8**, eabq7433 (2022).Cao, Y., Sheriff, K. & Freitas, R. Capturing short-range order in high-entropy alloys with machine learning potentials. arXiv: 2401.06622 (2024).

Freitas, R. & Cao, Y. Machine-learning potentials for crystal defects.

*MRS Commun.***12**, 510–520 (2022).Lopanitsyna, N., Fraux, G., Springer, M. A., De, S. & Ceriotti, M. Modeling high-entropy transition metal alloys with alchemical compression.

*Phys. Rev. Mater.***7**, 045802 (2023).Willatt, M. J., Musil, F. & Ceriotti, M. Feature optimization for atomistic machine learning yields a data-driven construction of the periodic table of the elements.

*Phys. Chem. Chem. Phys.***20**, 29661–29668 (2018).Darby, J. P., Kermode, J. R. & Csányi, G. Compressing local atomic neighbourhood descriptors.

*npj Comput. Mater.***8**, (2022).Pólya, G. Kombinatorische Anzahlbestimmungen für Gruppen, Graphen und chemische Verbindungen.

*Acta Math.***68**, 145–254 (1937).Sheriff, K. & Freitas, R. https://github.com/killiansheriff/Polya.

Geiger, M. & Smidt, T. e3nn: Euclidean neural networks. Preprint at https://arxiv.org/abs/2207.09453 (2022).

Smidt, T. E., Geiger, M. & Miller, B. K. Finding symmetry breaking order parameters with Euclidean neural networks.

*Phys. Rev. Res.***3**, L012002 (2021).Shapeev, A. V. Moment tensor potentials: a class of systematically improvable interatomic potentials.

*Multiscale Model. Simul.***14**, 1153–1173 (2016).Zheng, H. et al. Multi-scale investigation of short-range order and dislocation glide in MoNbTi and TaNbTi multi-principal element alloys.

*npj Comput. Mater.***9**, https://doi.org/10.1038/s41524-023-01046-z (2023).Robert, C. P. & Casella, G. The Metropolis-Hastings algorithm. In

*Monte Carlo Statistical Methods*,*Springer Texts in Statistics*(eds Robert, C. P. & Casella, G.) (Springer, 2004).Metropolis, N., Rosenbluth, A. W., Rosenbluth, M. N., Teller, A. H. & Teller, E. Equation of state calculations by fast computing machines.

*J. Chem. Phys.***21**, 1087–1092 (2004).Stukowski, A. Visualization and analysis of atomistic simulation data with OVITO—the open visualization tool.

*Model. Simul. Mater. Sci. Eng.***18**, 015012 (2009).Munkres, J. R.

*Elements of Algebraic Topology*1st edn (CRC Press, 1993).Sheriff, K. & Freitas, R. Simplex, a python package that implements the geometric object of a simplex. https://github.com/killiansheriff/simplex (2024).

Sheriff, K. & Freitas, R. ChemicalMotifIdentifier, a python package to perform a chemical motif characterization of short-range order. https://github.com/killiansheriff/ChemicalMotifIdentifier (2024).

Sheriff, K. LovelyPlots, a collection of Matplotlib style sheets to nicely format figures for scientific papers, thesis and presentations. https://github.com/killiansheriff/LovelyPlots (2023).

Sheriff, K., Cao, Y. & Freitas, R. A collection of repositories used in our work entitled “Chemical-motif characterization of short-range order with E(3)-equivariant neural networks”. https://github.com/stars/killiansheriff/lists/chemical-motif-characterization (2024).

Sheriff, K. & Freitas, R. NshellFinder, an OVITO python modifier to find the n-th coordination shell neighbors. https://github.com/killiansheriff/NShellFinder (2024).

Sheriff, K. & Freitas, R. WarrenCowleyParameters, an OVITO python modifier to compute the Warren-Cowley parameters. https://github.com/killiansheriff/WarrenCowleyParameters (2024).

## Acknowledgements

This work was supported by the MathWorks Ignition Fund, MathWorks Engineering Fellowship Fund, and the Portuguese Foundation for International Cooperation in Science, Technology, and Higher Education in the MIT–Portugal Program. We were also supported by the Research Support Committee Funds from the School of Engineering at the Massachusetts Institute of Technology. This work used the Expanse supercomputer at the San Diego Supercomputer Center through allocation MAT210005 from the Advanced Cyberinfrastructure Coordination Ecosystem: Services & Support (ACCESS) program, which is supported by National Science Foundation grants #2138259, #2138286, #2138307, #2137603, and #2138296, and the Extreme Science and Engineering Discovery Environment (XSEDE), which was supported by National Science Foundation grant number #1548562.

## Author information

### Authors and Affiliations

### Contributions

K.S., Y.C., and R.F. conceived the project. K.S. performed all calculations. All authors contributed to the interpretation of the results. K.S. and R.F. prepared the manuscript, which was reviewed and edited by all authors. R.F. performed project administration, supervision, and funding acquisition.

### Corresponding author

## Ethics declarations

### Competing interests

The authors declare no competing interests.

## Additional information

**Publisher’s note** Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Supplementary information

## Rights and permissions

**Open Access** This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.

## About this article

### Cite this article

Sheriff, K., Cao, Y. & Freitas, R. Chemical-motif characterization of short-range order with E(3)-equivariant graph neural networks.
*npj Comput Mater* **10**, 215 (2024). https://doi.org/10.1038/s41524-024-01393-5

Received:

Accepted:

Published:

DOI: https://doi.org/10.1038/s41524-024-01393-5