Chemical short-range order (SRO), defined as the local preferential bonding of certain atom types, can exist in alloys that are otherwise disordered and have no long-range order [1]. SRO has been studied extensively in the context of binary alloys for decades [1,2,3,4,5,6]. There is renewed interest in SRO due to the emergence of multi-principal element alloys (MPEAs), which are composed of several element types in similar proportions and form a solid solution with no long-range order [7]. Also referred to as high-entropy alloys, these single-phase alloys were initially thought to be stabilized by high configurational entropy due to the disordered arrangement of atoms on the lattice. In actuality, the arrangement of atoms is not completely random due to the thermodynamically driven SRO [7,8,9,10,11,12].

SRO can play a role in the material properties of alloys. Fisher first proposed the idea of SRO strengthening in 1954, positing the presence of SRO would increase the dislocation glide stress due to the creation of a disordered interface as the dislocation disrupts the SRO [2]. Further studies have shown that dislocation behavior is influenced by SRO in both binary alloys [4] and MPEAs [9, 13,14,15]. With the possibility to control SRO via processing comes the exciting potential to tune SRO and thus mechanical properties [16]. Therefore, modeling the effects of SRO in MPEAs has recently received much attention.

To model SRO, it must first be quantified, which is typically done via the Warren–Cowley (WC) parameters [1, 17], defined as

$$\begin{aligned} \alpha _{ij}^k = (p_{ij}^k-c_j)/(\delta _{ij} - c_j) \end{aligned}$$

where \(\alpha _{ij}^k\) is the WC parameter for the ij pair type in the kth nearest neighbor shell, \(p_{ij}^k\) is the probability that an atom is a j-type atom in the kth nearest neighbor shell of an i-type atom, \(c_j\) is the overall concentration of type j, and \(\delta _{ij}\) is the Kronecker delta. The WC parameter is zero for completely random alloys with no SRO. Positive WC parameters indicate preferred and non-preferred bonding pairs for like and unlike pairs, respectively, with the opposite being true for negative WC parameters. The WC parameters for chemical or magnetic SRO are generally temperature dependent, as SRO tends to increase with decreasing temperatures.

WC parameters are typically calculated with Monte Carlo (MC) methods, which involve randomly swapping atoms according to an energy criterion until equilibrium is reached. The energies can be calculated from atomistic methods, usually either density functional theory (DFT) or molecular dynamics (MD). DFT is considered to be the more accurate of the two. However, the system sizes used in most MC–DFT calculations of SRO are extremely limited, including about 100–200 atoms [10, 16, 18,19,20] with traditional methods or about 1000 atoms with cluster expansion methods [10, 21]. MC–MD simulations, on the other hand, require the creation of a classical potential, which leads to relatively less accurate calculations, but can use 1–3 million atoms [6, 13, 22,23,24,25,26]. This system size approaches that required to study more complex material behaviors such as dislocation glide, but equilibrating the structures with MC–MD to introduce SRO is computationally intensive and can limit the size and number of simulations [23, 24]. This limitation can be problematic in MPEAs where the properties are known to be highly probabilistic and many iterations of the same simulation are desired [27, 28].

Here, we develop a new method and corresponding open-source code to generate large lattice structures with SRO. The method, order through informed swapping (OTIS), uses known WC parameters as input and then, starting from a completely random lattice, uses MC-like swapping to find a structure with the desired WC parameters. In this way, the computationally expensive MC–DFT or MC–MD calculations only need to be performed once using a smaller, tractable cell size. The WC parameters are then extracted and used to create unlimited lattices of any size that can be used as inputs to atomistic or mesoscale models. We demonstrate the flexibility of OTIS by creating lattices with SRO for two different BCC ternary MPEAS, one FCC ternary MPEA, and two BCC quinary MPEAs. The simulation scaling and computation time are discussed. As an example application of the method, we show how the generated SRO lattices can be used in mesoscale phase-field dislocation dynamics (PFDD) simulations to study the behavior of dislocations in MPEAs.

Algorithm for Creation of Lattices with Short-Range Order

Let n equal the number of component elements, \(c_i\) equal the concentration of type i, and \(\alpha _{ij}\) equal the desired WC parameters in the first nearest neighbor shell. The simulation cell size is given in terms of the primitive vectors: \(\varvec{e}_1 = \frac{a}{2}[11\bar{1}]\), \(\varvec{e}_2 = \frac{a}{2}[\bar{1}11]\), and \(\varvec{e}_3 = \frac{a}{2}[1\bar{1}1]\) for a BCC lattice and \(\varvec{e}_1 = \frac{a}{2}[110]\), \(\varvec{e}_2 = \frac{a}{2}[011]\), and \(\varvec{e}_3 = \frac{a}{2}[101]\) for an FCC lattice. The cell dimensions are \(N_1\), \(N_2\), and \(N_3\) in the directions \(\varvec{e}_1\), \(\varvec{e}_2\), and \(\varvec{e}_3\), respectively, for a total of \(N = N_1*N_2*N_3\) lattice sites.

The OTIS algorithm is summarized in Fig. 1. To begin, a lattice of the desired shape and size is created. The total number of nearest neighbor bonds will be NZ/2, where Z is the coordination number of the lattice. Given the probability \(p_{ij}\) of each bond type, which can be extracted from the WC parameters (Eq. 1), the desired number of each bond type can be easily determined. We define the goal number of bonds as an n x n matrix where each element is given by

$$\begin{aligned} g_{ij} = \frac{1}{2}NZc_ip_{ij}. \end{aligned}$$

Each site is randomly assigned an initial element type, maintaining the desired overall concentration. The current bond numbers, which compose an n x n matrix denoted as \(c_{ij}\), are calculated from this structure.

In each step of the OTIS algorithm, two unlike atoms are randomly selected, and, if the swap is favorable, swapped. Swapping is continued until \(c_{ij}\) = \(g_{ij}\) for all pair types ij. There are two major challenges with this method that need to be addressed. First, we need to define an acceptance criterion for swaps. Because the probabilities \(p_{ij}\) must sum to 1 for any atom type i and due to symmetry in \(g_{ij}\), there are \(n(n-1)/2\) constraints that must be met. There is only one value to optimize for a binary alloy, and this has been done previously for binary FCC lattices in the work of Gehlen and Cohen [29]. For MPEAs, the situation is more complicated. A swap that moves \(c_{ij}\) toward the goal \(g_{ij}\) for one pair type ij may move other pair types further from the goal. For the entire structure, we define a distance d from the goal as

$$\begin{aligned} d = \sum _{i,j} |c_{ij}-g_{ij}| \end{aligned}$$

which gives the element-wise sum of the absolute difference of the current and goal matrices. During the swapping procedure, only swaps that lower d will be accepted. This means that all bond types are considered while swapping an i-type and a j-type atom, not just the ij bond type.

The second challenge is how to choose atoms for swapping. As noted by Gehlen and Cohen, two atoms chosen completely at random are highly unlikely to be accepted for a swap [29]. This causes a high rejection rate and an excessively long computation time to reach convergence. Instead, we use an informed, statistical swapping method by choosing from a subset of atoms that are more likely to give us an accepted swap. For each lattice site \(\varvec{x}\), define \(\delta _{ij}^\alpha (\varvec{x})\) as the change in \(c_{ij}\) if the atom at \(\varvec{x}\) is replaced by an atom of type \(\alpha \).

Now, let AB be the atom pair to be swapped. First, the A-type atom is selected. Instead of randomly choosing from all A-type atoms, we choose from A-type atoms where \(\sum _{i,j} |c_{ij} + \delta _{ij}^B - g_{ij}| < \sum _{i,j} |c_{ij}-g_{ij}|\). This means that we only choose from the subset of A-atoms where d would be lower if a B-type atom were on that lattice site instead. If no A-type atoms that fit this criterion, we revert back to choosing from all A-type atoms. We denote the chosen lattice site from either situation as \(x^A\).

The next step is to choose the B-type atom, for which we use a similar procedure. Since \(x^A\) is known, it is included in the selection criterion. We randomly select from the subset of B-type atoms where \(\sum _{i,j}|c_{ij} + \delta _{ij}^B(x^A) + \delta _{ij}^A - g_{ij}| < \sum _{i,j}|c_{ij}-g_{ij}|\). If there exists a site \(x^B\) that meets this criterion, the atoms at site \(x^A\) and \(x^B\) are swapped. If not, we select another unlike pair type to swap and repeat the procedure. The pair types are rotated through sequentially (e.g., A–B, A–C, B–C, B–A, and so on) at each swapping step such that each pair type has an equal opportunity to be swapped.

After a pair of atoms is swapped, the current bond numbers \(c_{ij}\) are updated by adding \(\delta _{ij}^\alpha (x^A)\) and \(\delta _{ij}^\alpha (x^B)\) to \(c_{ij}\). \(\delta _{ij}^\alpha (\varvec{x})\) must also be updated, but only for the two atoms that were swapped and their neighbors. With both, the maximum number of updates to \(\delta _{ij}^\alpha \) is \(2(Z+1)\), a small fraction of the total size N.

The swapping process is repeated until \(c_{ij}\) is within some tolerance \(g_{ij}\) for pairs ij. Here, we use a tolerance of \(10^{-3}NZ/n\). This gives final WC parameters within less than 1% of the desired WC parameters.

In the following section, we demonstrate the use of OTIS by generating SRO lattices for several different MPEAs for which the WC parameters have been calculated previously, including MoNbTi, TaNbTi, CoCrNi, HfNbTaTiZr, and HfMoNbTaTi [24, 30, 31]. For each of these alloys, the WC parameters were calculated at multiple annealing temperatures with MC–MD using multi-component classical potentials, beginning with a random structure and performing MC until equilibrium is reached [13, 30]. The WC parameters at each temperature are listed in Appendix. Considering the various alloy and temperature combinations sums to 16 unique sets of WC parameters. For each set, we create simulation cells with side lengths 16, 24, 32, 40, 48, 56, and 64, with 10 unique SRO lattices generated at each size. The software Ovito was used to visualize the lattices and confirm the correct numbers of each bond type [32].

Fig. 1
figure 1

A flowchart showing the order through informed swapping (OTIS) algorithm

Results and Discussion

Generated Short-Range Order Lattices

To compare the degree of SRO across multiple MPEAs and annealing temperatures, we introduce an SRO figure of merit \(\Omega \), defined as the quadratic mean of the WC parameters for unlike pair types:

$$\begin{aligned} \Omega = \sqrt{\frac{\sum _{i=1}^{n} \sum _{j=i+1}^n \alpha _{ij}^2}{n(n-1)/2}}. \end{aligned}$$

Only unlike pairs are included in this sum as this will include the \(n(n-1)/2\) independent WC parameters, from which the WC parameters for the like pairs can be uniquely determined. By this definition, \(\Omega = 0\) corresponds to no SRO, a completely random structure, and increases in \(\Omega \) signify more extensive SRO.

To demonstrate the versatility of the OTIS method, we present three examples with either BCC or FCC and either three (ternary) or five elements (quinary), all with relatively high values of \(\Omega \), which are expected to be the more difficult cases to create. Figure 2 shows the evolution of an equiatomic MoNbTi BCC lattice using the WC parameters from 300K (\(\Omega = 0.469\)) [30]. Starting from an initially random lattice, atoms are swapped using the OTIS algorithm until the desired SRO is achieved. The WC parameters from the final structure were recalculated by counting the number of each bond type with Ovito and confirmed to be within 1% of the prescribed WC parameters. This error can be decreased if desired by the lowering tolerance criteria. Figure 3 applies the OTIS algorithm to create an FCC equiatomic CoCrNi lattice structure using the WC parameters at 350K (\(\Omega = 0.785\)) [24]. For the same size, 32 x 32 x 32, the effect of increasing \(\Omega \) from the BCC ternary to the FCC ternary is readily apparent by the clear regions of chemical segregation. Figure 4 shows an example lattice for the BCC quinary alloy HfNbTaTiZr using the WC parameters at 300K. Among the three examples, this one has the highest degree of SRO (\(\Omega = 1.18\)) [31]. Further, unlike the ternary alloys, which must meet three independent bond number constraints, a quinary alloy must meet 10. This case shows that because the OTIS algorithm takes into account all bond types when accepting or rejecting a move, it can still create a structure that meets the desired WC parameters despite the significant increase in bond number constraints.

Fig. 2
figure 2

The creation of a 32 x 32 x 32 lattice for MoNbTi using the Warren–Cowley parameters at 300K. The solid lines show the current bond probabilities \(p_{ij}\), while the dashed lines show the goal probabilities

Fig. 3
figure 3

The creation of a 32 x 32 x 32 lattice for CoCrNi using the Warren–Cowley parameters at 350K. The solid lines show the current bond probabilities \(p_{ij}\), while the dashed lines show the goal probabilities

Fig. 4
figure 4

The creation of a 32 x 32 x 32 lattice for HfNbTaTiZr using the Warren–Cowley parameters at 300K. The solid lines show the current bond probabilities \(p_{ij}\), while the dashed lines show the goal probabilities

Although all structures in Figs. 2, 3, 4 have the same number of lattice sites (32768) and high degrees of SRO, the total number of attempted swaps required to reach the final goal varies widely, from about 11,000 to more than 47,000. To compare, we calculated in Fig. 5A the number of actual swaps, that is, excluding the rejected swaps, to reach the desired WC parameter for all alloys, annealing temperatures (SRO degree), and a broad range of lattice sizes (number of lattice sites). The total number of swaps is averaged over the 10 SRO lattices generated for each alloy, size, and temperature. We find that the number of swaps is linearly correlated with the total number of lattice sites, while the number of swaps per site depends on several intuitive factors. First, more extensive SRO, represented by higher values of \(\Omega \), increases the number of swaps required. Second, FCC lattices require more swaps than BCC lattices due to the higher coordination number and therefore higher number of bonds within the structure. Third, the quinary alloys tend to require more swaps than ternary alloys since there are more bond number constraints that must be met.

While OTIS uses informed swapping to identify bonds that are likely to be accepted, there are still instances when an iteration fails to find an acceptable pair and the swap is rejected. In all such cases, the initial acceptance rate, defined as the percentage of swaps accepted across all pair types, is 100% for the first few iterations of the algorithm. As individual pair types reach their goal bond numbers, it becomes more difficult to find an acceptable atom pair to swap, and the acceptance rate drops. This is shown in Figs. 3 and 4 when \(p_{ij}\) levels off as it approaches the goal numbers. The final acceptance rates range from 20 to 100%, and the acceptance rate does not appear to be sensitive to the system size, extent of SRO, or lattice type. In the cases tested here, the acceptance rate varies up to 46% when repeating the same OTIS simulation with a different random initial lattice.

The total simulation time, plotted in Fig. 5B, is a function of the number of swaps required and the acceptance rate. On a personal computer, the average time to create a lattice with 262,144 atoms ranges from under two minutes for TaNbTi at 1673K to 11 hours for HfMoNbTaTi at 300K.

Fig. 5
figure 5

A The number of swaps required to reach the desired Warren–Cowley parameters for each alloy. B The average total simulation time on a personal computer for each alloy as a function of system size

Application to Phase-Field Dislocation Methods

For demonstration, we use OTIS to generate SRO lattices for use in a mesoscale phase-field dislocation dynamics (PFDD) simulation. The full details of the PFDD formulation are given elsewhere [33, 34]. One of the primary inputs into PFDD is the generalized stacking fault energy curve, which is a component of the barrier to dislocation glide. For BCC alloys, this curve is parameterized by its one maximum, conventionally called the unstable stacking fault energy (USFE). For a pure metal, the USFE is deterministic, but in an MPEA, the USFE varies from one location to another in the same material due to the disordered arrangement of atoms [35]. Prior PFDD models accounted for this by adding random, correlated local fluctuations to the USFE [36]. However, this requires inputting an unknown correlation length, so it is preferable to directly link the local USFE to the underlying atomic structure.

First, we generate a BCC SRO lattice with shape 128\(\varvec{e}_1\) x 128\(\varvec{e}_2\) x 4\(\varvec{e}_3\) using the WC parameters for TaNbTi at 300K. This lattice is then replicated in the \(\varvec{e}_3\) direction 32 times. Although cross slip of screw dislocations is permitted, this process does not occur in these simulations, and therefore, replicating the out-of-plane atomic configurations does not affect the results. Next, each lattice point was assigned a local composition based on the atom types nearby. Atomistic simulations of the solute–dislocation interaction energy in BCC MPEAs showed that solute atoms beyond just the core of the dislocation significantly influence the dislocation energy [37]. In fact, the highest solute-dislocation interaction energy was found at the fifth nearest neighbor from the screw dislocation center. Therefore, we calculate a local composition of each grid point using all the atoms within a cutoff radius of two Burgers vectors, which corresponds to and includes atoms up to the fifth nearest neighbor. Only atoms within the two adjacent (110) planes sheared by a dislocation are included for a total of 31 atoms. Third, we associate the composition of the grid point to its USFE [30]. This assignment step involves interpolating the USFE calculations as a function of composition (Fig. 6).

Fig. 6
figure 6

The conversion of an atomic lattice into local USFE values for use in mesoscale PFDD

This USFE volume is used in PFDD to study the expansion of dislocation loops in TaNbTi (Fig. 7). The PFDD simulation grid is chosen to align with the BCC atomic grid, giving a grid spacing of b. Three order parameters, namely, \(\phi _1\), \(\phi _2\), and \(\phi _3\), are used to represent local slip on three slip systems. All slip systems have Burgers vector \(\varvec{\mathbf {b}_1} = \varvec{\mathbf {b}_2} = \varvec{\mathbf {b}_3} = a/2[\bar{1}11]\), and the slip plane normals are \(\varvec{\mathbf {n}}_1 = \frac{1}{\sqrt{2}}[110]\), \(\varvec{\mathbf {n}}_2 = \frac{1}{\sqrt{2}}[01\bar{1}]\), and \(\varvec{\mathbf {n}}_3 = \frac{1}{\sqrt{2}}[101]\), respectively. A dislocation loop with Burgers vector \(\varvec{\mathbf {b}} = a/2[\bar{1}11]\) and initial radius 16b is placed on the (110) face of the simulation cell by setting \(\phi _1\) equal to one inside the loop and all other order parameters to zero. Elastic isotropy is assumed with shear modulus \(\mu \) = 29.6 GPa and Young’s modulus equal to 82.7 GPa [30]. The Burgers vector b is set to 2.86 Å, and the quantity \(m_0 \Delta t\), which determines the rate of energy minimization, is set to 0.25 \(\mu ^{-1}\). A shear stress with magnitude 0.13\(\mu \) is applied to the \(\phi _1\) slip system.

Under the applied shear stress, the dislocation loop begins to expand. This glide is wavy and difficult as the dislocation traverses the variable USFE regions created by the disordered composition and local SRO (Fig. 7A). Because OTIS allows for the generation of many SRO lattices with just one WC parameter calculation, the same dislocation loop study is repeated several times, using different lattices with the same SRO. Each time, a different random initial lattice is input into OTIS, and, along with the statistical swapping choices, a new unique SRO lattice with SRO is created. Figure 7B and C shows the same dislocation loop setup through different lattices. The observed dislocation behavior depends on the underlying lattice, illustrating the need for many simulations to understand the mechanical behavior of MPEAs.

Fig. 7
figure 7

PFDD simulations of a dislocation loop expanding in TaNbTi using the Warren–Cowley parameters at 300K. The conditions in A, B, and C are identical except for the SRO lattice generated by OTIS. The initial loop is shown by the dashed line, and the solid line shows the loop after 75 time steps

Scope and Future Applications

OTIS is a time-efficient method for generating large numbers of simulation cells with hundreds of thousands of atoms that can then be used in atomistic or mesoscale simulations. It can be used when direct MC–MD calculations would be prohibitively expensive or time-consuming for the simulation cell size, or when many distinct SRO lattices are desired. The example structures here all concern equiatomic MPEAs, but OTIS can be used for any system with SRO, including conventional binary alloys or non-equiatomic MPEAs. Although not currently a feature of the code, the method itself could used for other lattice types beyond BCC and FCC, including HCP. Additionally, while the focus of this work was chemical ordering, the method could be applied to other types of SRO such as magnetic SRO. The only requirement of the method is the input of known WC parameters. In cases where the WC parameters are calculated for multiple temperatures, one could interpolate the parameters to intermediate temperatures and use OTIS to create the SRO structure, thus completely bypassing the need for additional MC–MD or MC–DFT calculations to create atomic lattices for those annealing temperatures.

The OTIS code could also be advanced to consider WC parameters beyond the first nearest neighbor shell. While most studies only calculate and report the WC parameters from the first nearest neighbor shell, WC parameters can be calculated for the second nearest neighbor shell and beyond [29]. In these cases, the additional WC parameters would simply be added as new bond types, represented as additional rows and columns in the \(c_{ij}\), \(g_{ij}\) and \(\delta _{ij}^\alpha (\varvec{x})\) matrices. In other words, A–B first nearest neighbor bonds would be considered separately from A–B second nearest neighbor bonds. The atom selection and acceptance criteria outlined here would account for all of these bond types when making swaps. Of course, this would increase the number of constraints that OTIS must meet to find a valid structure, but as we have shown here through the quinary MPEA calculations, OTIS can handle at least ten independent constraints.


We have developed a novel method to randomly generate atomic lattices with a given set of Warren–Cowley SRO parameters. The algorithm, called order through informed swapping (OTIS), begins with a random structure and swaps atoms until the goal Warren–Cowley parameters are reached. The method uses an informed selection criterion to choose the atoms for swapping, greatly increasing the efficiency and convergence of the algorithm. The code can be used to generate input structures for atomistic and mesoscale simulations without computationally intensive repeated Monte Carlo simulations. These structures can the facilitate studies of the effects of short-range order in multi-component alloys.