computer programs\(\def\hfill{\hskip 5em}\def\hfil{\hskip 3em}\def\eqno#1{\hfil {#1}}\)

Journal logoJOURNAL OF
APPLIED
CRYSTALLOGRAPHY
ISSN: 1600-5767

GenL: an extensible fitting program for Laue oscillations and whole-pattern fitting

crossmark logo

aDepartment of Physics and Astronomy, Uppsala University, Box 516, SE-75120 Uppsala, Sweden
*Correspondence e-mail: [email protected]

Edited by S. Boutet, SLAC National Accelerator Laboratory, Menlo Park, USA (Received 27 October 2023; accepted 10 March 2026; online 14 May 2026)

GenL is a flexible program that can be used to simulate and/or fit X-ray reflectivity and X-ray diffraction data from epitaxial thin films exhibiting, for example, Laue oscillations. It utilizes differential evolution within a genetic algorithm for fitting data and uses a modular approach based on either the kinematic theory of diffraction or the dynamic theory. Effects of polarization, absorption and the Lorentz factor, as well as instrumental resolution and lattice vibrations, are taken into account. Useful parameters that can be extracted after fitting include atomic interplanar spacings, number of coherently scattering atomic planes, strain profiles along the film thickness and crystal roughness. The program has been developed in MATLAB and employs a graphical user interface. The deployment strategy is twofold, whereby the software can be obtained either in source code form and executed within the MATLAB environment or as a pre-compiled binary for those who prefer not to run it within MATLAB. Finally, GenL can be easily extended to simulate multilayered film systems, superlattices and films with atomic steps. The program is released under the GNU General Public License.

1. Introduction and motivation

High-crystal-quality epitaxial thin films are intriguing model systems. Low defect density and minor crystal misorientation allow for a direct and easy comparison with theoretical predictions (Neugebauer & Hickel, 2013View full citation). When experimentally verifying the crystal quality of epitaxial thin films, the presence of Laue oscillations in X-ray diffraction patterns is regarded as a key indication of high crystallinity (Miller et al., 2022View full citation). Laue oscillations are only observable if the coherence length of the epitaxial layer is of the order of the film thickness and the latter is smaller than the longitudinal coherence length of the X-ray photons. The occurrence of Laue oscillations is often used to qualitatively characterize samples, associating their presence with high crystallinity and low defect density (Krauss et al., 2008View full citation; Shu et al., 2020View full citation; Song et al., 2020View full citation; Kamigaki et al., 1990View full citation; De Teresa et al., 2007View full citation), thickness uniformity (Naito et al., 2001View full citation; Xu et al., 2017View full citation; Hu et al., 2013View full citation), smooth and flat interface layering (Abe et al., 2002View full citation; Xu et al., 2017View full citation; Miyadera et al., 2021View full citation; Radu et al., 2006View full citation), and film homogeneity (Först et al., 2015View full citation). Nevertheless, a quantitative analysis of the Laue oscillations, modeling their angular spacing, intensity decay and asymmetry around their respective Bragg peak, can yield additional structural insights (Fullerton et al., 1992View full citation; Stierle et al., 1993View full citation; Komar & Jakob, 2017View full citation; Miller et al., 2022View full citation).

For instance, the characteristic period of the Laue oscillations is related to the number of coherently scattering layers, and hence to the coherent thickness of the layer. However, the thickness determined via the separation of Laue oscillations can deviate from the thickness determined by the spacing of the Kiessig fringes found in reflectivity measurements (Kiessig, 1931View full citation). A possible origin of this difference may be the presence of excess material at an interface (Miller et al., 2022View full citation) with a similar electron density to the film but with a different crystal structure. This region adds to the total film thickness determined via the spacing of the Kiessig fringes, but it would not affect the thickness determined via the Laue oscillations as the mismatch in crystal structure terminates the crystal coherence length of the film. The intensity decay of the Laue oscillations can be understood in terms of the roughness of the layer, i.e. the distribution of out-of-plane thickness that contributes to coherent scattering. Moreover, an asymmetry of the Laue oscillation intensity on either side of the Bragg peak is frequently observed (Miller et al., 2022View full citation) and often associated with out-of-plane strain (Vartanyants et al., 2000View full citation; Robinson & Vartanyants, 2001View full citation; Kästle et al., 2002View full citation; Komar & Jakob, 2017View full citation) or other factors (Miller et al., 2022View full citation). Numerous powerful open-source program codes exist for simulating and fitting of diffraction patterns including Laue oscillations, e.g. SUPREX (Fullerton et al., 1992View full citation), GenX (Björck & Andersson, 2007View full citation; Glavic & Björck, 2022View full citation), CADEM (Komar & Jakob, 2017View full citation) or InteractiveXRDFit (Lichtensteiger, 2018View full citation), alongside commercially available software, e.g. BedeREFS (Wormington et al., 1999View full citation) or Leptos (Ulyanenkov, 2004View full citation). However, the focus of most of them lies mainly on the fitting of superlattice peaks and not on the detailed analysis of the Laue oscillations and their shape.

The open-source software SUPREX is designed for superconductor superlattices and written in Fortran and Turbo Pascal (Fullerton et al., 1992View full citation), with a non-trivial extension to other materials (Komar & Jakob, 2017View full citation). GenX is designed to fit X-ray reflectivity (XRR) patterns (Björck & Andersson, 2007View full citation), being primarily sensitive to electron-density profiles along the z axis. It is possible to adjust it in order to fit high-angle scattering data, though reconfiguring the program for these settings is not effortless and detailed analysis of the shape of the oscillations is difficult to implement. CADEM, on the other hand, which is written in MATLAB, can be used to simulate scattering patterns without a fitting option and without the inclusion of crystal roughness. Finally, InteractiveXRDFit, a MATLAB program designed for oxide thin films and heterostructures, utilizes an intermediate approach between the two limits of the kinematic and dynamic X-ray diffraction theories to calculate, but not fit, the diffracted intensity (Lichtensteiger, 2018View full citation). Besides these, Monte Carlo simulations can be used to reproduce experimental diffraction patterns; however, their application is hindered by their high degree of complexity for modeling realistic sample structures (Komar & Jakob, 2017View full citation).

Hence, we identified the need for GenL, an open-source and easy-to-adapt Laue oscillation fitting program, which is able to not only simulate but also fit experimental diffraction patterns of epitaxial thin films. In GenL, a representative diffraction pattern, which includes all the aforementioned parameters influencing the shape of the measured oscillations, is simulated and fitted to experimental data.

The associated parameters are tuned via a differential-evolution algorithm (Storn & Price, 1997View full citation) until a minimum difference of the figure of merit between the data and simulation has been obtained.

In this work, we first present the theoretical background for the calculations of the diffraction patterns used in GenL. We then illustrate how the program can be used to fit experimental data and to analyze the sample layering and crystal structure, with the option to include roughness as well as strain profiles and defects. Finally, we show a few examples of the versatile applications of GenL.

2. Theoretical background

X-ray diffraction can be used to determine the separation between crystallographic planes dhkl via Bragg's law (Bragg & Bragg, 1913View full citation):

Mathematical equation

where λ is the X-ray wavelength and θhkl is the angle at which constructive interference occurs between sets of planes associated with the Miller indices hkl. Equivalently, the conditions for Bragg reflections are fulfilled when the photon's momentum-transfer wavevector Q coincides with the reciprocal crystal lattice point represented by the vector Ghkl. In a symmetric θ–2θ scan, the goniometer is driven so that the detector moves through 2θ while the incident angle remains θ = (2θ)/2. Under this condition, the momentum-transfer vector varies only in the direction perpendicular to the lattice planes being probed, assuming proper alignment and correction for miscut and other systematic deviations. Its modulus can then be written as

Mathematical equation

2.1. Kinematic approach

Assuming the reciprocal lattice vector is oriented parallel to Q, and referring to this direction as z (with x being perpendicular to z and in the scattering plane), the intensity I(Q) diffracted from the crystal can be written in the kinematic approximation as

Mathematical equation

where NL corresponds to the total number of coherently scattering lattice planes within the coherence volume of the X-rays, zn is the position of the nth atomic plane in the thin-film stack (taking z1 = 0 in the center of the first layer above the substrate interface) and Mathematical equation is the Debye–Waller factor of layer n. This expression is generalized in the code to an arbitrary stack of layers, including a substrate, with spacing di between layers, where i is an interface index.

The element-specific Debye–Waller pre-factor B includes the contribution of the time-averaged displacement of atoms due to lattice vibrations. The dispersion-corrected and Q-dependent form factor f(Q) is given by (Wilson & Geist, 1993View full citation; Henke et al., 1993View full citation)

Mathematical equation

along with the anomalous Δf′ and absorption Δf′′ corrections of Brennan & Cowan (1992View full citation). f0(Q) is commonly expressed in its parameterized form (Waasmaier & Kirfel, 1995View full citation):

Mathematical equation

where a, b and c are the form-factor parametrization coefficients of a particular atomic species. For an alloy, f(Q) is a mole fraction weighted sum of the form factors of the elements in the alloy (with the possibility of having different form factors for different oxidation states).

Several other factors need to be considered (Warren, 1990View full citation; Fullerton et al., 1992View full citation) if the diffracted intensity is to be compared with the experimentally observed intensity. The first factor P(θ) includes the inherent polarization dependence of the scattering of an X-ray with an electron, as well as the change in polarization when passing through a monochromator. The second factor A(θ) accounts for the absorption of X-rays along the angle-dependent path lengths of the incident and diffracted rays. The third factor is the Lorentz factor L(θ), which takes into account deviations from a perfect instrument and the mosaic nature of the crystal. The experimentally observed intensity is then given by

Mathematical equation

Further details on origin and derivation of these factors can be found elsewhere (Buerger & Klein, 1945View full citation; Warren, 1990View full citation; Fewster, 1996View full citation; Birkholz, 2005View full citation), but for the convenience of the reader, we give a brief overview of their importance here.

The polarization factor P(θ) depends on whether a monochromator is used and whether it is located on the incidence side or on the detector side. On the incidence side it takes the form (Azároff, 1955View full citation)

Mathematical equation

while on the detector side it takes the form (Yao & Jinno, 1982View full citation)

Mathematical equation

where θM is the diffraction angle of the monochromator. If no monochromators are being used, then θM is equal to zero.

The absorption factor A(θ) corrects for the angle-dependent attenuation of X-rays in the sample. For a single layer measured using a θ/2θ geometry, the absorption factor, corresponding to the effective combined probe and escape depth of the sample, is equal to

Mathematical equation

where t is the thickness of the film. We assume all extinction effects are negligible. The linear attenuation coefficient μ can be computed as the product of the atomic density ρ (number of formula units per volume) and the photoabsorption cross section of the sample, which is included in the form-factor correction Δf′′. The linear attenuation coefficient is then written as

Mathematical equation

where re is the electron radius, m is the number of elements in the alloy and ci is the mole fraction of element i.

Finally, as an option in the program, the Lorentz factor L(θ) captures the angle-dependent changes of the intensity, due to the combination of monochromator imperfections, beam divergence, finite detection resolution and mosaicity in the sample. L(θ) depends on the measurement geometry. Further details can be found elsewhere (Warren, 1990View full citation). The combined change in intensity can be corrected via

Mathematical equation

3. Dynamical approach

The dynamic version of the code is an exact calculation of the X-ray scattering using the formulation of Holý & Fewster (2008View full citation). The essential feature is a matrix propagation using Parratt's algorithm of the (complex) electron density through the entire stack, including any substrate. In contrast to the algorithm in GenX where slab models are used for each physical layer, here every unit cell is further divided into a number of slabs (typically 100). The algorithm is therefore expected to be much slower than a typical reflectivity calculation, but through a number of optimization steps the run time has been cut by several orders of magnitude compared with a naive implementation, thereby rendering these calculations practical. However, the kinematic approach is still faster and is recommended for initial fits to the data. Furthermore, matrix propagation diverges when large numbers of slabs are used but is avoided here by a normalization procedure. Our implementation differs from Holý and Fewster's in that in their work the electron density is calculated in reciprocal space, whereas we calculate the density in real space. This is to allow for the possibility of strain and roughness, which are easier to conceptualize in real space.

The electron density is calculated (Holý & Fewster, 2008View full citation), if the type of atoms and their coordinates are known, by overlaying the inverse Fourier transforms of the atomic form factors (including dispersion corrections, absorption and Debye–Waller factors) and dividing by the in-plane area of the unit cell. The average electron density is calculated on a grid of points that is specified by the user, along with the limits of integration of the form factors. Strain is implemented by moving the coordinates prior to the transform. At present, a linear strain profile is included from one or both sides of each layer. Crystal roughness is implemented by a Gaussian weighting procedure of calculations of slabs with a different number of unit cells (truncated at three standard deviations). Monolayers can be implemented as separate unit cells by the user. Finally, a layer of vacuum (or air) is added to both sides of the stack. Once the electron density per unit length has been obtained, the diffraction pattern is calculated by matrix propagation, taking the polarization of the incoming X-rays into account and squaring the reflectivity coefficient at the topmost layer. Thus, reflectivity, absorption and transmission can be calculated to any precision from an arbitrary stack of layers including the effects of strain and roughness. This includes the effects of refraction, Darwin broadening and total reflection: all effects that are not present in the kinematic approach. The density profile generated by GenL cannot be fed into GenX to calculate the diffraction pattern, owing to the divergences and prohibitively slow calculation. To simulate unpolarized light we perform the dynamical calculation for both s and p polarization and combine them. For the case where the monochromator is located on the incidence side, we obtain

Mathematical equation

and a similar expression is found for when the monochromator is on the detector side. We have omitted the Laue factor for the dynamical case because it diverges at low angles.

Fig. 1[link] depicts the diffraction pattern using the dynamical approach for a bulk single crystal of GaAs with vacuum on either side. The reflectivity region exactly corresponds to that calculated from GenX as shown in Fig. 2[link], and the diffraction pattern exhibits Darwin widths as calculated by Holý and Fewster (inset of Fig. 1[link]). Both s and p polarizations are shown in the figure, in excellent agreement with the calculations by Holý & Fewster (2008View full citation). The dynamical results deviate from the results from GenX at larger scattering angles, highlighting the potential importance of including diffraction effects when fitting reflectivity.

[Figure 1]
Figure 1
Simulated X-ray diffraction pattern of a GaAs crystal using the dynamic formalism, assuming Cu Kα1 radiation. Curves are shown for both the s and p polarizations, along with a comparison with the output of GenX for the same structure. The inset depicts a detailed view of the strongest diffraction peak for s polarization and the characteristic Darwin shape.
[Figure 2]
Figure 2
Comparison of simulated reflectivity curves for a GaAs substrate, assuming Cu Kα1 radiation. The curves have been calculated using the dynamical approach and are compared with the Parratt formalism as implemented in GenX. The inset provides a detailed comparison for angles below the total reflection.

Moreover, electron density obtained from density functional theory or other codes can be used as direct input into the code and the exact diffraction pattern can be calculated. This can be useful when studying subtle changes to the electron density associated with, for example, Jahn–Teller distortions or crystal-field splitting, and magnetic effects, which are not captured by the use of tabulated form factors.

4. GenL

In GenL, a diffraction pattern is calculated via the stated equations. However, to model X-ray scattering intensity measured in a non-ideal diffractometer setup of a non-perfect single crystal, additional intensity contributions are included in the calculation. Instrumental peak broadening is accounted for by a Gaussian convolution. Moreover, the background intensity Ibkg(Q) originating from thermal diffuse scattering, fluorescence radiation, Compton scattering, air scattering, the detector dark current and coherent diffuse scattering from defects needs to be included. In the close vicinity of a peak, assuming a linear dependence often allows for a reliable modeling of Ibkg(Q) (Birkholz, 2005View full citation):

Mathematical equation

However, for certain samples, which e.g. include amorphous layers (for example, protective cap layers), a more complex polynomial modeling might be needed, such that

Mathematical equation

where a, b and c are constants. Both options are available to choose from in GenL. Furthermore, several choices are available for inclusion of the substrate in the intensity calculation in GenL for the kinematic case, Isub(θ). The first choice is to model the substrate Bragg peak with a Lorentzian function following

Mathematical equation

where I0,sub(θ) is the substrate peak intensity, wsub is the half-width at half-maximum of the peak and x0,sub is the expected peak position in 2θ. However, for the case where the Bragg peak positions from film and substrate lie close to each other, scattering from film and substrate will interfere, which can cause an asymmetry in the Laue oscillations as well as an intensity shift of the Bragg peak position (Robinson et al., 1988View full citation). An accurate calculation of the scattering pattern hence requires one to add the scattering amplitudes from film and substrate prior to squaring. Using the GenL command-line version the substrate can be included as any other layer, in either the kinematic or exact dynamic approach. In addition, in GenL, out-of-plane strain in the thin film as well as layer roughness can be taken into account. Strain in a single layer is modeled in the code by displacing the atoms in the calculated one-dimensional stack according to a certain strain profile, which can be either exponential or linear. For the exponential case, the displacement εn of the nth atom from its position in an unstrained lattice (Fullerton et al., 1992View full citation) is given by

Mathematical equation

where d0 denotes the out-of-plane distance between the atomic planes for the unstrained case and α is a fitting parameter. For the linear strain profile, both the slope and the extent into the layer can be fitted. In the program we consider strain originating from the substrate/film interface (α1) and strain originating from an additional film/capping interface (α2). The latter is not relevant for sole single layers without capping. The respective induced strain can be either tensile or compressive, resulting in the addition or subtraction of εn to/from the position in an unstrained lattice, respectively. The layer roughness σ is included in GenL employing

Mathematical equation

where the set A are all integers in a 3σ interval around NL, i.e. [NL − 3σ, NL + 3σ] (Fewster, 1996View full citation). In the command-line version of GenL, any other model for strain and layer roughness can be manually included, e.g. strain due to charge-density waves (Singer et al., 2016View full citation) or roughness based on binomial fluctuations (Miceli et al., 1992View full citation).

For a single layer, using the kinematic formulation we have implemented a graphical user interface (GUI), whereby the theoretical X-ray scattering pattern calculated in GenL is fitted to the measured intensity using 13 parameters:

(i) the out-of-plane interplanar spacing d;

(ii) the number of coherently scattering planes N;

(iii) the resolution and scale factor for the Gaussian con­volution;

(iv) parameters modeling the background intensity – a, b and c;

(v) parameters modeling a substrate peak – I0,sub, wsub and x0,sub;

(vi) the strain parameters α1 and α2; and

(vii) the roughness parameter σ.

The fitting in GenL utilizes differential evolution within a genetic algorithm (Storn & Price, 1997View full citation) like the one used in GenX (Björck & Andersson, 2007View full citation; Glavic & Björck, 2022View full citation). The algorithm first generates parameter vectors. The population of parameter vectors (parent population) is then changed to create a new population with a better fit compared with the previous one until the stopping criterion – in GenL the maximum number of iterations – is fulfilled. Further details on the used algorithm as well as on the population generation can be found elsewhere (Björck & Andersson, 2007View full citation). The genetic algorithm can be tuned in the command-line version of GenL in terms of the population size and crossover factor.

GenL is similar to GenX as it also offers a GUI. Both are open source and can be customized individually for specific applications. Furthermore, both have embedded libraries/interfaces with databases to hold material and scattering parameters. However, in GenX the layering in a thin-film stack is simulated, whereas GenL simulates the atomic ordering. It provides deeper insights into the atomic structures and crystal properties, which GenX fits cannot do. In contrast to GenX, GenL is not applicable to all kinds of layers, e.g. amorphous layers. In cases where information about interatomic spacing and coordination is required, recently developed tools designed to determine pair distribution functions of thin films using laboratory-based X-ray sources can be utilized (Bylin et al., 2024View full citation).

An example of a GenL fit of the scattering pattern of an epitaxial vanadium (V) thin film is displayed in Fig. 3[link]. According to XRR measurements, the thickness of the V layer is 105 Å. The fit takes the tensile out-of-plane strain due to the negative lattice mismatch between the V and the MgO (001) substrate into account. The calculated exponentially decaying strain profile is shown as an inset. The CADEM simulation for the same data set published by Komar & Jakob (2017View full citation) is displayed as a blue line. Also, the CADEM simulation includes a strain profile (Komar & Jakob, 2017View full citation), which is in qualitative agreement with the strain profile presented here. The magnitude of the exponential decay in out-of-plane lattice parameter c as a function of position is larger for the fit with GenL, in particular for depths in the sample corresponding to the first two unit cells. The drastic change in c is, hence, calculated to occur only close to the substrate/V interface and might include contributions from interface roughness or atomic steps, which may contribute to an asymmetric decay of the oscillations but are not considered here. The over-estimation of the tetragonal unit-cell distortion at the interface is therefore considered to be an artefact. Numeric values of fitted strain profiles should be analyzed carefully and may be considered only a qualitative indicator if important contributions to the scattering intensity, especially at interfaces, have been neglected in the selected model for a certain sample. The CADEM simulation corresponds to a coherent thickness of 84 Å. On the basis of the GenL fit, the coherent thickness of this V film is 86.3 Å. Komar & Jakob (2017View full citation) attribute this difference from the XRR-determined thickness to a partly oxidized surface with similar electron density but different crystal structure. We see that we can account for the asymmetry of the profile by including a strain profile combined with crystal roughness.

[Figure 3]
Figure 3
X-ray diffraction pattern of a 105 Å thick V layer on an MgO (001) substrate. The pattern was previously published by Komar & Jakob (2017View full citation) with a simulation of the diffraction pattern created with CADEM. This simulation is displayed in blue. A fit of the data with GenL is shown in red. The corresponding strain profile, i.e. the out-of-plane lattice parameter c as a function of the number of unit cells counting from the substrate interface, is displayed as an inset.

4.1. Technical details

GenL has been developed in the high-level programming language MATLAB (The MathWorks Inc., Natick, MA, USA). MATLAB is available for numerous operating systems, namely Windows, macOS and Linux/Unix. The GenL program can either be run from the command line after adjusting the input file in a text editor or be run from the GenL GUI. The GUI currently supports fitting a single layer using the kinematic approximation, whereas the command-line version supports any structure and either the kinematic or the dynamic approach. Since the code is rather compact, an adaptation to other programming languages such as Python, C, C++ or Java is straightforward. However, any alteration of the GUI requires a deeper understanding of the MATLAB programming language. The command-line version of the program was tested on the following MATLAB versions: R2019b, R2020b, R2022b, R2023a, R2023b, R2024a, R2024b and R2025. No additional toolbox installations are required. The GenL GUI runs correctly in MATLAB versions published in 2022 or later. In older versions, the graphical display in the app might be distorted. Possible distortions of the graphical display in all versions can be avoided if the program is running on one screen only.

4.2. Using GenL

For running GenL from the command line, the user is re­quired to edit the input file fit_laue_oscillations.m. This input file is displayed as a green trapezium-shaped box in the flow chart in Fig. 4[link]. First, the file and path of the measurement as well as important measurement parameters need to be specified. Second, material-specific parameters (atomic number Z, density, chemical composition, the Debye–Waller pre-factor), sample parameters (layer thickness, expected Bragg angle/interplanar spacing) and instrument parameters (wavelength, setup, measurement time, amplitude, resolution, background level) need to be added. For a limited number of elements, the element-specific Debye–Waller pre-factor can be extracted from a database (Sears & Shelley, 1991View full citation) as well, or be put in manually. Furthermore, three features can be included in the fitting process of the program: strain, roughness and a potentially present peak originating from a single-crystalline substrate, which can be accounted for by adding a Lorentzian intensity contribution at the respective Bragg angle. If any of these features are included, their respective parameters need to be specified in the code as well. Finally, upper and lower bounds for the fitting parameters are constructed and can be adjusted as necessary. Running the input file will start the fitting process, which is further described in the next section.

[Figure 4]
Figure 4
Flow chart of the different modules of the program. Corresponding functions/folders in GenL are displayed in the bottom of the respective boxes.

4.3. Program organization

A flow chart of all GenL modules including their function names is displayed in Fig. 4[link]. When GenL is executed, form factors are constructed following equations (4[link]) and (5[link]). In the input file a fitting function is called with start values as well as upper and lower boundaries for all fitting parameters. The fitting function creates a current solution for all parameters, on the basis of which a scattering pattern is calculated according to the equations in Section 2[link] in the evaluation function. The evaluation function compares the theoretical intensity profile and the data input and calculates the goodness of the fit for the current solution using a logarithmic figure of merit. It is straightforward to add other figures of merit to the code. In the fitting function the figures of merit of solutions are compared. The fitting function and the function that compares different solutions were adapted from the work of Storn & Price (1997View full citation). If the current solution is an improvement compared with previous solutions, the fit is plotted and the corresponding parameters are printed out in the command window. A maximum number of iterations is specified by the user in the input file.

4.4. Graphical user interface

GenL can also be used via the GenL GUI. The program can be executed within the MATLAB environment or through a pre-compiled binary, the latter of which does not require an installation of MATLAB to run. A flow chart of the GUI is displayed in Fig. 5[link]. The GenL GUI consists of three different tabs corresponding to three steps: data import, simulating a sample and fitting the data. Alternatively, the user can also select an option in the import tab to simulate only without data import or fitting. Following the first path, the user is asked to import the measurement that is to be fitted and prompted to enter the relevant measurement parameters. In the simulate tab, the user supplies all relevant information on the expected crystal structure and layering of the sample as well as on the instrument setup. In the fit tab, the user can proceed to tick a selection of parameters to be fitted. Moreover, a diffraction pattern can at this stage be simulated on the basis of the chosen parameter values and plotted against the imported data. It is possible for the user to display the fit, along with the fitted parameters with their respective lower and upper bounds, the evolution of the figure of merit, and the fitted strain profile.

[Figure 5]
Figure 5
Flow chart of the GenL GUI. Blue boxes correspond to different tabs; white boxes represent processes in the tabs. There are two possible paths using the program: either first uploading data, simulating a diffraction pattern and fitting the data (yellow path) or only simulating a diffraction pattern based on the choice of input parameters (pink path).

5. Application examples

In this section we showcase some examples of employing GenL to fit diffraction patterns measured on W and Fe thin films. Details on the thin-film growth can be found in the respective publications for the W (Ravensburg et al., 2024aView full citation) and Fe thin films (Ravensburg et al., 2022View full citation; Ravensburg et al., 2024bView full citation). All diffractograms presented in this section were measured in a Bede D1 diffractometer equipped with a Cu Mathematical equation X-ray source operated at 35 mA and 50 kV. A circular mask (diameter: 0.005 m) and an incidence and a detector slit (both 0.0005 m) were used. The beam was monochromated by reducing the Cu Kβ and Cu Kα2 radiation using a Göbel mirror and a two-bounce crystal on the incidence side. The X-rays were detected with a Bede EDRc X-ray detector. Details on the growth and diffraction study of an Fe/V superlattice with a ratio of 4 monolayers of Fe to 28 monolayers of V in 11 bilayer repetitions, which is presented in comparison with a calculation with GenL, can be found elsewhere (Droulias et al., 2017View full citation).

5.1. The influence of roughness

Thin W (110) layers can be epitaxially grown on Al2O3 (Mathematical equation) substrates with high crystal quality despite a large lattice mismatch of 7.2% and 19.4% along the W [Mathematical equation] and W [Mathematical equation] directions, respectively (Ravensburg et al., 2024aView full citation). The diffraction pattern of such a thin film, as shown in Fig. 6[link], exhibits Laue oscillations around the W (220) Bragg peak. The Laue oscillations have a high degree of symmetry indicating a small degree of strain in the layer. Fitting the oscillations including roughness in GenL yields the fit displayed in red in Fig. 6[link]. From the fit, the roughness is estimated to be 4 Å. This interface roughness is in agreement with roughness values at the W/capping interface obtained from Kiessig fringe fitting using GenX (Björck & Andersson, 2007View full citation; Glavic & Björck, 2022View full citation) for the same sample (Ravensburg et al., 2024aView full citation). The analysis of the GenL fitting employed by Ravensburg et al. (2024aView full citation) contributed to the understanding that W exhibits a semicoherent interface on Al2O3 (Mathematical equation) with an immediate strain relaxation taking place directly at the substrate/W interface and serves as an example of the successful application of GenL in studies on epitaxial growth.

[Figure 6]
Figure 6
X-ray diffraction pattern around the W (220) Bragg peak of a 100 Å thick W layer grown on an Al2O3 (Mathematical equation) substrate. A fit of the data with GenL taking roughness into account is shown in red. The sharp peak at around 80° originates from the single-crystalline substrate.

5.2. Accounting for overlapping substrate peak intensity

A similar analysis can also be done with the scattering pattern around the W (110) Bragg peak instead, which is displayed in Fig. 7[link]. However, the sharp peak at around 38° originating from the single-crystalline Al2O3 (Mathematical equation) substrate overlaps in intensity with the Laue oscillations, making an analysis more challenging. This angular overlap in the scattering patterns originating from film and substrate is common for epitaxial growth as it is attributed to the similar out-of-plane lattice parameters in the substrate and the film. An example of a fit including roughness together with this modeled substrate peak intensity is displayed in red. The two fits from Figs. 6[link] and 7[link] for the same sample yield similar fitted parameters. The deviation of the d110 obtained from both fits is 0.05%.

[Figure 7]
Figure 7
X-ray diffraction pattern around the W (110) Bragg peak of a 100 Å thick W layer grown on an Al2O3 (Mathematical equation) substrate. A fit of the data with GenL taking roughness into account as well as modeling intensity originating from the substrate is shown in red.

5.3. The influence of strain

Besides roughness and substrate peak intensity, GenL is also capable of taking a strain profile, i.e. a change in out-of-plane interplanar spacing over layer thickness, into account similarly to InteractiveXRDFit (Lichtensteiger, 2018View full citation). In Fig. 8[link] the diffraction pattern of a 100 Å thick Fe layer grown on an MgAl2O4 (001) substrate is displayed. The GenL fit employing an exponentially decaying strain profile is shown in blue. In the employed strain profile, the out-of-plane lattice spacing decreases over the Fe layer thickness, in line with a tensile out-of-plane strain induced at the substrate/Fe interface by a lattice mismatch (Ravensburg et al., 2022View full citation). The shape of this strain profile is in agreement with the observation that thinner Fe films that are epitaxially grown on MgAl2O4 (001) exhibit on average larger out-of-plane lattice spacings of the order of the predicted values in the profile. However, the fit does not fully capture the asymmetric decay of the oscillations on both sides of the Bragg peak. In an experimental study on thin Fe layers (6–100 Å) grown on MgAl2O4 (001) substrates (Ravens­burg et al., 2024bView full citation), Fe grows in a tetragonally distorted body-centered tetragonal (bct) crystal structure for Fe layer thicknesses below 3–8 monolayers before the equilibrium body-centered cubic (bcc) crystal structure stabilizes on this substrate. GenL can be used to investigate this growth even at the thin-film limit. Hence, the diffraction pattern was fitted employing the out-of-plane interplanar distance profile of a bct Fe/bcc Fe bilayer with both bilayer thicknesses and interplanar spacings as fitting parameters (Ravensburg et al., 2024bView full citation). The results are displayed in red in Fig. 8[link]. It is evident that the fit based on the bilayer profile captures the detected scattering intensity better and reproduces the asymmetry present in the intensity of the oscillations around the Fe (002) Bragg peak. This example demonstrates the full potential of the application of GenL in research work.

[Figure 8]
Figure 8
X-ray diffraction pattern around the Fe (002) Bragg peak of a 100 Å thick Fe layer grown on an MgAl2O4 (001) substrate. Fits of the data with GenL taking tensile out-of-plane strain and a bct Fe/bcc Fe bilayer layering into account are shown in blue and red, respectively. The fitted strain profiles, i.e. the evolution of the interplanar spacing d over the number of atomic layers n, are displayed in the inset in their respective colors.

5.4. Limitations and possible extensions of the program

Besides the factors already included in GenL, there are others that may also influence the measured diffracted intensity from an epitaxial thin film, e.g. sample alignment, the X-ray beam footprint, crystallographic defects or mosaicity, all of which are not yet included in the program. Some of these factors will be added in future versions of GenL.

The command-line version of GenL can be extended to correctly calculate diffraction patterns for alloys because GenL is modeling an effective one-dimensional stack of atoms whose order and positions can be adjusted. Even different/additional layers with multiple repetitions can be included. Hence, GenL can be easily adapted for more complex multilayer stacks composed of different materials and/or different crystal structures, such as superlattice structures. An example of a diffraction pattern from an Fe/V superlattice simulated in GenL is displayed in Fig. 9[link] and compared against experimentally measured diffraction data (Droulias et al., 2017View full citation).

[Figure 9]
Figure 9
X-ray scattering pattern from an Fe/V (4/28) superlattice with 11 bilayer repetitions (Droulias et al., 2017View full citation) (blue) and a corresponding simulation of the diffraction intensity using GenL (red). The curves have been vertically shifted for clarity.

Fitting of superlattice diffraction data is not yet implemented in the current version of GenL but will be included in future versions. The simulation of superlattice diffraction patterns is, however, straightforward in the command-line version. Moreover, the code versatility enables the user to conduct a more in-depth analysis by simulating the presence of atomic step terraces. In particular, for epitaxial systems where out-of-plane atomic steps in the substrate are incommensurate with the out-of-plane atomic distance in the epitaxially grown film, interference of the scattering intensity from different stacks with vertical mismatch can contribute to an observed asymmetry in Laue oscillations (Fullerton et al., 1992View full citation; Miller et al., 2022View full citation), which may be relevant for fitting certain scattering patterns.

6. Conclusions

We have developed and presented a new versatile program, GenL, for the simulation of diffraction patterns from epitaxial thin films. The combination of this program with other existing X-ray reflectivity fitting programs, such as GenX (Björck & Andersson, 2007View full citation; Glavic & Björck, 2022View full citation), can form a powerful toolbox for rendering a fuller and more detailed structural picture for highly crystalline epitaxial thin films, exploiting X-ray scattering techniques. Finally, the ability to include and fit against experimental data a series of interface (strain) and structural parameters (atomic steps, superlattices etc.) will hopefully be a useful asset for the research community, encouraging a detailed and quantitative analysis of diffraction patterns comprising Laue oscillations.

7. Program distribution

GenL is freely available from the authors under the GNU General Public License (GPL). A web page (https://github.com/scatterer/GenL) exists for the distribution of the program. The package contains the MATLAB code, an executable of the GUI, example files for fitting and examples for sample simulations if the GUI is used. Comments, feedback and support can be communicated using the following email addresses: [email protected] and [email protected].

Acknowledgements

The authors express their gratitude to Professor Dr Gerhard Jakob for supplying the data presented in Fig. 3[link].

Data availability

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

Funding information

VK and GKP acknowledge funding from the Swedish Research Council (Project Nos. 2019-03581 and 2018-05200, respectively).

References

Return to citationAbe, Y., Kawamura, M. & Sasaki, K. (2002). Jpn. J. Appl. Phys. 41, 6857–6861.   CrossRef CAS Google Scholar
Return to citationAzároff, L. V. (1955). Acta Cryst. 8, 701–704.  CrossRef IUCr Journals Web of Science Google Scholar
Return to citationBirkholz, M. (2005). Principles of X-ray Diffraction, ch. 1, pp. 1–40. John Wiley and Sons.  Google Scholar
Return to citationBjörck, M. & Andersson, G. (2007). J. Appl. Cryst. 40, 1174–1178.  Web of Science CrossRef IUCr Journals Google Scholar
Return to citationBragg, W. H. & Bragg, W. L. (1913). Proc. R. Soc. London Ser. A 88, 428–438.  CrossRef CAS Google Scholar
Return to citationBrennan, S. & Cowan, P. L. (1992). Rev. Sci. Instrum. 63, 850–853.  CrossRef Web of Science Google Scholar
Return to citationBuerger, M. J. & Klein, G. E. (1945). J. Appl. Phys. 16, 408–418.  CrossRef CAS Web of Science Google Scholar
Return to citationBylin, J., Kapaklis, V. & Pálsson, G. K. (2024). J. Appl. Cryst. 57, 1373–1383.  CrossRef CAS IUCr Journals Google Scholar
Return to citationDe Teresa, J., Fernández-Pacheco, A., Morellon, L., Orna, J., Pardo, J., Serrate, D., Algarabel, P. & Ibarra, M. (2007). Microelectron. Eng. 84, 1660–1664.  CrossRef CAS Google Scholar
Return to citationDroulias, S. A., Pálsson, G. K., Palonen, H., Hasan, A., Leifer, K., Kapaklis, V., Hjörvarsson, B. & Wolff, M. (2017). Thin Solid Films 636, 608–614.  CrossRef CAS Google Scholar
Return to citationFewster, P. F. (1996). Rep. Prog. Phys. 59, 1339–1407.  CrossRef CAS Web of Science Google Scholar
Return to citationFörst, M., Caviglia, A., Scherwitzl, R., Mankowsky, R., Zubko, P., Khanna, V., Bromberger, H., Wilkins, S., Chuang, Y.-D., Lee, W., Schlotter, W. F., Turner, J. J., Dakovski, G. L., Minitti, M. P., Robinson, J., Clark, S. R., Jaksch, D., Triscone, J. M., Hill, J. P., Dhesi, S. S. & Cavalleri, A. (2015). Nat. Mater. 14, 883–888.  Web of Science PubMed Google Scholar
Return to citationFullerton, E. E., Schuller, I. K., Vanderstraeten, H. & Bruynseraede, Y. (1992). Phys. Rev. B 45, 9292–9310.  CrossRef CAS Web of Science Google Scholar
Return to citationGlavic, A. & Björck, M. (2022). J. Appl. Cryst. 55, 1063–1071.  Web of Science CrossRef CAS IUCr Journals Google Scholar
Return to citationHenke, B., Gullikson, E. & Davis, J. (1993). At. Data Nucl. Data Tables 54, 181–342.  CrossRef CAS Web of Science Google Scholar
Return to citationHolý, V. & Fewster, P. F. (2008). J. Appl. Cryst. 41, 18–26.  Web of Science CrossRef IUCr Journals Google Scholar
Return to citationHu, Y., Stender, D., Medarde, M., Lippert, T., Wokaun, A. & Schneider, C. (2013). Appl. Surf. Sci. 278, 92–95.  CrossRef CAS Google Scholar
Return to citationKamigaki, K., Terauchi, H., Terashima, T., Bando, Y., Iijima, K., Yamamoto, K. & Hirata, K. (1990). Solid State Ionics 40–41, 815–818.  CrossRef CAS Google Scholar
Return to citationKästle, G., Boyen, H.-G., Koslowski, B., Plettl, A., Weigl, F. & Ziemann, P. (2002). Surf. Sci. 498, 168–174.   Google Scholar
Return to citationKiessig, H. (1931). Annalen Phys. 402, 715–768.  CrossRef Google Scholar
Return to citationKomar, P. & Jakob, G. (2017). J. Appl. Cryst. 50, 288–292.  Web of Science CrossRef CAS IUCr Journals Google Scholar
Return to citationKrauss, T. N., Barrena, E., Zhang, X. N., de Oteyza, D. G., Major, J., Dehm, V., Würthner, F., Cavalcanti, L. P. & Dosch, H. (2008). Langmuir 24, 12742–12744.  CrossRef PubMed CAS Google Scholar
Return to citationLichtensteiger, C. (2018). J. Appl. Cryst. 51, 1745–1751.  Web of Science CrossRef CAS IUCr Journals Google Scholar
Return to citationMiceli, P. F., Palmstrom, C. J. & Moyers, K. W. (1992). Appl. Phys. Lett. 61, 2060–2062.  CrossRef CAS Google Scholar
Return to citationMiller, A. M., Lemon, M., Choffel, M. A., Rich, S. R., Harvel, F. & Johnson, D. C. (2022). Z. Naturforsch. B 77, 313–322.  Web of Science CrossRef CAS Google Scholar
Return to citationMiyadera, T., Auchi, Y., Yamamoto, K., Ohashi, N., Koganezawa, T., Yaguchi, H., Yoshida, Y. & Chikamatsu, M. (2021). Appl. Mater. Interfaces 13, 22559–22566.  CrossRef CAS Google Scholar
Return to citationNaito, M., Karimoto, S., Yamamoto, H., Nakad, H. & Suzuki, K. (2001). IEEE Trans. Appl. Supercond. 11, 3848–3851.  CrossRef Google Scholar
Return to citationNeugebauer, J. & Hickel, T. (2013). WIREs Comput. Mol. Sci. 3, 438–448.  CrossRef CAS Google Scholar
Return to citationRadu, F., Nefedov, A., Grabis, J., Nowak, G., Bergmann, A. & Zabel, H. (2006). J. Magn. Magn. Mater. 300, 206–210.  CrossRef CAS Google Scholar
Return to citationRavensburg, A. L., Brucas, R., Music, D., Spode, L., Pálsson, G. K., Svedlindh, P. & Kapaklis, V. (2024a). Appl. Phys. A 130, 74.  CrossRef Google Scholar
Return to citationRavensburg, A. L., Pálsson, G. K., Pohlit, M., Hjörvarsson, B. & Kapaklis, V. (2022). Thin Solid Films 761, 139494.  CrossRef Google Scholar
Return to citationRavensburg, A. L., Werwiński, M., Rychły-Gruszecka, J., Snarski-Adamski, J., Elsukova, A., Persson, P. O., Rusz, J., Brucas, R., Hjörvarsson, B., Svedlindh, P., Pálsson, G. K. & Kapaklis, V. (2024b). Phys. Rev. Mater. 8, L081401.  CrossRef Google Scholar
Return to citationRobinson, I. & Vartanyants, I. (2001). Appl. Surf. Sci. 182, 186–191.   CrossRef CAS Google Scholar
Return to citationRobinson, I. K., Tung, R. T. & Feidenhans'l, R. (1988). Phys. Rev. B 38, 3632–3635.  CrossRef CAS Google Scholar
Return to citationSears, V. F. & Shelley, S. A. (1991). Acta Cryst. A47, 441–446.  CrossRef CAS Web of Science IUCr Journals Google Scholar
Return to citationShu, X., Zhou, J., Liu, L., Lin, W., Zhou, C., Chen, S., Xie, Q., Ren, L., Xiaojiang, Y., Yang, H. & Chen, J. (2020). Phys. Rev. Appl. 14, 054056.  CrossRef Google Scholar
Return to citationSinger, A., Patel, S. K. K., Uhlíř, V., Kukreja, R., Ulvestad, A., Dufresne, E. M., Sandy, A. R., Fullerton, E. E. & Shpyrko, O. G. (2016). Phys. Rev. B 94, 174110.  CrossRef Google Scholar
Return to citationSong, Y., Li, Z., Li, H., Tang, S., Mu, G., Xu, L., Peng, W., Shen, D., Chen, Y., Xie, X. & Jiang, M. (2020). Nanotechnology 31, 165704.  CrossRef PubMed Google Scholar
Return to citationStierle, A., Abromeit, A., Metoki, N. & Zabel, H. (1993). J. Appl. Phys. 73, 4808–4814.  CrossRef CAS Google Scholar
Return to citationStorn, R. & Price, K. (1997). J. Glob. Optim. 11, 341–359.  CrossRef Web of Science Google Scholar
Return to citationUlyanenkov, A. (2004). Proc. SPIE 5536, 1–15.   CrossRef Google Scholar
Return to citationVartanyants, I., Ern, C., Donner, W., Dosch, H. & Caliebe, W. (2000). Appl. Phys. Lett. 77, 3929–3931.  Web of Science CrossRef CAS Google Scholar
Return to citationWaasmaier, D. & Kirfel, A. (1995). Acta Cryst. A51, 416–431.  CrossRef CAS Web of Science IUCr Journals Google Scholar
Return to citationWarren, B. E. (1990). X-ray Diffraction. Courier Corporation.  Google Scholar
Return to citationWilson, A. J. C. & Geist, V. (1993). Cryst. Res. Technol. 28, 110.  CrossRef Google Scholar
Return to citationWormington, M., Panaccione, C., Matney, K. M. & Bowen, D. K. (1999). Philos. Trans. R. Soc. London Ser. A 357, 2827–2848.  CrossRef CAS Google Scholar
Return to citationXu, J., Katoch, J., Ahmed, A. S., Pinchuk, I. V., Young, J. R., Johnston-Halperin, E., Pelz, J. & Kawakami, R. K. (2017). J. Cryst. Growth 460, 134–138.  CrossRef CAS Google Scholar
Return to citationYao, T. & Jinno, H. (1982). Acta Cryst. A38, 287–288.  CrossRef CAS Web of Science IUCr Journals Google Scholar

This is an open-access article distributed under the terms of the Creative Commons Attribution (CC-BY) Licence, which permits unrestricted use, distribution, and reproduction in any medium, provided the original authors and source are cited.

Journal logoJOURNAL OF
APPLIED
CRYSTALLOGRAPHY
ISSN: 1600-5767
Follow J. Appl. Cryst.
Sign up for e-alerts
Follow J. Appl. Cryst. on Twitter
Follow us on facebook
Sign up for RSS feeds