computer programs
accessDXRD: a user-friendly suite of two- and multiple-beam dynamical X-ray diffraction programs
aAdvanced Photon Source, Argonne National Laboratory, 9700 South Cass Avenue, Lemont, Illinois, USA
*Correspondence e-mail: [email protected]
The DXRD program suite consisting of a series of 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.
Keywords: X-ray dynamical theory; multiple-beam diffraction; Darwin curves; monochromator glitches; Bragg reflection.
1. Introduction
The of X-ray diffraction is a well established wave theory that can accurately calculate X-ray diffraction from (nearly) perfect single crystals (Authier, 2001
; Shvyd'ko, 2004
). 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, 2011
) and is widely used by scientists at synchrotron light sources. In parallel, Stepanov (2021
) 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
). Distinctively, DXRD has interactive graphical user interfaces (GUIs) that can guide general users (including non-experts with little 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 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, 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., 2010
), 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 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, 1992
). 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 ) 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, 1983
; Loxley et al., 1995
) 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, 1974
; Stetsko & Chang, 1997
; Chang, 2004
) of any geometry with a universal algorithm. It is based on the Fourier coupled-wave diffraction theory (FCWDT) (Huang et al., 2013
) which was originally developed for modeling optical diffraction from photonic crystals with thousands of diffraction orders (Huang et al., 2010
). 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 (see Fig. 1
). 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
(a). The direction of the incident beam is described by the diffraction angle (relative to the diffracting planes) and the azimuthal angle
(relative to the X axis). Thus, in Fig. 2
(a) the incident wavevector is
and the diffracted wavevector of the primary reflection G is
where ,
,
are unit vectors along the X, Y, Z axes, respectively, and
(λ is the X-ray wavelength). In general, the crystal surface has an offcut angle with respect to the diffracting planes of G, denoted by
in Fig. 2
(b). Meanwhile, the offcut direction is described by the azimuthal angle in Fig. 2
(b). Note that the offcut can dramatically change the diffraction properties. For example, Fig. 2
(c) shows the diffraction geometry for = 180° and
= 90°, which is a symmetric Laue case for two-beam diffraction (2BD). When
≠ n × 180° and
, the configuration corresponds to non-coplanar 2BD if only G is activated (Huang et al., 2025
). 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., 1998
).
| 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) (see Fig. 1
). When the principal azimuthal angle is set to , it becomes a 3BD case, and users may calculate the 2D intensity contour around (
,
) in the
–
space (
is the 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
, 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 ).
Fig. 3
(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 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 |
A 3BD process involving reflections
,
(primary reflection) and
(operative reflection) has a hidden reflection channel
, called the cooperative reflection by Cole et al. (1962
). For 3BD to occur, only two of the three reflections ,
and
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
to form the 002 reflection; i.e. 002 is a `detour reflection' (Morelhão & Abramof, 1999
; Huang et al., 2014
). Fig. 3
(b) shows the intensity contour of the primary reflection 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–
case although they involve the same reflections. The latter has a different azimuthal angle
and the intensity contour of the primary reflection is a mirror image of the contour in the former case.
As another example, Fig. 3
(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 (Lang et al., 2013
; Tang et al., 2021
; Zaumseil, 2015
). When is far away from
, the 002 reflection tends to disappear. This is different from Figs. 3
(a) and 3
(b), where the primary reflection approaches 2BD when is far away from
. Here the simulation in Fig. 3
(a) is consistent with the simulation by Estradiote et al. (2025
) using a different MBD program. Fig. 3
(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 in Fig. 2
(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
(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, 2010
)] in the azimuth–energy (–E) 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,
etc. can all produce glitches [see Fig. 3
(b)] because the corresponding cooperative reflections (,
,
) 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
(n any integer), or h,k,l are all odd numbers] or forbidden. For general crystals, the program calculates the of each reflection. If the 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 (
,
and
) 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 –E maps. Such lines correspond to the continuous MBD geometry described by Huang et al. (2014
). A typical example is the Si 004 reflection with the HRD along [100], which is always a 000–004–022– 4BD case at
for any photon energy. Therefore, it corresponds to a vertical line at
in the 004 reflection map of Fig. 4
. 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 –E mapping program of DXRD is useful for supporting MBD computations and for designing monochromators and analyzers. It is also helpful for interpreting patterns. Rossmanith (2003
) 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
(d)] on the basis of the rigorous dynamical theory, the computation is much slower.
| Figure 4 MBD lines in the |
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
Authier, A. (2001). Dynamical theory of X-ray diffraction, International Union of Crystallography monographs on crystallography, No. 11. IUCr/Oxford University Press. Google Scholar
Bartels, W. J. (1983). J. Vac. Sci. Technol. B Microelectron. Process. Phenom. 1, 338–345. CrossRef CAS Google Scholar
Brennan, S. & Cowan, P. L. (1992). Rev. Sci. Instrum. 63, 850–853. CrossRef Web of Science Google Scholar
Bunker, G. (2010). Introduction to XAFS: a practical guide to X-ray absorption fine structure spectroscopy. Cambridge University Press. Google Scholar
Chang, S. L. (2004). X-ray multiple-wave diffraction: theory and applications, Solid state sciences series, Vol. 143. Berlin: Springer-Verlag. Google Scholar
Cole, H., Chambers, F. H. & Dunn, H. M. (1962). Acta Cryst. 15, 138–144. CrossRef CAS IUCr Journals Web of Science Google Scholar
Colella, R. (1974). Acta Cryst. A30, 413–423. CrossRef CAS IUCr Journals Web of Science Google Scholar
Estradiote, 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
Huang, X., Assoufid, L. & Macrander, A. T. (2025). J. Synchrotron Rad. 32, 90–99. CrossRef CAS IUCr Journals Google Scholar
Huang, X.-H., Peng, R.-W. & Fan, R.-H. (2010). Phys. Rev. Lett. 105, 243901. CrossRef PubMed Google Scholar
Huang, X.-H., Peng, R.-W., Hönnicke, M. G. & Gog, T. (2013). Phys. Rev. A 87, 063828. CrossRef Google Scholar
Huang, X.-R., Jia, Q., Wieczorek, M. & Assoufid, L. (2014). J. Appl. Cryst. 47, 1716–1721. Web of Science CrossRef CAS IUCr Journals Google Scholar
Lang, 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
Loxley, N., Tanner, B. K. & Bowen, D. K. (1995). J. Appl. Cryst. 28, 314–317. CrossRef CAS Web of Science IUCr Journals Google Scholar
Morelhão, S. L. M. & Abramof, E. (1999). J. Appl. Cryst. 32, 871–877. CrossRef IUCr Journals Google Scholar
Rossmanith, E. (2003). J. Appl. Cryst. 36, 1467–1474. Web of Science CrossRef CAS IUCr Journals Google Scholar
Sánchez del Río, M. & Dejus, M. (2011). Proc. SPIE 8141, 814115. Google Scholar
Shvyd'ko, Y. (2004). X-ray optics, high-energy-resolution applications. Berlin: Springer. Google Scholar
Stepanov, S. (2021). J. Appl. Cryst. 54, 1530–1534. CrossRef CAS IUCr Journals Google Scholar
Stepanov, 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
Stetsko, Yu. P. & Chang, S.-L. (1997). Acta Cryst. A53, 28–34. CrossRef CAS Web of Science IUCr Journals Google Scholar
Tang, 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
Zaumseil, 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.
access
journal menu



