computer programs
PGMweb: an online tool for visualizing the X-ray beam path through plane grating monochromators
aDiamond Light Source, Harwell Science and Innovation Campus, Didcot, Oxfordshire OX11 0DE, United Kingdom, and bEaSTCHEM School of Chemistry, University of Edinburgh, Edinburgh EH9 3FJ, United Kingdom
*Correspondence e-mail: patrick.wang@chem.ox.ac.uk, murilo.bazan-da-silva@diamond.ac.uk, andrew.walters@diamond.ac.uk
We present here a newly developed software tool (called PGMweb) for computing and simulating the X-ray beam path through a plane grating monochromator (PGM), a key component in soft X-ray beamlines at modern synchrotron and free-electron laser facilities. A historical overview of the development of PGMs is presented, with special attention dedicated to the collimated PGM optical scheme found at several X-ray facilities worldwide. The analytical expressions that fully describe the geometry of a PGM are derived and have been implemented as functions in a Python library (pyplanemono). PGMweb is distributed as a web-based application that can be run in any modern browser without installation, making its use very straightforward for X-ray beamline designers and beamline scientists alike.
Keywords: monochromator; plane grating; soft X-rays.
1. Introduction
Monochromatic soft X-ray beams are indispensable for many areas of ongoing research. To perform K-edges of abundant main group elements (such as carbon and oxygen) as well as at the L-edges of the first row transition metals (such as iron or nickel), one needs to work in the soft X-ray range. Both and (XPS) performed with soft X-rays can shed light on the underlying physical and chemical processes at work in a variety of different research areas, from thin-film magnetism (Aich et al., 2023) to catalytic processes (Venezia, 2003), and from strongly correlated electron systems (Gilmore et al., 2021) to prototype battery materials (Liu et al., 2019).
at theAchieving monochromation in the soft X-ray range is not straightforward. Below ∼2000 eV, one cannot use a double-crystal monochromator with Si(111) reflections, as the wavelength of the incoming photons is too large to satisfy the Bragg condition. In this energy range (∼50–2000 eV), potential crystal candidates with d-spacings large enough to accommodate the longer wavelengths are few and far between (Sutter, 2021). Moreover, the current capabilities in high-purity manufacturing of these exotic crystals are relatively limited, and in most cases their thermal properties are far from optimal, which is a significant factor considering the high heat load beams produced at large-scale X-ray facilities. These issues mean that double-crystal monochromators devoted to soft X-ray studies are rather impractical.
However, the dispersive property of reflective diffraction gratings (Ebert, 1889) offers the possibility of a monochromator design with adequate efficiency in the soft X-ray range. The pioneering work of Kunz et al. more than 50 years ago featured a monochromator which combines a plane mirror and plane grating (Kunz et al., 1968), aptly named the plane grating monochromator (PGM). However, the mechanical design of the Kunz setup was rather complicated, as it required the mirror optic to be translated as well as rotated during operation. Later work performed at Zeiss during the 1980s (Riemer & Torge, 1983) showed that a single eccentric rotation of the mirror would, in effect, achieve the desired simultaneous translation and rotation. This mechanical arrangement was originally used at BESSY in the SX-700 type PGM design popular in the 1980s and 1990s (Petersen et al., 1995) and is used in the vast majority of PGMs in operation today. Furthermore, PGMs are increasingly attractive monochromators for use in the notoriously difficult tender X-ray range (∼1500 eV to 4000 eV) due to recent advances in multilayer grating manufacturing (Wen et al., 2024; Werner et al., 2023).
Diffraction from a grating is governed by the grating equation,
where n is the diffraction order and therefore takes integer values, λ is the selected wavelength of the radiation, g is the grating line density (normally defined in lines mm−1), and the angles α and β are as presented in Fig. 1 (see also Table 1). Throughout this work we follow the convention used in the X-ray data booklet (Thompson et al., 2009), where α and β have opposite signs if they are on opposite sides of the normal. During operation, the mirror and the grating are rotated in a coordinated way to change α and/or β whilst ensuring that the outgoing rays remain parallel to the incoming rays. The grating disperses the X-rays in energy, and a small fraction of the dispersed radiation is then selected via a fixed downstream exit slit with a tunable opening in the dispersive direction. In this way a monochromatic beam is produced.
|
A common way to parameterize the relationship between α and β for a given grating geometry is through the property originally defined as the constant of fixed-focus (Petersen et al., 1995), now commonly referred to as the grating cff,
By substituting equation (2) into equation (1) and with suitable algebraic manipulations, one arrives at the updated grating equation commonly used today when operating PGMs,
The only angular dependence of equation (3) is now in β, and equation (3) is essentially a quadratic equation in . α can be calculated from β and a given cff; and θ can be solved by imposing that the incoming and outgoing rays must remain parallel, that is, 2θ = α − β. Equation (3) calculates all three angles while only requiring the user of a PGM to dictate the desired diffraction order, the energy to be transmitted, and a value of cff.
Nowadays a significant proportion of soft X-ray beamlines use the collimated PGM (cPGM) optical scheme proposed by Follath et al., as it offers the ability to operate the PGM at different values of cff while maintaining a focused beam at the exit slit in the dispersive direction (Follath & Senf, 1997; Follath, 2001). This is in contrast to the older SX-700 scheme described by Petersen, where the beam was non-parallel in the vertical plane at the PGM, and it therefore required the use of the focusing properties of a plane grating (Petersen, 1982), and thus restricted the cff to a single value. Modifying cff in a cPGM beamline enables scientists to directly tune the improve higher-order suppression, and/or customize the vertical divergence of the beam for a given experiment. The cPGM scheme continues to be one of the most popular soft X-ray beamline designs despite the fact that it has been more than two decades since its inception.
The mechanical design of a modern PGM is rather complicated, primarily stemming from the requirements that (1) the beam is always incident on the centre of the grating optical surface, and (2) the outgoing beam should remain parallel to the incoming beam. To achieve this, the mirror is rotated eccentrically, with the centre of rotation of the mirror located at C in Fig. 1 (Riemer & Torge, 1983). The point C is offset from the origin of the PGM coordinate system (O) by the vector in the convention used here. The intercept of the incoming X-ray beam with the mirror surface is then a non-trivial function of the photon energy and the PGM cff. While some time ago Pimpale et al. provided an analytical description of this geometrical design (Pimpale et al., 1991), here we reintroduce some of the derivations described in that work but with an alternative parameterization that we feel is more practical for use by scientists at X-ray facilities.
The mechanical evolution of the PGM as it performs an energy scan is potentially unintuitive. The complex nature of coupled rotations of the mirror and grating makes checking the feasibility of a set of PGM parameters non-trivial, as understanding the limits of operation for a PGM requires complete knowledge of its geometry. Limitations are encountered when:
(1) The beam is either blocked by the edges of the mirror or the grating leading to a partial/total loss of (a) and 2(b).
Figs. 2(2) The beam is no longer incident on the optical surfaces of the mirror and/or the grating, Fig. 3(a).
(3) The grating or mirror is over-illuminated, Fig. 3(b).
In Fig. 3, we have included additional inset plots showing the `footprint view' of the beam geometry within the PGM. The footprint view presents the beam footprints where the beam impinges on the respective optical surfaces, and does not show the propagating beam. It differs from a top view in two primary ways: (i) the grating has been offset horizontally for clarity so as not to overlap with the mirror, and (ii) the mirror and grating optical surfaces (and the corresponding beam footprints) are viewed normal to each optical surface. The horizontal direction is the direction of propagation of the rays (x) and the vertical direction is parallel to the widths of the optical elements (z). We have included the footprint view in PGMweb, as we feel that it is extremely useful both to beamline designers and beamline scientists.
In practice, a PGM is designed with a set of predetermined offsets which optimizes the performance of the PGM for the specific use case, i.e. energy range, or energy resolution. The optimized parameters that must be known prior to manufacturing are highlighted in red in Fig. 1. These parameters therefore define the range of energy and cff over which a given grating can transmit the whole beam for a particular PGM. We have therefore developed PGMweb, a software tool designed to help scientists to select these fixed parameters when designing a PGM. Our program also enables users to rapidly assess what is the lowest (or highest) energy that can be transmitted through a given PGM. Moreover, PGMweb provides an easy method for checking the transmission of an existing PGM with a new grating, which may have a different line density and therefore would operate in a different geometry (θ, α and β) compared with existing gratings.
2. The geometry of a PGM
In this section, we present the analytical expressions of all quantities of interest in a PGM. This includes the intercepts that the beam makes with both the grating and the mirror, as well as coordinates for the corners of both optics which have not been previously derived.
In all subsequent expressions, we define the horizontal as x, with positive x in the direction of ray propagation. The vertical is defined as y. The origin is defined to be at point B in Fig. 1, which is the location of the grating rotation axis. The bulk of the derivation will be performed in the (x y) plane. For simplicity, we present the derivations in two dimensions and introduce the z dimension at the end.
2.1. Intercepts with the mirror and the grating
Using quantities as they are defined in Fig. 1, the x–y coordinate of the intercept of the rays with the mirror is given by the expression
where h, c, b and v are all quantities known prior to the manufacturing of the PGM, and θ can be trivially calculated from the grating equation, equation (3).
Ideally the beam after the mirror would always be centred on the grating surface, so the grating is able to accept the largest beam possible at lower incident grazing angles (90° − α). In practice, the beam intercept (B) is slightly offset from the centre of the grating (O) by some finite distance e along the optical surface, as shown in Fig. 1. Using equation (4), an expression for e can be derived,
2.2. Minimization of e
To ensure that the beam hits the centre of the grating at a range of energies, the values of b, c, v and h must be carefully chosen. This can be done by minimizing the quantity b′ − b, the vertical displacement of the centre of the beam from the centre of the grating, which is equal to
Written in full, from equation (5),
where we have substituted the definition of cff. By satisfying the condition that the beam impinges on the centre of the grating, the left-hand side of the above equation is set to 0. After some rearrangement, this gives an expression for b,
noting = and that we have replaced θ with the grazing angle θg = π/2 − θ.
When θg is small (which is typical to ensure high reflectivities in the soft X-ray range), we can apply = ≃ . Substituting the approximation in equation (8) gives
which would suggest that, in order to keep b′ − b small, the values of the offsets should be chosen such that b ≃ c ≃ 2v and h ≃ 0. This approximation has been applied to almost all PGMs at Diamond Light Source, cf. Table 2.
2.3. Corners of the grating
Equally as important in the visualization of a PGM are the corners of the optics. The analytical expressions can be easily derived using trigonometry. Let the dimensions of the grating optic be defined as Lg, Hg and Wg, the length, height and width, respectively, where the length is the dimension in the tangential direction, the width is the dimension in the sagittal direction and height is the optical thickness. The corners of the grating are defined by the vectors G1, G2, G3 and G4 in the x–y plane; their expressions are
In Fig. 4(a), from the origin (O), the point G1 is in the fourth quadrant, where both the components x and y are negative. The expression for the coordinate is thus
The third dimension z can be introduced trivially. A set of eight vertices of the grating can be found by placing the four points G1, G2, G3 and G4 in z = ±Wg/2, so that the centre of the grating O is situated at the three-dimensional origin.
2.4. Corners of the mirror
In very much the same fashion, the vertices of the mirror can be found, with the added complication that the origin is in the middle of the grating optical surface. The mirror corners are given by the expressions
where the displacements are negative in all components.
The results derived from the expressions presented above were extensively compared with an alternative software tool developed at Diamond in Igor, which was described in a previous publication (Sutter et al., 2023). This older software has been tested extensively during the design of several soft X-ray beamlines at Diamond, and the two software tools give results in complete agreement.
2.5. Beam size from an undulator source
Another area of consideration during PGM operation is the beam size from the source, more specifically, the height of the beam. For an undulator source at modern X-ray facilities, the vertical beam size at the PGM is significantly changing as a function of energy. Here we present the analytical expressions to calculate the beam height from a Gaussian undulator source (Peatman, 1997). The vertical root mean squared (RMS) photon source size (Σ) is given by
where σy is the vertical RMS electron beam size, λ is the wavelength of the beam and L is the length of the undulator. The vertical photon source divergence (Σ′) is given by a similar expression,
where is the vertical electron beam divergence. It necessarily follows then that the final beam height at a plane distance d away is given by
where nσ is the number of standard deviations to include in considering the beam size.
3. Implementation
3.1. Python API
All analytical expressions that have been presented were compiled and coded into callable functions in Python. An object-oriented approach was employed to construct simulated instances of a mirror and a grating to form a PGM. This is distributed in the form of a Python library: pyplanemono. This code is freely available on Github (https://github.com/patrickwang27/pyplanemono) under an MIT licence, as well as on PyPI (https://pypi.org/project/pyplanemono/). The library additionally provides methods to draw PGM diagrams by performing simple ray tracing. The code computes all geometrical quantities of the PGM given a set of parameters defined using the class attributes of the PGM, mirror and grating. Notably, the package can also interface with Matplotlib and Plotly to produce diagrams of the PGM. We have therefore included animations of a PGM performing both an energy scan as well as a cff scan in the supporting information.
3.2. PGMweb
PGMweb (https://pgmweb.diamond.ac.uk) is an extension of the underlying calculation software package. A front-end graphical user interface (GUI) was developed using Shiny for Python (https://shiny.posit.co/py/), a dashboarding library commonly used in data science. This provides a GUI that can run in any modern browser that supports JavaScript. To simplify the user experience and avoid manual installations, we have opted to distribute the software as an online application with Shinylive (https://github.com/posit-dev/shinylive). Shinylive bundles the GUI code with a minimal Python environment in WebAssembly [Pyodide (https://pyodide.org/en/stable/)] to produce files for a static website. The workflow presented in Fig. 5 shows that upon visiting the PGMweb website the server returns a set of files containing everything necessary to run a minimal Python environment within the browser. After the user's local setup is complete (typically within 1 min), all calculations are run by the pyplanemono package within the browser, at which point the server ceases to play any role. The delay experienced by the user would have been considerably less had the calculation been performed on a separate remote Python server. Shiny also includes a feature which makes any code executed completely transparent to the user and can be modified on-the-fly to better suit the user's needs. This can be done by accessing the edit function of Shiny, as shown in Fig. 6.
3.3. Features
The interface allows the user to define all key parameters that dictate the geometry of a PGM, Fig. 7. The energy, cff, the grating line density and the diffraction order are highlighted as four primary controls and occupy a prominent space in the GUI to allow quick and easy reading/changing of their values. Controls for the finer details are included as well; the user can fully specify the geometry of a PGM using the appropriate offsets previously defined. The software also has the ability to compute the offset parameters h, c and v when the user specifies the offset b, using the approximation described in Section 2.2. The software computes the geometry of the PGM and shows a plot of the beam footprints on the optical surfaces, as well as a plot of the side-view diagram of the rays propagating through the PGM. This can be very helpful in quickly determining whether or not the whole beam can be transmitted through a given PGM geometry. We note the assumption that the size of the clear aperture of the optics is equivalent to the actual physical size of the components. The beam dimensions can be specified manually or computed by the programme from user-specified parameters for an undulator source (cf. Section 2.5).
The figures can be downloaded as vector graphic files, and the application also allows the user to export the PGM configuration to a human-readable TOML file which can be saved locally and imported at a later time if required.
4. Conclusion
In this paper, we have derived expressions for various geometrical parameters which allow the geometry of a PGM to be computed in its entirety. The expressions are implemented as class methods in a Python package called pyplanemono, which provides a set of robust application programming interfaces (APIs). The graphical front-end provides a quick and accessible tool for checking the geometry of a PGM given a set of parameters. We highlight that PGMweb does not itself identify if any part of the beam will not be transmitted due to the geometry of the PGM, but presents visualizations which make any blockages apparent to the user (see for example Figs. 2 and 3).
We note that the expressions used in PGMweb assume that the condition 2θ = α − β always holds, as is intended in most real applications. Any misalignment of a beamline that would introduce an angular offset will lead to a more complicated analytical expression for the grating equation than that presented in equation (3), and could also affect the transmission of the PGM for a given energy and cff.
The development of the underlying Python library described here opens up the possibility for interfacing it with ray-tracing software such as SHADOW3 in the future (Sanchez del Rio et al., 2011), where the blockages could be accounted for natively in ray-tracing simulations of soft X-ray beamlines. Such ray-tracing simulations could be scripted to be performed over a wide range of diffraction orders, energies and values of cff, providing a full picture of the parameter space accessible with existing or planned cPGM beamlines. We plan to explore these possibilities in our future work.
Supporting information
Animations of a plane grating monochromator performing a cff scan. DOI: https://doi.org/10.1107/S1600577524011603/tv5072sup1.gif
Animation of a plane grating monochromator performing an energy scan. DOI: https://doi.org/10.1107/S1600577524011603/tv5072sup2.gif
Footnotes
‡Now at the Department of Chemistry, University of Oxford, Oxford, UK.
Acknowledgements
PYW thanks Joshua S. Gibson at the University of Edinburgh for his support and advice throughout PYW's Year in Industry Placement at Diamond Light Source. We are grateful to Lucia Alianelli and John Sutter at Diamond Light Source for stimulating discussions, and we thank Hossein Khosroabadi and Edward Meng at Diamond Light Source for their careful reading of the manuscript and helpful feedback. We would also like to acknowledge Chris Reynolds and Thomas Hartland at Diamond Light Source for their help in deploying PGMweb onto the Diamond website.
References
Aich, P., Meneghini, C. & Tortora, L. (2023). Materials, 16, 7331. CrossRef PubMed Google Scholar
Dhesi, S. S., Cavill, S. A., Potenza, A., Marchetto, H., Mott, R. A., Steadman, P., Peach, A., Shepherd, E. L., Ren, X., Wagner, U. H., Reininger, R., Garrett, R., Gentle, I., Nugent, K. & Wilkins, S. (2010). AIP Conf. Proc. 1234, 311–314. CrossRef CAS Google Scholar
Ebert, H. (1889). Annal. Phys. 274, 489–493. CrossRef Google Scholar
Follath, R. (2001). Nucl. Instrum. Methods Phys. Res. A, 467–468, 418–425. Web of Science CrossRef CAS Google Scholar
Follath, R. & Senf, F. (1997). Nucl. Instrum. Methods Phys. Res. A, 390, 388–394. CrossRef CAS Web of Science Google Scholar
Gilmore, K., Pelliciari, J., Huang, Y., Kas, J. J., Dantz, M., Strocov, V. N., Kasahara, S., Matsuda, Y., Das, T., Shibauchi, T. & Schmitt, T. (2021). Phys. Rev. X, 11, 031013. Google Scholar
Grinter, D. C., Ferrer, P., Venturini, F., van Spronsen, M. A., Large, A. I., Kumar, S., Jaugstetter, M., Iordachescu, A., Watts, A., Schroeder, S. L. M., Kroner, A., Grillo, F., Francis, S. M., Webb, P. B., Hand, M., Walters, A., Hillman, M. & Held, G. (2024). J. Synchrotron Rad. 31, 578–589. CrossRef CAS IUCr Journals Google Scholar
Harkiolaki, M., Darrow, M. C., Spink, M. C., Kosior, E., Dent, K. & Duke, E. (2018). Emerg. Top. Life Sci. 2, 81–92. CAS PubMed Google Scholar
Held, G., Venturini, F., Grinter, D. C., Ferrer, P., Arrigo, R., Deacon, L., Quevedo Garzon, W., Roy, K., Large, A., Stephens, C., Watts, A., Larkin, P., Hand, M., Wang, H., Pratt, L., Mudd, J. J., Richardson, T., Patel, S., Hillman, M. & Scott, S. (2020). J. Synchrotron Rad. 27, 1153–1166. Web of Science CrossRef CAS IUCr Journals Google Scholar
Hoesch, M., Kim, T. K., Dudin, P., Wang, H., Scott, S., Harris, P., Patel, S., Matthews, M., Hawkins, D., Alcock, S. G., Richter, T., Mudd, J. J., Basham, M., Pratt, L., Leicester, P., Longhi, E. C., Tamai, A. & Baumberger, F. (2017). Rev. Sci. Instrum. 88, 013106. Web of Science CrossRef PubMed Google Scholar
Kunz, C., Haensel, R. & Sonntag, B. (1968). J. Opt. Soc. Am. 58, 1415. CrossRef PubMed Google Scholar
Lee, T.-L. & Duncan, D. A. (2018). Synchrotron Radiat. News, 31(4), 16–22. CrossRef Google Scholar
Liu, D., Shadike, Z., Lin, R., Qian, K., Li, H., Li, K., Wang, S., Yu, Q., Liu, M., Ganapathy, S., Qin, X., Yang, Q., Wagemaker, M., Kang, F., Yang, X. & Li, B. (2019). Adv. Mater. 31, 1806620. Web of Science CrossRef Google Scholar
Peatman, W. B. (1997). Gratings, Mirrors and Slits. Boca Raton: CRC Press LLC. Google Scholar
Petersen, H. (1982). Opt. Commun. 40, 402–406. CrossRef Web of Science Google Scholar
Petersen, H., Jung, C., Hellwig, C., Peatman, W. B. & Gudat, W. (1995). Rev. Sci. Instrum. 66, 1–14. CrossRef CAS Web of Science Google Scholar
Pimpale, A. V., Deshpande, S. K. & Bhide, V. G. (1991). Appl. Opt. 30, 1591. CrossRef PubMed Google Scholar
Riemer, F. & Torge, R. (1983). Nucl. Instrum. Methods Phys. Res. 208, 313–314. CrossRef Web of Science Google Scholar
Sanchez del Rio, M., Canestrari, N., Jiang, F. & Cerrina, F. (2011). J. Synchrotron Rad. 18, 708–716. Web of Science CrossRef CAS IUCr Journals Google Scholar
Sutter, J. P. (2021). International Tables for Crystallography, Vol. I, https://doi.org/10.1107/S1574870720007636. Google Scholar
Sutter, J. P., Alianelli, L., Hu, L., Khosroabadi, H., Walters, A., Hand, M., Wang, H. & Sawhney, K. (2023). Synchrotron Radiat. News, 36, 28–32. CrossRef Google Scholar
Thompson, A. C., Kirz, J., Attwood, D. T., Gullikson, E. M., Howells, M. R., Kortright, J. B., Liu, Y. & Robinson, A. L. (2009). Center for X-ray Optics Advanced Light Source: X-ray Data Booklet, 3rd ed. Lawrence Berkeley National Laboratory, Berkeley, CA, USA. Google Scholar
Venezia, A. M. (2003). Catal. Today, 77, 359–370. CrossRef CAS Google Scholar
Wen, S., Huang, Q., Sokolov, A., Zhuang, Y., Lemke, S., Seliger, T., Yu, Y., Viefhaus, J., Qi, R., Zhang, Z. & Wang, Z. (2024). Opt. Laser Technol. 168, 109979. Web of Science CrossRef Google Scholar
Werner, S., Guttmann, P., Siewert, F., Sokolov, A., Mast, M., Huang, Q., Feng, Y., Li, T., Senf, F., Follath, R., Liao, Z., Kutukova, K., Zhang, J., Feng, X., Wang, Z., Zschech, E. & Schneider, G. (2023). Small Methods, 7, 2201382. CrossRef Google Scholar
Zhou, K.-J., Walters, A., Garcia-Fernandez, M., Rice, T., Hand, M., Nag, A., Li, J., Agrestini, S., Garland, P., Wang, H., Alcock, S., Nistea, I., Nutter, B., Rubies, N., Knap, G., Gaughran, M., Yuan, F., Chang, P., Emmins, J. & Howell, G. (2022). J. Synchrotron Rad. 29, 563–580. 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.