research papers\(\def\hfill{\hskip 5em}\def\hfil{\hskip 3em}\def\eqno#1{\hfil {#1}}\)

Journal logoJOURNAL OF
SYNCHROTRON
RADIATION
ISSN: 1600-5775

An automated and robust method for modelling X-ray beamlines with plane grating monochromators

crossmark logo

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

Edited by R. Ingle, University College London, United Kingdom (Received 23 January 2025; accepted 9 April 2025; online 13 May 2025)

The plane grating monochromator (PGM) is an optical instrument used in the majority of soft X-ray beamlines. Despite its ubiquity, the PGM efficiency can easily be overestimated, because the geometry of many modern PGMs can lead to unexpected blocking of the beam. We have developed a new workflow in Python for simulating PGMs, thus extending the capabilities of SHADOW3, a well established ray tracing software tool. We have used our method to simulate the flux on branch C of the Versatile Soft X-ray (VerSoX) beamline B07 at Diamond Light Source. The simulation results demonstrate qualitative agreement with the experimental measurements, confirming the robustness of the proposed methodology.

1. Introduction

A significant proportion of soft X-ray beamlines use a plane grating monochromator (PGM) to provide a monochromatic X-ray beam. PGMs consist of a mirror followed by a plane grating, producing an energy-dispersed X-ray beam with a fixed trajectory (Kunz et al., 1968[Kunz, C., Haensel, R. & Sonntag, B. (1968). J. Opt. Soc. Am. 58, 1415.]; Follath, 2001[Follath, R. (2001). Nucl. Instrum. Methods Phys. Res. A 467-468, 418-425.]; Wang et al., 2025[Wang, P. Y., Bazan da Silva, M., Hand, M., Wang, H., Chang, P., Beilsten-Edmands, V., Kim, T. K., Lee, T.-L., Sawhney, K. & Walters, A. C. (2025). J. Synchrotron Rad. 32, 261-268.]). Such monochromators combine ease of use with substantial flexibility in operation compared with alternative soft X-ray monochromators.

The design of the PGM directly impacts the performance of the beamline. Beamline properties such as the energy resolution and the photon flux are critical to the success of experiments such as X-ray absorption, X-ray emission or X-ray photoemission spectroscopies (XAS, XES, XPS) and are routinely predicted using ray tracing simulations. PGMs work by using the dispersive property of the grating, which is described by the grating equation,

[\displaystyle n\lambda = g\,(\sin\alpha+\sin\beta), \eqno(1)]

where n is the order of diffraction, λ is the wavelength of the outgoing radiation, g is the grating period, and α and β are the angles of incidence and diffraction, respectively. For any given values of n, λ and g there are multiple pairs of (α, β) values that can satisfy equation (1)[link]. One way to specify a unique solution is to define a property of the PGM known as the fixed-focus constant, cff (Petersen, 1982[Petersen, H. (1982). Opt. Commun. 40, 402-406.]),

[\displaystyle c_{\rm{ff}} = \cos\beta/\cos\alpha. \eqno(2)]

We can then use cff and λ (or photon energy) to define unique values of α and β for a grating with a given period g operating in the nth order.

It is possible to simultaneously diffract multiple diffraction orders from a grating, which can lead to higher-order contamination issues. This is a problem frequently encountered in the soft X-ray range (Waki et al., 1989[Waki, I., Hirai, Y., Momose, A. & Hayakawa, K. (1989). Rev. Sci. Instrum. 60, 2072-2075.]; Frommherz et al., 2010[Frommherz, U., Raabe, J., Watts, B., Stefani, R., Ellenberger, U., Garrett, R., Gentle, I., Nugent, K. & Wilkins, S. (2010). AIP Conf. Proc. 1234, 429-432.]; Sokolov et al., 2018[Sokolov, A., Sertsu, M. G., Gaupp, A., Lüttecke, M. & Schäfers, F. (2018). J. Synchrotron Rad. 25, 100-107.]). Such issues are ideally addressed during the design of the beamline, which can then be mitigated by optimizing the grating parameters and/or the PGM mirror coatings.

Currently, there are several challenges surrounding the modelling of PGMs. Most PGMs that allow the user to vary the PGM mirror grazing angle use a mechanical scheme first used in SX-700 PGMs (Riemer & Torge, 1983[Riemer, F. & Torge, R. (1983). Nucl. Instrum. Methods Phys. Res. 208, 313-314.]). While this design is very flexible, its geometry is rather complex and unintuitive (Wang et al., 2025[Wang, P. Y., Bazan da Silva, M., Hand, M., Wang, H., Chang, P., Beilsten-Edmands, V., Kim, T. K., Lee, T.-L., Sawhney, K. & Walters, A. C. (2025). J. Synchrotron Rad. 32, 261-268.]), and as such blocking can occur during operation, making these SX-700 type PGMs inherently difficult to model in ray tracing software. Second, incomplete modelling can mean that issues such as higher-order contamination are not fully appreciated during the design phase, which can lead to challenges in operation. Third, since collimated PGM schemes allow both the energy and cff to be selected independently, there is a large 2D parameter space available that would be rather time-consuming to explore using traditional approaches.

At Diamond Light Source, the ray tracing software of choice is SHADOW3 (Sanchez del Rio et al., 2011[Sanchez del Rio, M., Canestrari, N., Jiang, F. & Cerrina, F. (2011). J. Synchrotron Rad. 18, 708-716.]), which is used by a significant fraction of the synchrotron optics community. Although other software packages are available, such as RAY (Schäfers, 2008[Schäfers, F. (2008). The BESSY Raytrace Program RAY, pp. 9-41. Berlin, Heidelberg: Springer.]) and xrt (Klementiev & Chernikov, 2014[Klementiev, K. & Chernikov, R. (2014). Proc. SPIE, 9209, 92090.]), we have concentrated on the implementation of our methodology in SHADOW3.

By design, SHADOW3 has no a priori knowledge of the global optical setup and, therefore, is restricted by the assumption of sequentiality. Due to this design principle of the underlying codebase, ray tracing is done in the sequence specified by the user. In the operation of a typical SX-700 type PGM, the correct sequence met by the rays is the mirror followed by the grating. In scenarios where the rays are blocked by the upstream corner of the grating before the mirror or by the downstream corner of the mirror after the grating (Wang et al., 2025[Wang, P. Y., Bazan da Silva, M., Hand, M., Wang, H., Chang, P., Beilsten-Edmands, V., Kim, T. K., Lee, T.-L., Sawhney, K. & Walters, A. C. (2025). J. Synchrotron Rad. 32, 261-268.]), the sequence is broken. SHADOW3 is unaware of the blockages and will transmit 100% of the rays. This is problematic when simulations are performed for larger energy ranges; SHADOW3 will report an overestimated intensity in certain configurations of SX-700 type PGMs. Note that for brevity we refer to SX-700 type PGMs as simply PGMs in the remainder of this work.

A different, but nevertheless important, limitation is the location and the size of the beam as it impinges on the mirror and grating. The typical geometry of a PGM means that the location of the beam footprint on the mirror changes as a function of the incident angle θ. As real mirrors have finite length, this means that, if θ is not within a certain range, part (or all) of the beam will not be transmitted by the PGM. Moreover, in certain energy/cff combinations, the footprint made by the beam on the optical surface of the grating may become larger than that of the grating itself, leading to a loss of flux. Compared with self-blockages, these two scenarios are much more easily handled within SHADOW3, as they do not break the assumption of sequentiality described earlier.

In this article, we build on our previous work (Wang et al., 2025[Wang, P. Y., Bazan da Silva, M., Hand, M., Wang, H., Chang, P., Beilsten-Edmands, V., Kim, T. K., Lee, T.-L., Sawhney, K. & Walters, A. C. (2025). J. Synchrotron Rad. 32, 261-268.]), in which analytical expressions of various geometrical quantities of a PGM were derived. With some modifications and extensions presented here, these expressions can be used in SHADOW3 to fully model the nuances of the PGM geometry for transmission calculations and more. We also present a programming pipeline and the corresponding code which could be used to simulate any PGM-based beamline in the future. The solution we propose is fully autonomous in modelling all aspects of the PGM and, as such, can fully automate scans over energy, cff, order of diffraction, etc. This is in direct contrast to how simulations like these are often carried out at present, where manual input is typically needed at multiple stages in the process. The validity of this methodology has been demonstrated via direct comparison of simulation results with flux measurements performed at the B07c beamline (Held et al., 2020[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.]) at Diamond Light Source.

2. Methodology

A typical current workflow for simulating a beamline with a PGM is presented in Fig. 1[link], along with the workflow we propose in this article. In this section, a step-by-step account of the proposed methodology will be given.

[Figure 1]
Figure 1
The current standard workflow for carrying out PGM transmitted flux simulations as well as the proposed workflow for an integrated model.

2.1. Computation of the source flux

At present, it is not possible to use SHADOW3 to perform flux simulations for bending magnet sources. After ray tracing, the value returned by SHADOW3 is the intensity, which is the Pythagorean sum of the magnitudes of the electric and magnetic fields of all of the rays that have been simulated. This intensity can then be scaled to flux in units of photons per second by using externally computed data. We have used SPECTRA (Tanaka, 2021[Tanaka, T. (2021). J. Synchrotron Rad. 28, 1267-1272.]) to calculate the bending magnet source flux for the simulations for B07c. Fluxes are obtained by scaling the ray traced intensity to the flux computed by SPECTRA while correcting for the energy bandwidth.

2.2. Computation of mirror and grating efficiencies

After propagation – either via reflection or diffraction – from each optical element (OE), some rays may be lost and the overall intensity will therefore be reduced. For mirrors, reflectivities depend on the electronic properties of the mirror coating as well as the roughness of the mirror surface. These can be computed natively in SHADOW3 using the preprocessors PREREFL (Lai & Cerrina, 1986[Lai, B. & Cerrina, F. (1986). Nucl. Instrum. Methods Phys. Res. A 246, 337-341.]) and WAVINESS (Sanchez del Rio & Marcelli, 1992[Sanchez del Río, M. & Marcelli, A. (1992). Nucl. Instrum. Methods Phys. Res. A 319, 170-177.]), respectively.

Currently, it is not possible to perform grating efficiency calculations in SHADOW3. In the calculations performed for B07c, the grating efficiencies of the 400 and 600 lines mm−1 gratings have been computed using MLgrating (Walters et al., 2024[Walters, A., Wen, S., Huang, Q., Wang, Z., Wang, H. & Sawhney, K. (2024). J. Synchrotron Rad. 31, 1043-1049.]). The grating efficiency is a function of energy, order and cff; it is therefore required that the grating efficiency for each combination of energy and cff be computed separately. The geometrical properties of the gratings, as measured by the manufacturers, are presented in the supporting information. The grating efficiencies at different values of energy and cff were tabulated into JSON files, which can be stored and read easily. The grating efficiencies were calculated for more than 60000 combinations of energy, order and cff for each grating. These calculations took approximately 6 h per grating on a laptop with a six-core Intel Core i7-10810U @ 1.10 GHz.

2.3. Optimizing the simulated energy range

To minimize the number of lost rays in the ray tracing simulation, the energy range over which the X-ray source is simulated needs to be optimized. A typical rule-of-thumb is that the energy range of the source should be at least double the energy resolution [full width at half-maximum (FWHM)] achieved by the PGM combined with the exit slit. In this way, one ensures that the energy range of the source is not significantly limiting the simulated energy resolution of the beamline, while ensuring that one does not waste computing resources on many rays that will not be transmitted through the exit slit.

Here we present an automated approach to find an appropriate energy range for the source for any beamline configuration (E, cff, n and exit slit opening). An optimal energy range can be found by a simple while-loop. Starting with an initial energy range for the source, ray tracing with a reduced number of rays is carried out. The energy FWHM of the final beam is doubled and used as the energy range for the next iteration. We then iterate until the energy resolution converges to within a certain predefined tolerance relative to the previous iteration. This method is sufficiently flexible and fast that it can be done on-the-fly during real simulation runs. A scatter plot of an iteration process is included in the supporting information.

2.4. Geometry of the PGM and input to SHADOW3

To be able to correct for geometrical blockages of the PGM and accurately simulate it in SHADOW3, it is important to correctly inform SHADOW3 of the coordinates of the optical elements (OEs) that define the PGM (a plane mirror and a plane grating) within the reference frames of SHADOW3.

There are two primary areas of concern: (1) when the incident angle becomes too small or the beam height becomes too large, the entire beam footprint will not fit the optical surface of the mirror or grating, leading to a loss of flux, and (2) where there are geometrical blockages, caused by the mirror or the grating, the beam will be partially or completely blocked.

In SHADOW3 the distances and angles of the OEs are defined relative to the OEs that precede them, and the first OE is defined relative to the source. One can define the size of the optical surface directly in SHADOW3. In the context of a PGM, this information would simply be the sizes of the optical surfaces of the mirror and grating, which are known. This input can be easily done by setting the attributes for the appropriate OE. Throughout the following, we have inputted the real physical sizes of the optics into SHADOW3 and have not attempted to make any distinction between these dimensions and the dimensions of their clear apertures.

2.5. SHADOW3 OE offsets

The position of any OE in SHADOW3 is defined relative to the centre of the beam. In a typical PGM, the centre of the beam is placed as close to the centre of the grating as possible by design, but the centre of the beam on the mirror changes position as a function of grazing angle. By defining the correct size of the mirror OE in SHADOW3, along with the correct mirror offset relative to the beam, scenarios where the beam falls off the mirror can be accounted for in SHADOW3. This offset is set through the OFFY attribute of the mirror. Using the parameters presented in Fig. 2[link](c) (Wang et al., 2025[Wang, P. Y., Bazan da Silva, M., Hand, M., Wang, H., Chang, P., Beilsten-Edmands, V., Kim, T. K., Lee, T.-L., Sawhney, K. & Walters, A. C. (2025). J. Synchrotron Rad. 32, 261-268.]), it can be shown that the OFFY parameter is given by

[\eqalignno{ {\tt{mirror.OFFY}} & = {{L_{\rm{m}}}\over{2}}-s & (3) \cr & = {{L_{\rm{m}}}\over{2}}+a-{{b+v-c\sin\theta}\over{\cos\theta}}, & (4) }]

where Lm is the length of the mirror. The parameters a, b, c and v are known offsets of the PGM, and θ = (αβ)/2.

[Figure 2]
Figure 2
(a) Illustration of the slit positioning in SHADOW3 for blocking by the grating. (b) Illustration of the positioning of the second fictitious slit to model beam blockage by the mirror. (c) A schematic of the PGM geometry which contains geometrical quantities used in the derivation [reproduced from Wang et al. (2025[Wang, P. Y., Bazan da Silva, M., Hand, M., Wang, H., Chang, P., Beilsten-Edmands, V., Kim, T. K., Lee, T.-L., Sawhney, K. & Walters, A. C. (2025). J. Synchrotron Rad. 32, 261-268.])].

Similarly, for the grating, the required offset grating.OFFY can be shown to be

[\displaystyle{\tt{grating.OFFY}} = {{h\sin2\theta+v\,(\cos2\theta-1)+2c\sin\theta-b}\over{\cos\alpha}}, \eqno(5)]

where all quantities are known. The correct input of these offsets, along with the correct dimensions of the optics, allows SHADOW3 to handle cases where the beam footprint is partially off the mirror or the grating.

However, enabling SHADOW3 to handle blockages is not trivial. Formally, OEs in SHADOW3 are treated as infinitely thin planes with finite sizes. Without modifying the underlying codebase of SHADOW3, we have implemented the following workaround. Two additional fictitious slits are included in the simulated PGM, where one of the defining blades of the first slit is placed at the upstream corner of the grating, while one of the defining blades of the second slit is placed at the downstream corner of the mirror. To correctly define these two points, the distances from these fictitious slits to the next optical element (T_IMAGE) also need to be known. This quantity is essential in correctly accounting for the beam size when a non-collimated beam passes through the PGM. In practice, the two parameters that need to be specified for the slits are the vertical offset from the centre of the slit with respect to the centre of the beam and the horizontal distance from the slit to the next OE.

2.6. Blockage by the grating

A slit is defined in SHADOW3 with a height and location of the centre of the opening relative to the centre of the beam. To account for blockage by the grating, a slit is introduced in the optical setup as shown in Fig. 2[link], where we have defined the point G to be the bottom left corner of the grating. Programmatically, the slit height is an arbitrary choice, as long as it is set larger than the height of any possible synchrotron beam. Here we chose a value of 1000 mm. As illustrated, the slit should be translated down so that the bottom of the upper obstruction is placed at G. The quantity of interest is therefore the vertical distance from the centre of the beam to G, which is denoted as Δslit1. Defining the origin to be at the centre of the grating optical surface, G can be expressed as

[\displaystyle G_{x} = {{l} \over {2}}\sin\beta, \eqno(6)]

[\displaystyle G_{z} = -{{l} \over {2}}\cos\beta, \eqno(7)]

where l is the length of the grating. An expression for Δslit1 can then be derived,

[\displaystyle\Delta_{\rm{slit1}} = A_{z}-G_{z} = v-c\sin\theta-(s+a)\cos\theta+{{l}\over{2}}\cos\beta, \eqno(8)]

where Az and Gz are the z components of the points A and G, respectively. The (T_IMAGE) parameter is then the horizontal distance from G to A,

[\eqalignno{ {\tt{slit.T\_IMAGE}} & = A_{x}-G_{x} \cr& = h+c\cos\theta-(s+a)\sin\theta-{{l}\over{2}}\sin\beta. & (9) }]

2.7. Blockage by the mirror

Similarly, for the blockage by the mirror, the location of the downstream mirror corner (D) must be known. This position needs to be defined relative to the centre of the beam B; if we once again define the origin to be at the centre of the optical surface of the grating, the x and z components of B can be extracted,

[\displaystyle B_{x} = {\tt{grating.OFFY}}\,\cos\beta, \eqno(10)]

[\displaystyle B_{z} = {\tt{grating.OFFY}}\sin\beta. \eqno(11)]

The required offsets are then the horizontal and vertical distances from the two points,

[\eqalignno{ \Delta_{\rm{slit2}} & = B_{x}-D_{x} \cr& = {\tt{grating.OFFY}}\,\cos\beta \cr& \quad- \left[-{{c}\over{\sin\theta}}+(a-c\cot\theta)\cos\theta+v\right], & (12) }]

[\eqalignno{ {\tt{grating.T\_IMAGE}} & = B_{z}-D_{z} \cr& = {\tt{grating.OFFY}}\,\sin\beta \cr& \quad-\big\{h-\big[(a-c\cot\theta)\sin\theta\big]\big\}. & (13) }]

We note that (T_IMAGE) for the second slit is not a property of the slit but a property of the grating OE, as in SHADOW3 the OEs are defined relative to the previous OE via the attribute (T_IMAGE). Alternatively, we could have defined this distance relative to the second slit with the attribute (T_SOURCE). Thus, the ray trace sequence for the PGM is as follows:

(i) Slit 1, to handle blockage by the upstream edge of the grating. Defined by Δslit1 and mirror.T_SOURCE (distance to the mirror, equivalently, slit1.T_IMAGE).

(ii) Mirror, to deflect the rays to meet the grating. Defined by mirror.OFFY and mirror.T_IMAGE (distance to the grating).

(iii) Grating, to disperse the rays. Defined by grating.OFFY and (grating.T_IMAGE) (distance to slit 2).

(iv) Slit 2, to handle the blockage by the downstream corner of the mirror. Defined by Δslit2.

All parameters needed to fully model a PGM using SHADOW3 are therefore known:

(i) Sizes of the OEs (native to SHADOW3).

(ii) Angles α and β [native to SHADOW3, but calculated using pyplanemono (Wang et al., 2025[Wang, P. Y., Bazan da Silva, M., Hand, M., Wang, H., Chang, P., Beilsten-Edmands, V., Kim, T. K., Lee, T.-L., Sawhney, K. & Walters, A. C. (2025). J. Synchrotron Rad. 32, 261-268.])].

(iii) Mirror reflectivities [native to SHADOW3 (Lai & Cerrina, 1986[Lai, B. & Cerrina, F. (1986). Nucl. Instrum. Methods Phys. Res. A 246, 337-341.])].

(iv) Grating efficiencies [calculated using MLgrating (Walters et al., 2024[Walters, A., Wen, S., Huang, Q., Wang, Z., Wang, H. & Sawhney, K. (2024). J. Synchrotron Rad. 31, 1043-1049.])].

(v) Mirror and grating translations relative to the beam (this work).

(vi) Positions of the two fictitious slits (this work).

A model of the B07c beamline at Diamond Light Source (Held et al., 2020[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.]) was constructed in ShadowOui (Rebuffi & Sanchez del Rio, 2016[Rebuffi, L. & Sánchez del Río, M. (2016). J. Synchrotron Rad. 23, 1357-1367.]) and, using the Info post-processor, a Python script was generated. The pyplanemono Python library (Wang et al., 2025[Wang, P. Y., Bazan da Silva, M., Hand, M., Wang, H., Chang, P., Beilsten-Edmands, V., Kim, T. K., Lee, T.-L., Sawhney, K. & Walters, A. C. (2025). J. Synchrotron Rad. 32, 261-268.]) was extended with an interface to the SHADOW3 Python API. This configures all the OEs appropriately with the correct angles and offsets within the simulation. Scans of energy, cff and diffraction order were performed simultaneously using the Python internal multiprocessing library. By running 25 processes concurrently, the complete simulation using precomputed grating efficiencies took about 12 h to run on a machine with a 48-core Intel Xeon CPU E5-2650 v4 @ 2.20 GHz.

3. Results

To understand the extent of higher-order contamination on the B07c beamline, the flux for diffraction orders one through four were simulated for an existing 400 lines mm−1 Au-coated laminar grating (Held et al., 2020[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.]). The energy ranges for the different orders were scaled by the order; energies ranged from 300 eV to 3000 eV for the first order (covering most of the core beamline range), up to 6000 eV for the second order, 9000 eV for the third and 12000 eV for the fourth. Simulations were performed at these energies over a range of cff values between 1.05 and 3.0.

It is common for PGMs to have several mirror coatings and several gratings that can be exchanged during operation. The PGM at B07c has several possible mirror and grating combinations. For the sake of conciseness, here we only present results for the 400 lines mm−1 laminar grating and Pt mirror combination; however, the 600 lines mm−1 blazed grating and Pt mirror combination were also fully modelled, and the results are included in the supporting information. We note that all the non-PGM mirrors on the B07c beamline have Rh coatings. The maximum energy of B07c is defined by the fixed grazing angle (1.1°) of the first mirror M1c, which is located before the PGM.

Fig. 3[link] plots the simulated flux at the sample at cff = 1.4 and 2.0, which are two values routinely used on the beamline. Note that the x-axis plots the first order energy. Due to the nature of diffraction from a grating, a PGM in a certain geometry will also transmit integer multiples of the first order energy for higher orders. As such, in order to understand the total flux transmitted at a given first order energy setting, we must scale the energy axes of the higher order flux curves by the reciprocal of their respective orders; the scaled energies are referred to as first order energy in subsequent discussions and figures.

[Figure 3]
Figure 3
Flux simulations carried out for orders 1–4 at (a) cff = 1.4 and (c) cff = 2.0. Both are for the B07c Pt mirror and 400 lines mm−1 grating combination. Note that the x-axis plots first order energy, i.e. real photon energy divided by order. Panels (b) and (d) show the same data but on a linear y-scale.

Comparison of our simulation with measured flux also requires the introduction of a detector flux. The measured signal of photodiodes, which are typically used to measure photon flux at X-ray beamlines, is proportional to the product of flux and photon energy, i.e.

[\displaystyle{\rm{Detector\ flux}} = \sum\limits_{i\,\in\,{\{\rm{orders}}\}} \!\!\!\!\! i\times F_{i}\,\left(E_{\rm{1st\,order}}\right), \eqno(14)]

where [F_{i}\,(E_{\rm{1st\,order}})] is the flux of the ith order at first order energy. The detector flux gives a useful metric, as it much more closely resembles what the beamline can measure. This quantity is plotted in Fig. 3[link] with dashed lines.

Figs. 3[link](a) and 3(b) show that the lower value cff of 1.4 contains little higher-order contamination without overly sacrificing first order flux below 1000 eV. The equivalent plots are presented for cff = 2.0 in Figs. 3[link](c) and 3(d). The detector flux is significantly higher, almost double that at cff = 1.4, but the contribution from higher orders accounts for at least 50% of the detector flux below 900 eV and up to 80% of the detector flux at the very lowest energies. We note that, without the results of our integrated modelling, it would be very difficult to methodically choose an optimal cff value because most of the methods of flux measurements are not energy-resolved.

Furthermore, in Fig. 3[link], it is observed that with increasing order the flux decreases. Although the spectrum of the bending magnet produces higher flux at higher energy (up to 4000 eV for B07c), the grating efficiency rapidly reduces with increasing diffraction order. This means that, despite the advantage higher orders have from the bending magnet source, they are suppressed by the grating significantly. However, second order flux still contributes appreciably to the total flux at the higher cff of 2.0 [see both Figs. 3[link](c) and 3[link](d)].

The extent of the higher order transmission can be visualized in the 2D parameter space of energy and cff. In Fig. 4[link] we have followed the presentation style used in a previous study (Sokolov et al., 2016[Sokolov, A., Bischoff, P., Eggenstein, F., Erko, A., Gaupp, A., Künstner, S., Mast, M., Schmidt, J., Senf, F., Siewert, F., Zeschke, Th. & Schäfers, F. (2016). Rev. Sci. Instrum. 87, 052005.]), where the ratios of the transmitted fluxes of orders two, three and four relative to the first order flux are plotted as a function of energy and cff. From Fig. 4[link], one observes that the second order contributes significantly more than the third and fourth orders. Up to a first order energy of ∼1500 eV (corresponding to the Rh L-edge in second order), suppression of the second order is especially poor, with contamination above 25%. This is problematic, as this is in the core energy range of the beamline. The beamline has found empirically that operating at a cff of 1.4 reduces the higher-order contamination by a substantial amount. Our simulations validate that decision, as Fig. 4[link](a) shows that a cff value of 1.4 resides just at the lower edge of the region of high first order flux [Fig. 4[link](a)] while minimizing the second order flux [Fig. 4[link](b)].

[Figure 4]
Figure 4
Results presented as four heat maps of (a) first order flux as a function of cff and energy; and second (b), third (c) and fourth (d) order flux relative to the first order flux as a function of cff and first order energy. Note the logarithmically scaled colour bars.

Fig. 4[link] also shows a general trend of increased contamination with increasing cff. To compare the performance between different values of cff, we use an established definition of spectral purity (Sokolov et al., 2016[Sokolov, A., Bischoff, P., Eggenstein, F., Erko, A., Gaupp, A., Künstner, S., Mast, M., Schmidt, J., Senf, F., Siewert, F., Zeschke, Th. & Schäfers, F. (2016). Rev. Sci. Instrum. 87, 052005.]),

[\displaystyle{\rm{Spectral\ purity}} = {{{\rm{First\ order\ flux}} }\over{ {\rm{Total\ flux}} }} \times 100\%. \eqno(15)]

The contribution of first order flux should therefore ideally be as close to 100% of the total flux. A selection of spectral purities at different values of cff is plotted in Fig. 5[link]. The minimum in the spectral purity observed at all values of cff at ∼320 eV is due to the first order flux being suppressed by the Rh M5 edge. The deterioration of the spectral purity from cff = 1.1 to cff = 1.8 at lower energies is much more rapid compared with higher values of cff, where the spectral purity slowly plateaus at around 60% up to 1100 eV. The stagnation of the decrease in spectral purity can be explained by the fact that the angles are changing much more drastically as a function of cff at lower values of cff, significantly changing the reflectivity of the PGM mirror.

[Figure 5]
Figure 5
Spectral purities of the beam after the final OE as a function of energy. The grey dotted lines at 1100 and 1500 eV in first order energy correspond to absorption edges in the second order at 2200 eV and 3000 eV.

Drastic improvements in spectral purity are observed independently of cff above 1100 eV and again above 1500 eV. The first improvement can be accounted for by the M5 edges of Pt and Au at around 2200 eV (1100 eV in first order energy) due to the mirror and grating coatings, respectively, greatly suppressing the transmission of second order flux. Similarly, one observes an improvement at 1500 eV first order energy with Rh L3 absorption. The mirrors and grating are acting as de facto low pass filters, transmitting lower energies while suppressing higher energies. The low pass filter property of mirror reflectivities has been previously exploited to build higher order suppressors (Sokolov et al., 2018[Sokolov, A., Sertsu, M. G., Gaupp, A., Lüttecke, M. & Schäfers, F. (2018). J. Synchrotron Rad. 25, 100-107.]; Frommherz et al., 2010[Frommherz, U., Raabe, J., Watts, B., Stefani, R., Ellenberger, U., Garrett, R., Gentle, I., Nugent, K. & Wilkins, S. (2010). AIP Conf. Proc. 1234, 429-432.]). Figs. 3[link](c) and 3[link](d) show that most of the contamination at cff = 2.0 comes from the second order when the first order energy is between 500 and 1000 eV. There is a smaller contribution from the third order when the first order energy is between 300 and 600 eV.

Held et al. (2020[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.]) report the detector flux for B07c at the sample position at a cff of 2. The simulated detector flux, the simulated first order flux and the measurements reported by Held et al. (2020[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.]) are presented in Fig. 6[link](a). Fig. 6[link](b) plots the ratio of the simulated flux at the sample position to the measured flux. We note that for this particular case our modelling of the PGM geometry (described in Section 2.5[link]) indicates that only part of the beam is reflected from the PGM mirror above 1900 eV, highlighting the importance of accurately representing the PGM in our model.

[Figure 6]
Figure 6
(a) Simulated detector flux (red) and the first order component (dashed purple) compared with the measured flux at a cff value of 2 (Held et al., 2020[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.]). (b) Ratio of the simulated detector flux to the measured flux in (a).

In Fig. 6[link](a), the simulated detector flux very closely resembles that of the measurement. The drops in the measured flux around 920 eV and 1840 eV are artefacts of the silicon photodiode used to measure the flux and are due to the Si K-edge viewed in second and first order, respectively. Compared with the first order flux shown in Fig. 6[link](a) (dashed purple line), the measured flux has discernible features that negate the possibility of a pure first order transmittance.

However, the absolute flux in units of photons per second is different between calculation and measurement. While the measured flux peaks at 2 × 1011 photons s−1, the simulation peaks at around 6 × 1011. We believe that the most prominent factor in this difference is related to bake-out induced distortions in the horizontally deflecting first mirror M1 which have been partially corrected by modifying the temperature of the cooling water (Hand et al., 2019[Hand, M., Wang, H., Harkiolaki, M., Venturini, F., Arrigo, R., Ferrer-Escorihuela, P., Alcock, S., Nistea, I., Marshall, A., Scott, S., Duke, L., Held, G. & Sawhney, K. (2019). AIP Conf. Proc. 2054, 060044.]). The remaining aberrations in the beam are likely to result in a large, non-Gaussian horizontal beam profile at the exit slit. As the horizontal opening of the exit slit was set at 0.8 mm (Held et al., 2020[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.]), a significant part of the beam may not have been transmitted through the exit slit. Note that the simulations presented here have assumed that the M1 slope errors are those achieved by the supplier when the mirror was originally manufactured. It is also not particularly surprising that there are larger differences around the Pt and Au absorption edges (above 2100 eV), as here subtle differences in the surface chemistry can make a big impact on the X-ray reflectivity.

Experimentally, higher order contamination can be detrimental to the quality of the data. Indeed, the beamline now operates almost exclusively at a cff of 1.4 in the energy range below 1200 eV (cf. Fig. 3[link]). Using the detailed results from the integrated model presented here, an optimized mode of operation can be proposed.

There are two factors for consideration, one of first order flux and the other of higher-order transmission. As the first order flux is the one desired by the user, it stands to reason that it should be maximized. The first order flux is plotted in Fig. 7[link](a) as a function of cff and energy. In Fig. 7[link](b), the same information is shown, but each point was normalized to the maximum flux at the same energy. This allows for the visualization of flux information in the region where the flux is generally low, above the Pt and Au edges. Brighter areas (closer to the value of 1.0) represent energy–cff combinations where first order flux dominates, darker regions the opposite. Generally, from Fig. 7[link](b), the optimal cff oscillates about a value of ∼2.0. One may therefore be tempted (without knowledge of the extent of higher-order transmission) to operate around that cff.

[Figure 7]
Figure 7
(a) First order flux as a function of energy and cff. (b) First order flux normalized to per energy. (c) The FoM function. (d) Data after being normalized at each energy, in the same way as in (b). Note the discontinuity at 1100 eV due to the second order Pt and Au M-edge absorption; the same absorption occurs at ∼2200 eV for the first order. The semi-transparent line in (d) shows a fit through the maxima to offer an accessible `rule-of-thumb'.

One way to attempt to simultaneously maximize first order flux and maximize higher order suppression is to introduce a figure of merit (FoM) function which combines the two properties. In the design of a higher order suppressor at BESSY-II (Sokolov et al., 2018[Sokolov, A., Sertsu, M. G., Gaupp, A., Lüttecke, M. & Schäfers, F. (2018). J. Synchrotron Rad. 25, 100-107.]; Sokolov et al., 2016[Sokolov, A., Bischoff, P., Eggenstein, F., Erko, A., Gaupp, A., Künstner, S., Mast, M., Schmidt, J., Senf, F., Siewert, F., Zeschke, Th. & Schäfers, F. (2016). Rev. Sci. Instrum. 87, 052005.]), the following FoM function was proposed,

[\displaystyle {\rm{FoM}} = \log_{10}\big(S_{2}\big)\times F_{1}, \eqno(16)]

[\displaystyle S_{2} = {{F_{1}}\over{F_{2}}}, \eqno(17)]

where F1 and F2 are the first and second order fluxes, respectively, and S2 is the suppression of second order. This is a purely empirical equation that attempts to balance the preference between first order flux and higher-order suppression. The choice was made by Sokolov et al. to omit orders higher than two, as the grating efficiency decays significantly leading to low transmission and reflectivity, which is in agreement with what we have observed in this work. The FoM presented above has been calculated using our simulation results and is presented in Figs. 7[link](c) and 7[link](d).

In Fig. 7[link](c) the FoM is plotted as written in equation (16)[link], and in Fig. 7[link](d) the per-energy-normalized equivalent of c is shown. Up to around 1500 eV, where first order flux is relatively high [Fig. 7[link](a)], the transmission of second order is also high and therefore reduces the FoM [Fig. 7[link](c)]. In Fig. 7[link](d) a fit is provided with the primary intention of providing a quick, on-the-fly functional form that can be used to estimate the best combination of energy and cff up to 2250 eV. A simple linear function was used, with a best fit slope of 4.92 × 10−4 eV−1 and an intercept of 1.08. It should be noted that the FoM does not consider the energy resolution, which generally decreases with decreasing cff. At lower energies (<1000 eV), the energy resolution provided by the B07c PGM is still relatively high, so operating at low values of cff down to around 1.4 can still provide a sufficiently high energy resolution. However, depending on the user requirements for a given experiment, in some cases it may be beneficial to deviate from the linear fit and increase the cff somewhat to improve the energy resolution.

4. Conclusion and outlook

In this article, we have presented a set of analytical expressions and corresponding Python code which extend the capabilities of SHADOW3 in accurately modelling PGM beamlines. This work provides a collection of tools which optimize the workflow for future simulations of soft X-ray beamlines. The code and documentation are publicly available at https://github.com/MBZN/pyplanemono/.

The newly proposed pipeline was used to carry out a systematic simulation of the B07c beamline at Diamond Light Source. The results presented here are highly convincing in replicating larger structures of the measured energy spectrum of the beamline. Looking at the data holistically, a set of recommendations was made using a figure of merit function described in the literature (Sokolov et al., 2018[Sokolov, A., Sertsu, M. G., Gaupp, A., Lüttecke, M. & Schäfers, F. (2018). J. Synchrotron Rad. 25, 100-107.]). A linear fitting of the maxima of the figure of merit provides a trajectory in energy–cff parameter space that one should follow to maximize first order flux while minimizing higher order transmission.

The modelling presented in this work primarily concentrated on the issue of higher harmonic contamination. However, the established methodology can be applied to simulate other beamline properties of interest, such as the energy resolution. In the simulations presented here, the exit slits of the PGM were fixed to be 100 µm in all cases. In reality, the exit slit opening is adjusted in operation to modify the energy resolution and the flux simultaneously. The software tools described in this work straightforwardly allow comprehensive simulations to be performed as a function of exit slit opening. More broadly, our work allows for extensive automated simulations to be performed which could potentially help to optimize grating designs. The established workflow reduces the amount of human input needed to a minimum, making iterative simulations across energies, cff values, grating line densities etc. both time-efficient and also more robust.

5. Related literature

The following references, not cited in the main body of the paper, have been cited in the supporting information: Haynes & Lide (2015[Haynes, W. M. & Lide, D. R. (2015). Editors. CRC Handbook of Chemistry and Physics: A Ready-Reference Book of Chemical and Physical Data. Boca Raton: CRC Press.]); Henke et al. (1993[Henke, B. L., Gullikson, E. M. & Davis, J. C. (1993). At. Data Nucl. Data Tables 54, 181342.]); Peatman (1997[Peatman, W. B. (1997). Gratings, Mirrors and Slits: Beamline Design for Soft X-ray Synchrotron Radiation Sources. Boca Raton: CRC Press.]).

Supporting information


Footnotes

Now at Department of Chemistry, University of Oxford, Oxford, UK.

Acknowledgements

PYW thanks Joshua S. Gibson, Eleanor Campbell and Caroline Kirk of the University of Edinburgh for their support and feedback during his placement at Diamond Light Source. The authors thank Matthew Hand (now at MDA UK) for stimulating discussions in the early stages of this project during his time at Diamond and Hossein Khosroabadi for his careful reading of the manuscript. We are also very grateful to Manuel Sanchez del Rio for useful discussions.

References

First citationFollath, R. (2001). Nucl. Instrum. Methods Phys. Res. A 467–468, 418–425.  CrossRef CAS Google Scholar
First citationFrommherz, U., Raabe, J., Watts, B., Stefani, R., Ellenberger, U., Garrett, R., Gentle, I., Nugent, K. & Wilkins, S. (2010). AIP Conf. Proc. 1234, 429–432.  CrossRef Google Scholar
First citationHand, M., Wang, H., Harkiolaki, M., Venturini, F., Arrigo, R., Ferrer-Escorihuela, P., Alcock, S., Nistea, I., Marshall, A., Scott, S., Duke, L., Held, G. & Sawhney, K. (2019). AIP Conf. Proc. 2054, 060044.  Google Scholar
First citationHaynes, W. M. & Lide, D. R. (2015). Editors. CRC Handbook of Chemistry and Physics: A Ready-Reference Book of Chemical and Physical Data. Boca Raton: CRC Press.  Google Scholar
First citationHeld, 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
First citationHenke, B. L., Gullikson, E. M. & Davis, J. C. (1993). At. Data Nucl. Data Tables 54, 181342.  CrossRef Google Scholar
First citationKlementiev, K. & Chernikov, R. (2014). Proc. SPIE, 9209, 92090.  Google Scholar
First citationKunz, C., Haensel, R. & Sonntag, B. (1968). J. Opt. Soc. Am. 58, 1415.  CrossRef PubMed Web of Science Google Scholar
First citationLai, B. & Cerrina, F. (1986). Nucl. Instrum. Methods Phys. Res. A 246, 337–341.  CrossRef Google Scholar
First citationPeatman, W. B. (1997). Gratings, Mirrors and Slits: Beamline Design for Soft X-ray Synchrotron Radiation Sources. Boca Raton: CRC Press.  Google Scholar
First citationPetersen, H. (1982). Opt. Commun. 40, 402–406.  CrossRef Web of Science Google Scholar
First citationRebuffi, L. & Sánchez del Río, M. (2016). J. Synchrotron Rad. 23, 1357–1367.  Web of Science CrossRef IUCr Journals Google Scholar
First citationRiemer, F. & Torge, R. (1983). Nucl. Instrum. Methods Phys. Res. 208, 313–314.  CrossRef Web of Science Google Scholar
First citationSanchez 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
First citationSanchez del Río, M. & Marcelli, A. (1992). Nucl. Instrum. Methods Phys. Res. A 319, 170–177.  Google Scholar
First citationSchäfers, F. (2008). The BESSY Raytrace Program RAY, pp. 9–41. Berlin, Heidelberg: Springer.  Google Scholar
First citationSokolov, A., Bischoff, P., Eggenstein, F., Erko, A., Gaupp, A., Künstner, S., Mast, M., Schmidt, J., Senf, F., Siewert, F., Zeschke, Th. & Schäfers, F. (2016). Rev. Sci. Instrum. 87, 052005.  CrossRef PubMed Google Scholar
First citationSokolov, A., Sertsu, M. G., Gaupp, A., Lüttecke, M. & Schäfers, F. (2018). J. Synchrotron Rad. 25, 100–107.  Web of Science CrossRef CAS IUCr Journals Google Scholar
First citationTanaka, T. (2021). J. Synchrotron Rad. 28, 1267–1272.  Web of Science CrossRef IUCr Journals Google Scholar
First citationWaki, I., Hirai, Y., Momose, A. & Hayakawa, K. (1989). Rev. Sci. Instrum. 60, 2072–2075.  CrossRef CAS Web of Science Google Scholar
First citationWalters, A., Wen, S., Huang, Q., Wang, Z., Wang, H. & Sawhney, K. (2024). J. Synchrotron Rad. 31, 1043–1049.  CrossRef CAS IUCr Journals Google Scholar
First citationWang, P. Y., Bazan da Silva, M., Hand, M., Wang, H., Chang, P., Beilsten-Edmands, V., Kim, T. K., Lee, T.-L., Sawhney, K. & Walters, A. C. (2025). J. Synchrotron Rad. 32, 261–268.  CrossRef 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
SYNCHROTRON
RADIATION
ISSN: 1600-5775
Follow J. Synchrotron Rad.
Sign up for e-alerts
Follow J. Synchrotron Rad. on Twitter
Follow us on facebook
Sign up for RSS feeds