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

Journal logoJOURNAL OF
APPLIED
CRYSTALLOGRAPHY
ISSN: 1600-5767

DXRD: a user-friendly suite of two- and multiple-beam dynamical X-ray diffraction programs

crossmark logo

aAdvanced Photon Source, Argonne National Laboratory, 9700 South Cass Avenue, Lemont, Illinois, USA
*Correspondence e-mail: [email protected]

Edited by A. H. Liu, HPSTAR, People's Republic of China (Received 22 April 2025; accepted 21 August 2025; online 18 September 2025)

The DXRD program suite consisting of a series of dynamical theory programs is introduced for computing dynamical X-ray diffraction from single crystals. Its interactive graphical user interfaces (GUIs) allow general users to make complicated calculations with minimal effort. It can calculate plane-wave Darwin curves of single crystals (or multiple crystals) for both the Bragg and Laue cases, including grazing-incidence diffraction and backward diffraction (with Bragg angles approaching 90°). It is also capable of simulating rocking curves for divergent incident X-ray beams with finite bandwidths. A unique feature of DXRD is that it provides a convenient GUI-based multiple-beam diffraction program that can accurately compute arbitrary N-beam diffraction of any geometry using a universal 4N × 4N matrix method. DXRD also provides a mapping program for plotting all the multiple-beam diffraction lines (monochromator glitches) in the azimuth–energy coordinate system. All these functions make DXRD a convenient and powerful software tool for designing crystal-based synchrotron/X-ray optics (monochromators, analyzers, polarizers, phase plates etc.) and for crystal characterization, X-ray spectroscopy and X-ray diffraction teaching.

1. Introduction

The dynamical theory of X-ray diffraction is a well established wave theory that can accurately calculate X-ray diffraction from (nearly) perfect single crystals (Authier, 2001View full citation; Shvyd'ko, 2004View full citation). It has wide applications in crystal characterization and in the design of crystal-based synchrotron/X-ray optics. The theory is conceptually simple, but practical computation of crystal diffraction using the dynamical theory is, in fact, a daunting task even for experts. It requires complicated structure-factor calculations for arbitrary crystals and X-ray energies, consideration of various geometrical configurations, convolution with the beam conditions and instrument functions etc. Thus, most researchers rely on limited computer programs to perform dynamical theory computations.

Among the freely available programs, the XOP (X-ray Oriented Programs) package has been the main software for dynamical theory computation (Sánchez del Río & Dejus, 2011View full citation) and is widely used by scientists at synchrotron light sources. In parallel, Stepanov (2021View full citation) has been maintaining the web-based X-ray Server (https://x-server.gmca.aps.anl.gov) which also has a collection of popular dynamical diffraction programs. To run these programs, however, users need in-depth knowledge of the dynamical theory and its conventions, which often requires extensive study of documentation and textbooks. Furthermore, some diffraction conditions, such as non-coplanar diffraction, backward diffraction, multiple-beam diffraction (MBD) and convolution with instrument functions, may not be included in these programs or are only partially treated without universal and reliable algorithms.

Here we introduce another package, called DXRD, which consists of a series of dynamical theory programs integrated in a single executable file (see Fig. 1[link]). Distinctively, DXRD has interactive graphical user interfaces (GUIs) that can guide general users (including non-experts with little dynamical theory knowledge) to make complicated calculations with only a few mouse clicks without extensive consultations with documentation. It can calculate plane-wave rocking curves for both the Bragg and Laue cases, and it is also capable of simulating rocking curves for real incident X-ray beams with finite bandwidths and angular divergence. Another unique feature of DXRD is that it provides, for the first time, a convenient GUI-based MBD program that can rapidly compute N-beam diffraction (including coplanar and non-coplanar two-beam diffraction). This program is based on a full 4N × 4N matrix method which is valid for any diffraction geometry. Its computing algorithms have been highly optimized so that computing a 2D MBD intensity contour with ∼10000 points can be finished with minimal delays.

[Figure 1]
Figure 1
The interfaces of DXRD. All the programs are integrated into a single app. The front window is the interface of the MBD program. The typical workflow for most of the programs includes the simple step sequence of (1) defining the X-ray energy, (2) importing the crystal structure, (3) selecting the reflection(s), (4) setting the crystal thickness, (5) specifying surface offcut, (6) setting calculation range(s) and (7) performing the calculations.

DXRD was written with Visual C++ and the software package is available at the GitHub repository (https://github.com/xhuang555-anl/DXRD_Release). It is free for academic research. The entire DXRD software is a stand-alone application that can run on any Windows computers or laptops without the necessity of installation and does not depend on external resources. We hope that it will be a convenient software tool for researchers in the communities of synchrotron/X-ray optics, crystallography, X-ray spectroscopy etc., allowing fast development of synchrotron components or facilitating interpretation of experimental data. It can also be a teaching tool for students to learn X-ray diffraction.

2. General features and capabilities of DXRD

Similar to the sister program LauePt (Huang et al., 2010View full citation), DXRD does not require the user to register crystal structures to a central database. Instead, it allows the user to compile a simple text file for any crystal structure. The file only requires the information of (1) a crystal name, (2) the lattice constants a, b, c, α, β, γ, (3) the number of atoms in the unit cell, (4) the positions of the atoms in the unit cell and (5) the Debye characteristic temperatures. Then DXRD can import the file and calculate the structure factors of any reflections at any X-ray energies using either the tabulated-coefficient method (similar to XOP) or the Brennan–Cowan method (Brennan & Cowan, 1992View full citation). The user can also manually input structure factors.

From the structure factors, DXRD can quickly calculate the plane-wave rocking curves for both the Bragg-reflection geometry and the Laue-transmission geometry, including asymmetric reflection, grazing-incidence/exit geometry, backward reflection (with the Bragg angle Mathematical equation) etc. The diffraction curve can also be calculated as a function of the photon energy E, from which one obtains the spectral bandpass of the crystal as an X-ray monochromator or analyzer. The programs provide abundant flexibility for the user to freely change any of the parameters, followed by instant update of the diffraction curves. These features are particularly useful in the design of crystal-based X-ray optics.

In practical experiments, the incident X-ray beam always has angular divergence and a spectral bandwidth, which makes the measured rocking curve much wider than the intrinsic Darwin curve in most cases. The `Double-Crystal Diffraction' program of DXRD is for calculating the convoluted rocking curves based on an X-ray beam with finite divergence and energy spread that are conditioned by an upstream monochromator. When the monochromator is set to be a double-crystal monochromator (DCM), which is the typical setup at most synchrotron beamlines, the program can simulate the real rocking curves measured using synchrotron beams. It can also simulate the double-crystal rocking curves from laboratory-source-based diffractometers, where the incident beam has large divergence.

The `Multiple-Crystal Monochromator' program is for calculating and optimizing the angular acceptance, bandwidths and efficiency of monochromators consisting of multiple crystals in arbitrary arrangements. It is still in the early stages of development. Currently it can be used to model DCMs, channel-cut monochromators, four-bounce Bartels monochromators (Bartels, 1983View full citation; Loxley et al., 1995View full citation) etc.

3. Computation of MBD and mapping of MBD lines (monochromator glitches)

As mentioned above, a unique feature of DXRD is that it provides a rigorous GUI-based MBD program that can compute MBD (Colella, 1974View full citation; Stetsko & Chang, 1997View full citation; Chang, 2004View full citation) of any geometry with a universal algorithm. It is based on the Fourier coupled-wave diffraction theory (FCWDT) (Huang et al., 2013View full citation) which was originally developed for modeling optical diffraction from photonic crystals with thousands of diffraction orders (Huang et al., 2010View full citation). This algorithm is fast for MBD because X-ray diffraction can only involve up to tens of reflections.

To compute MBD, the user first chooses a primary reflection G and a horizontal reference direction (HRD) perpendicular to G in reciprocal space (see Fig. 1[link]). Then the program establishes a Cartesian coordinate system (CS) with the Z and X axes parallel to G and the HRD, respectively, as shown in Fig. 2[link](a). The direction of the incident beam is described by the diffraction angle Mathematical equation (relative to the diffracting planes) and the azimuthal angle Mathematical equation (relative to the X axis). Thus, in Fig. 2[link](a) the incident wavevector is

Mathematical equation

and the diffracted wavevector of the primary reflection G is

Mathematical equation

where Mathematical equation, Mathematical equation, Mathematical equation are unit vectors along the X, Y, Z axes, respectively, and Mathematical equation (λ is the X-ray wavelength). In general, the crystal surface has an offcut angle with respect to the diffracting planes of G, denoted by Mathematical equation in Fig. 2[link](b). Meanwhile, the offcut direction is described by the azimuthal angle Mathematical equation in Fig. 2[link](b). Note that the offcut can dramatically change the diffraction properties. For example, Fig. 2[link](c) shows the diffraction geometry for Mathematical equation = 180° and Mathematical equation = 90°, which is a symmetric Laue case for two-beam diffraction (2BD). When Mathematical equationn × 180° and Mathematical equation, the configuration corresponds to non-coplanar 2BD if only G is activated (Huang et al., 2025View full citation). Non-coplanar grazing-incidence 2BD is a typical example of this category which has important applications for studying in-plane (epitaxial) crystal surface/interface strains and structures (Stepanov et al., 1998View full citation).

[Figure 2]
Figure 2
The CS used by the MBD program for all diffraction configurations. (a) The CS related to the primary reflection G. (b) The parameters used for describing the offcut of the crystal surface with respect to the G diffracting planes. (c) The surface offcut parameters for symmetric Laue transmission of G.

Afterwards, the user can add a third Bragg reflection to the reflection list, and the MBD program automatically calculates its azimuthal angle(s) Mathematical equation (see Fig. 1[link]). When the principal azimuthal angle is set to Mathematical equation, it becomes a 3BD case, and users may calculate the 2D intensity contour around (Mathematical equation, Mathematical equation) in the Mathematical equationMathematical equation space (Mathematical equation is the Bragg angle of G). The MBD program can search for other reflections that may also (nearly) satisfy their Bragg conditions around the principal azimuthal angle. For example, for G = 004, reflections 111 and 113 of silicon always have exactly the same azimuthal angle, indicating that this is a 000–004–111–113 4BD process. Then the user can freely add additional reflections to the reflection list. If the Bragg condition of any added reflection is not fulfilled, it does not affect the computation results (although it may slightly slow down the computation). The MBD program has no restriction on the number of reflections included. As shown in Fig. 1[link], the overall MBD interface for user input is quite simple, but the program can perform powerful computations behind the scenes. In fact, the FCWDT is capable of treating all dynamical diffraction cases in 3D space (including the above 2D coplanar two-beam Bragg and Laue cases) with a universal 4N × 4N matrix method, where N is the number of participating reflections (including Mathematical equation).

Fig. 3[link](a) shows the reflectivity contour of the primary reflection Si 004 at E = 8 keV under the 000–004–111–113 4BD conditions. Without the influence of reflections 111 and 113, the 004 reflectivity contour is a horizontal band independent of Φ. Around the 4BD angular range, the secondary reflections 111 and 113 share the incident energy, leading to `loss of intensities' and distortions of the diffraction pattern for the primary reflection G.

[Figure 3]
Figure 3
Examples of MBD reflectivity contours computed by DXRD. (a) Reflectivity contour of the primary reflection 004 in 000–004–111–113 4BD with the HRD [100]. The principal azimuthal angle is Mathematical equation Mathematical equation, where the 4BD condition is fulfilled. Mathematical equation. Mathematical equation Mathematical equation. (b) 111 reflectivity contour in 000–111–002 3BD. Mathematical equation from the HRD Mathematical equation. (c) Reflectivity contour of the forbidden primary reflection 002 in 000–002–111 3BD. Mathematical equation from the HRD [100]. The incident beam is a plane wave with E = 8 keV for (a)–(c). (d) Intensity contour of reflection 002 under the same conditions as in (c) except that the incident beam has an angular divergence of 10 µrad along both the Mathematical equation and Mathematical equation directions and a spectral bandwidth of 1 eV. σ Polarization. Mathematical equation.

A 3BD process involving reflections Mathematical equation Mathematical equation, Mathematical equation (primary reflection) and Mathematical equation (operative reflection) has a hidden reflection channel Mathematical equation, called the cooperative reflection by Cole et al. (1962View full citation). For 3BD to occur, only two of the three reflections Mathematical equation, Mathematical equation and Mathematical equation are required to be allowed reflections. This means that, for the cubic diamond structure, the triplet (000, 111, 002), as an example, is an allowed 3BD combination although 002 is a forbidden reflection. Here X-rays can be diffracted first by reflection 111 and then by the cooperative reflection Mathematical equation to form the 002 reflection; i.e. 002 is a `detour reflection' (Morelhão & Abramof, 1999View full citation; Huang et al., 2014View full citation). Fig. 3[link](b) shows the intensity contour of the primary reflection Mathematical equation of Si under the 000–111–002 3BD conditions at E = 8 keV. Compared with 111 2BD, it is obvious that here the 111 reflection has the MBD features of intensity loss and diffraction pattern distortions. Note that the 000–111–002 case has a different reflection sequence to the 000–111–Mathematical equation case although they involve the same reflections. The latter has a different azimuthal angle Mathematical equation and the intensity contour of the primary reflection is a mirror image of the contour in the former case.

As another example, Fig. 3[link](c) shows the intensity contour of the primary reflection 002 in the 000–002–111 3BD process at E = 8 keV. Here 002 itself is a forbidden direction, but the contour clearly shows its strong diffraction intensities around the 3BD center. These intensities are transferred by the detour reflection route Mathematical equation (Lang et al., 2013View full citation; Tang et al., 2021View full citation; Zaumseil, 2015View full citation). When Mathematical equation is far away from Mathematical equation, the 002 reflection tends to disappear. This is different from Figs. 3[link](a) and 3[link](b), where the primary reflection approaches 2BD when Mathematical equation is far away from Mathematical equation. Here the simulation in Fig. 3[link](a) is consistent with the simulation by Estradiote et al. (2025View full citation) using a different MBD program. Fig. 3[link](d) shows the convoluted intensity contour of the 002 reflection based on a real incident beam with divergence of 10 µrad along both of the two orthogonal directions perpendicular to Mathematical equation in Fig. 2[link](a). Meanwhile, the beam has a Gaussian spectrum with an FWHM bandwidth of 1 eV. It is obvious that these real beam conditions smooth the sharp features in Fig. 3[link](c).

Overall, our numerous tests verify that the MBD program works correctly for all diffraction configurations. The program can also calculate convoluted MBD intensity contours or curves for incident X-ray beams with 2D angular divergence and finite bandwidths.

In addition to the MBD search function, DXRD also provides an independent mapping program for drawing MBD lines [also called monochromator glitches (Bunker, 2010View full citation)] in the azimuth–energy (Mathematical equationE) space. In the literature, a commonly overlooked situation in mapping of MBD lines for Si, Ge and diamond is that forbidden reflections as operative reflections are ignored. For example, for Si(111) monochromators, attention has been paid to glitches caused only by allowed reflections, such as 400, 220, 311 etc. When acting as operative reflections, however, forbidden reflections such as 200, 240, Mathematical equation etc. can all produce glitches [see Fig. 3[link](b)] because the corresponding cooperative reflections (Mathematical equation, Mathematical equation, Mathematical equation) are allowed reflections. These reflections have been largely ignored in the past. DXRD fully takes into account the detour reflections. For Si, Ge and diamond crystals, DXRD uses the simple diamond structure rule to judge whether a reflection hkl itself is allowed [ h,k,l are all even numbers with Mathematical equation (n any integer), or h,k,l are all odd numbers] or forbidden. For general crystals, the program calculates the structure factor of each reflection. If the structure factor is below the threshold value (which the user can set), the reflection is considered a forbidden reflection. However, the forbidden reflection is not necessarily excluded unless the involved triplet (Mathematical equation, Mathematical equation and Mathematical equation) has less than two allowed reflections. Calculations of the structure factors for thousands of reflections used to be time consuming, but DXRD again uses a finely tuned algorithm which makes the calculations and mapping very fast (within a few seconds for most cases).

Another phenomenon ignored in the literature is that vertical MBD lines are usually missing in Mathematical equationE maps. Such lines correspond to the continuous MBD geometry described by Huang et al. (2014View full citation). A typical example is the Si 004 reflection with the HRD along [100], which is always a 000–004–022–Mathematical equation 4BD case at Mathematical equation for any photon energy. Therefore, it corresponds to a vertical line at Mathematical equation in the 004 reflection map of Fig. 4[link]. However, this continuous MBD line seems missing in the map computed by the MARE program of XOP. Note that all allowed reflections of Si except 111 and 220 have vertical continuous MBD lines. In designing X-ray monochromators and analyzers, it is critical to avoid these lines because they always activate MBD at any diffraction energy. DXRD can reliably reveal such lines. Overall, the Mathematical equationE mapping program of DXRD is useful for supporting MBD computations and for designing monochromators and analyzers. It is also helpful for interpreting X-ray spectroscopy patterns. Rossmanith (2003View full citation) has made important achievements in the calculation and graphical representation of MBD patterns, particularly with the UMWEG program. This program has a unique function that can quickly calculate the approximate intensity profile of the glitches (which has also been implemented in XOP), but this function is not implemented in DXRD. Although the MBD program can calculate the accurate (convoluted) intensities of glitches [e.g. Fig. 3[link](d)] on the basis of the rigorous dynamical theory, the computation is much slower.

[Figure 4]
Figure 4
MBD lines in the Mathematical equationE map of primary reflection Si 004. The red line corresponds to continuous 000–004–022–Mathematical equation 4BD which always occurs for any energy E at Mathematical equation.

4. Summary

We have introduced a new software tool, DXRD, for computing almost all kinds of X-ray diffraction from perfect single crystals using the dynamical theory. It has straightforward GUIs that allow general users to run the programs without the neeed for in-depth dynamical theory knowledge. The interactive input interfaces always automatically check the validity of the input parameters and guide the user to run the program. DXRD can calculate the conventional 2BD rocking curves of both the Bragg and Laue cases (including grazing-incidence geometry and backward diffraction) for both plane waves and divergent beams with finite spectral bandwidths. In particular, MBD computations have been extremely difficult up to now, even for experts. DXRD provides a universal and fast algorithm with which users can easily perform complicated MBD computations. Since it treats X-ray diffraction in 3D space using a full vectorial matrix method, this algorithm is rigorous and applicable for all kinds of N-beam diffraction cases in 3D space (including coplanar and non-coplanar 2BD). DXRD also provides a mapping tool for accurately drawing all MBD lines in the azimuth–energy space, and this function is useful for indexing monochromator glitches in X-ray-spectroscopy-related fields.

Acknowledgements

We thank Quanjie Jia and Zheng Tang for many helpful discussions and for debugging the programs.

Funding information

This work was supported by the US Department of Energy (DOE) Office of Science – Basic Energy Sciences, under contract No. DE-AC02-06CH11357.

References

Return to citationAuthier, A. (2001). Dynamical theory of X-ray diffraction, International Union of Crystallography monographs on crystallography, No. 11. IUCr/Oxford University Press.  Google Scholar
Return to citationBartels, W. J. (1983). J. Vac. Sci. Technol. B Microelectron. Process. Phenom. 1, 338–345.  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 citationBunker, G. (2010). Introduction to XAFS: a practical guide to X-ray absorption fine structure spectroscopy. Cambridge University Press.  Google Scholar
Return to citationChang, S. L. (2004). X-ray multiple-wave diffraction: theory and applications, Solid state sciences series, Vol. 143. Berlin: Springer-Verlag.  Google Scholar
Return to citationCole, H., Chambers, F. H. & Dunn, H. M. (1962). Acta Cryst. 15, 138–144.  CrossRef CAS IUCr Journals Web of Science Google Scholar
Return to citationColella, R. (1974). Acta Cryst. A30, 413–423.  CrossRef CAS IUCr Journals Web of Science Google Scholar
Return to citationEstradiote, M. B., Nisbet, A. G. A., Penacchio, R. F. S., Miranda, M. A. R., Calligaris, G. A. & Morelhão, S. L. (2025). J. Appl. Cryst. 58, 859–868.  CrossRef CAS IUCr Journals Google Scholar
Return to citationHuang, X., Assoufid, L. & Macrander, A. T. (2025). J. Synchrotron Rad. 32, 90–99.  CrossRef CAS IUCr Journals Google Scholar
Return to citationHuang, X.-H., Peng, R.-W. & Fan, R.-H. (2010). Phys. Rev. Lett. 105, 243901.  CrossRef PubMed Google Scholar
Return to citationHuang, X.-H., Peng, R.-W., Hönnicke, M. G. & Gog, T. (2013). Phys. Rev. A 87, 063828.  CrossRef Google Scholar
Return to citationHuang, X.-R., Jia, Q., Wieczorek, M. & Assoufid, L. (2014). J. Appl. Cryst. 47, 1716–1721.  Web of Science CrossRef CAS IUCr Journals Google Scholar
Return to citationLang, R., de Menezes, A. S., dos Santos, A. O., Reboh, S., Meneses, E. A., Amaral, L. & Cardoso, L. (2013). J. Appl. Cryst. 46, 1796–1804.  Web of Science CrossRef CAS IUCr Journals Google Scholar
Return to citationLoxley, N., Tanner, B. K. & Bowen, D. K. (1995). J. Appl. Cryst. 28, 314–317.  CrossRef CAS Web of Science IUCr Journals Google Scholar
Return to citationMorelhão, S. L. M. & Abramof, E. (1999). J. Appl. Cryst. 32, 871–877.  CrossRef IUCr Journals Google Scholar
Return to citationRossmanith, E. (2003). J. Appl. Cryst. 36, 1467–1474.  Web of Science CrossRef CAS IUCr Journals Google Scholar
Return to citationSánchez del Río, M. & Dejus, M. (2011). Proc. SPIE 8141, 814115.  Google Scholar
Return to citationShvyd'ko, Y. (2004). X-ray optics, high-energy-resolution applications. Berlin: Springer.  Google Scholar
Return to citationStepanov, S. (2021). J. Appl. Cryst. 54, 1530–1534.  CrossRef CAS IUCr Journals Google Scholar
Return to citationStepanov, S. A., Kondrashkina, E. A., Köhler, R., Novikov, D. V., Materlik, G. & Durbin, S. M. (1998). Phys. Rev. B 57, 4829–4841.  CrossRef CAS Google Scholar
Return to citationStetsko, Yu. P. & Chang, S.-L. (1997). Acta Cryst. A53, 28–34.  CrossRef CAS Web of Science IUCr Journals Google Scholar
Return to citationTang, Z., Zheng, L., Chu, S., An, P., Huang, X., Hu, T. & Assoufid, L. (2021). J. Appl. Cryst. 54, 976–981.  Web of Science CrossRef CAS IUCr Journals Google Scholar
Return to citationZaumseil, P. (2015). J. Appl. Cryst. 48, 528–532.  Web of Science CrossRef CAS 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