Numerical optimization of spherical variable-line-spacing grating X-ray spectrometers

Operation of an X-ray spectrometer based on a spherical variable-line-spacing grating is analyzed using dedicated ray-tracing software allowing fast optimization of the grating parameters and spectrometer geometry.


Introduction
RIXS (resonant inelastic X-ray scattering) is a synchrotronradiation-based photon-in/photon-out spectroscopic technique, which gives information about charge-neutral lowenergy excitations of the correlated electron system in solids, liquids and gases over the charge, orbital, spin and vibrational degrees of freedom (Kotani & Shin, 2001). The availability of high-brilliance synchrotron radiation sources and recent progress in RIXS instrumentation (Ghiringhelli et al., 2006) allowing a resolving power E/ÁE of better than 10000 has extended RIXS experiments from the energy scale of charge transfer, crystal field and orbital excitations to that of magnetic and vibrational excitations (see, for example, Schlappa et al., 2009;Braicovich et al., 2010;Hennies et al., 2010).
Scientific progress in the field of RIXS is closely connected with progress in instrumentation. It pursues two main goals: improvement of the energy resolution towards progressively smaller energy scale of various charge-neutral excitations and, in view of low quantum yield of the RIXS process, improvement of the detection efficiency. In a variety of the optical schemes of RIXS spectrometers the most popular are those based on a spherical grating ( Fig. 1) as single optical element combining the dispersion and focusing actions. Although these instruments suffer from relatively small angular acceptance, their advantage is to deliver high-energy resolution at downright simplicity. The first and still most widely spread highresolution instrument of this type (Nordgren et al., 1989) uses a constant-line-spacing spherical grating. In order to cancel the coma aberrations it operates in the Rowland circle geometry. This geometry is characterized by grazing inclination of the focal curve (FC) which results in the necessity of large detector displacements with energy and, most important, small grazing angles of incidence on the detector incompatible with the modern directly illuminated CCD detectors. These disadvantages can be resolved with spherical variable-linespacing (VLS) gratings (Osborn & Callcott, 1995;Cocco et al., 2004;Ghiringhelli et al., 1998Ghiringhelli et al., , 2006Tokushima et al., 2006) which allow formation of any desired inclination of the focal plane towards upright as well as cancellation of the coma aberrations. The spherical VLS grating (SVLSG) is used, in particular, in the spectrometer SAXES (Ghiringhelli et al., 2006) of the ADRESS beamline  at the Swiss Light Source, Paul Scherrer Institut. This instrument delivers E/ÁE above 11000 at 1 keV photon energy, presently the highest achieved resolving power.
The optical design of the SVLSG-based spectrometers is more complicated compared with the simple Rowland conditions and includes numerical computations. The optimal design should ensure minimal optical aberrations (and thus maximal resolution) at maximal angular acceptance (and thus spectrometer transmission). Here, we demonstrate the optical design of a model SVLSG spectrometer with E/ÁE above 20000. The grating parameters are optimized for a reference energy E ref of 930 eV (Cu L-edge, important, for example, for the physics of correlated cuprates) to cancel the lineshape asymmetry coming mostly from the coma aberrations as well as to minimize the symmetric line broadening piling up at large illuminations. Furthermore, following our preliminary technical report (Strocov et al., 2008), we evaluate adjustments of the spectrometer geometry upon variation of energy necessary to maintain the symmetric lineshape and constant focal curve inclination or maximal aberration-limited acceptance for any energy away from the reference.

Numerical procedure
Our evaluation of the grating parameters and spectrometer geometry described below used the dedicated software package TraceVLS written in MATLAB. The package is based on an effective numerical ray-tracing scheme devised to achieve maximal execution speed for further uses in optimization loops. Briefly, the ray-tracing is performed in two dimensions restricted by the dispersion plane of the spectrometer, shown schematically in Fig. 1. The rays from a point source are propagated towards the ideal spherical VLS grating. To deliver symmetric illumination of the grating relative to its center, the situation taking place when aligning the spectrometer in a real experiment, the angular range of the rays is slightly asymmetric relative to the central ray. The rays diffract off the grating with the local groove density where ! is the coordinate tangential to the grating surface in the center, according to the grating equation where is the wavelength corresponding to the energy E, k is the diffraction order (positive for the internal), is the incidence angle on the grating and is the diffracted beam angle (positive notation) relative to the surface normal. From the grating the rays propagate towards the detector whose position is defined by the focal equation where r 1 and r 2 are the entrance and exit arms, respectively, and R is the grating radius. The line profile is calculated as a histogram of the rays in the detector plane. This profile contains all optical aberrations such as the coma. Its further Gaussian broadening is due to the finite source size Á S , grating slope errors Á SE and spatial resolution of the detector Á D . Their contributions to the total linewidth are, respectively, hereinafter all widths being FWHM. {We note in passing that our expression (5) is equivalent to its known form ÁE SE = ½Á SE ðcos þ cos ÞE=a 0 k (Howells, 2001), where the denominator can be replaced according to the grating equation (2) and the trigonometric functions sum (difference) appearing in the nominator (denominator) is transformed to their product.} The angle in (6) is the detector inclination relative to the central ray, which allows improvement of ÁE D . The total Gaussian line broadening is then simulated by convolution of the ray-tracing calculated (bare) line profile with a Gaussian whose width ÁE G is taken as the vector sum ÁE G = ½ðÁE S Þ 2 + ðÁE SE Þ 2 + ðÁE D Þ 2 1=2 . By virtue of this simplified computational method and extensive vectorization of the MATLAB code, a ray-tracing run with TraceVLS for a given set of parameters with a few thousand rays takes less than a tenth of a second on a low-end PC. Note that owing to involving only the rays in the dispersion plane this procedure omits the 'smiley' line distortion in the perpendicular direction (see, for example, Tokushima et al., 2006) which is, however, normally compensated by post-processing of the data. The TraceVLS package was further used to optimize the grating parameters to deliver the narrowest symmetric profile at E ref (see x3) as well as to adjust the spectrometer geometry to keep such a profile when going away from E ref (x4). The principal obtained results were verified with generic raytracing codes PHASE (Bahrdt et al., 1995) and RAY (Schä fers, 2008). The popular code SHADOW (available at http:// www.nanotech.wisc.edu/shadow/) returns identical results starting from the year 2010 release which has fixed a bug on treatment of SVLSGs.

Optimization of the grating parameters at reference energy
The basics of the optical design procedure for SVLSG spectrometers are described, for example, by Ghiringhelli et al. (2006). Here we follow a somewhat different route. We start with a definition of the following parameters: E ref , a 0 , k, , Á S and Á D introduced above, the total spectrometer length L and the FC inclination angle to match the optimal detector inclination angle. Then the r 1 and r 2 entrance and exit arm lengths are obtained by minimization of ÁE G under the constraint r 1 + r 2 = L. With ÁE SE being independent of r 1 and r 2 , this is equivalent to minimization of ðÁE S Þ 2 + ðÁE D Þ 2 , where ÁE S (4) decreases with r 1 and ÁE D (6) increases with r 1 = L À r 2 . Equating the derivative of this sum with respect to r 1 to zero takes us to the condition Compared with the seemingly obvious condition of balance of the ÁE S and ÁE D contributions (Ghiringhelli et al., 2006) the condition (7) improves the total ÁE G (in our case by $ 3000 in E/ÁE) and displaces the grating towards the detector, requiring larger grating length for the same vertical acceptance of the spectrometer. The grating radius R and the linear VLS term a 1 are then calculated as the analytical solutions of a system of two equations, which are the condition (3) on the focus to be at r 2 plus the condition imposed on the FC inclination, It should be noted that the possibility of controlling the FC inclination is an important advantage of the SVLSG spectrometers over the plane VLS ones. For our model spectrometer we have accepted realistic parameters of E 0 = 930 eV, a 0 = 3500 lines mm À1 , k = 1 (internal), = 88 , Á S = 2 mm, Á SE = 0.47 mrad (corresponding to 0.2 mrad r.m.s. which is the present technological limit for spherical optics), Á D = 24 mm, = 20 and L = 5000 mm. The above procedure yielded r 1 = 798.7 mm, r 2 = 4201.3 mm, R = 43241 mm and a 1 = 0.6377 mm À2 . Ray-tracing calculations using TraceVLS, performed with the above parameters and a realistic grating illumination of 120 mm, yielded the results shown in Fig. 2(a) as the bare line profile as well as the Gaussian broadened profile. The profile is highly asymmetric owing to aberrations dominated by the (primary) coma. With the Gaussian linewidth broadening ÁE G = 45.4 meV in our case, the aberrations deteriorate the spectrometer resolution to 84.8 meV.
The line asymmetry can be corrected by the a 2 coefficient of the VLS expansion. First, we should try to cancel the coma aberration predominantly contributing to the asymmetry. Evaluation of the optical path function (Howells, 2001;Peatman, 1997) and setting the F 30 (primary coma) term of its Maclaurin expansion to zero yields the condition sin 2r 1 which allows analytical calculation of a 2 to cancel the coma. In our case it yields a 2 = À0.975 Â 10 À3 mm À3 . The results of raytracing performed with this a 2 at the 120 mm illumination are shown in Fig. 2(b) (dotted lines). The line asymmetry is greatly reduced, remaining only in some asymmetry at its foot. However, the applicability of the analytical coma-free condition (9) is limited only to the coma aberration term and vicinity of the central ray, where the optical path function is derived. A numerical procedure should be applied to optimize a 2 taking into account the asymmetric aberrations of all orders as well as realistic grating illuminations. We used the TraceVLS ray-tracing procedure in an optimization loop to determine a 2 delivering the symmetric line profile as identified in the strict mathematical sense of zero skewness of the histogram. The optimized a 2 is obviously somewhat illumination-dependent, but in practice the value found for large illuminations ensures that the line asymmetry stays negligible also with small illuminations, because all aberrations scale down with a power of two or stronger. In our case we performed the optimization with the above 120 mm illumination, which has returned a 2 = À0.995 Â 10 À3 mm À3 . The results of ray-tracing with this a 2 in Fig. 2(b) (solid lines) show a perfectly symmetric profile. Strictly speaking, this does not ensure that all asymmetric high-order aberrations vanish, but combine in a symmetric profile. We have checked that in the limit of vanishing illumination our optimization procedure returned the a 2 value identical within the numerical accuracy to the above analytical coma-free one. It should be noted that the difference between the analytical and optimized a 2 is only $ 2%, well within the practical manufacturing accuracy. Interestingly, the analytical formula for a 2 from Osborn & Callcott (1995) returned a notably different value of À4.82 Â 10 À3 mm À3 yielding an asymmetric profile for all illuminations. While our optimization procedure allows full cancellation of the line asymmetry, the profile in Fig. 2  Effect of the a 2 and a 3 coefficients of the VLS expansion on the line profile for the model spectrometer at an illumination of 60 mm, calculated with (a) a 2 = a 3 = 0; (b) analytical coma-free a 2 (dotted line) and numerically optimized a 2 (solid), with a 3 = 0; (c) numerically optimized a 2 and a 3 . Shown are the bare line profiles (red) and the corresponding Gaussian broadened ones (blue). The profiles are normalized to the maximal amplitude. The optimization of a 2 delivers a symmetric profile, and a 3 suppresses the symmetric broadening at large illuminations.
symmetric broadening and a broad foot owing to higher-order aberrations piling up at large illuminations. In our case this deteriorates the spectrometer resolution from the ÁE G = 45.4 meV Gaussian limit to 60.0 meV.
The remaining symmetric broadening can be reduced by optimization of the a 3 coefficient. Owing to a slight cross-talk of a 3 back to a 2 (in fact, separation of the line profile distortion into specific aberrations connected with particular a i coefficients is artificial and works only in the vicinity of the central ray; their crosstalk increases with illumination) the optimization of a 3 with the highest accuracy should be performed under re-optimization of a 2 at each iteration step to keep the profile symmetric. For our model case with the 120 mm illumination this optimization returned a 3 = 2.02 Â 10 À6 mm À4 at almost the same a 2 = À0.986 Â 10 À3 mm À3 . The corresponding ray-tracing calculations in Fig. 2(c) show that the line profile has shrunk essentially to a delta-function (although with some structure on the meV scale) whose width is negligible compared with ÁE G . The spectrometer resolution has thus reached the Gaussian linewidth limit, delivering the resolving power E/ÁE = 20420. No attempt has been made to optimize VLS expansion coefficients higher than a 3 because they can hardly be realised with sufficient accuracy in a realistic manufacturing process.
The grating illumination is limited by increase of aberrations. In fact, this limit increases with r 1 in such a way that the corresponding vertical acceptance Á stays roughly constant. In other words, the situations of small illumination of a grating close to the source and large illumination of a grating far from the source are roughly equivalent from the aberration point of view. We will therefore characterize the illumination by the corresponding Á as a parameter more universal upon variations of r 1 . The effect of a 3 on the aberration-limited spectrometer acceptance is illustrated in Fig. 3 which shows the total (aberration and Gaussian) linewidth as a function of Á calculated without and with the optimized a 3 . The low-aberration plateau, where the aberrations stay insignificant compared with the constant ÁE G , increases its extension from $ 2 to 7 mrad. The optimization of a 3 allows therefore operation of the spectrometer at much larger Á.
Compared with the presently most advanced spectrometer SAXES (Ghiringhelli et al., 2006), the simulated spectrometer of the same dimensions promises an increase of E/ÁE by a factor of $ 1.8 and the aberration-limited Á by a factor of $ 3.5. It should be noted that the spectrometer transmission can be further improved by another factor of $ 3 by installing a collector mirror in the sagittal geometry in front of the grating to increase acceptance in the horizontal plane. Further increase of the angular acceptance may be achieved with optical schemes of Hettrick-Underwood (Hague et al., 2005) or collimated-light plane grating (Agå ker et al., 2009) though compromising on resolution and transmission at higher soft-X-ray energies.
4. Optimization of the spectrometer geometry for variable energy 4.1. Lineshape dependence on the spectrometer geometry and angular acceptance With the grating parameters optimized for certain E ref , one can maintain the exactly symmetric line profile for any energy away from the reference by variation of the spectrometer geometry. We illustrate this in Fig. 4 (top)  The total (aberration and Gaussian) linewidth ÁE depending on the Á vertical acceptance without and with the a 3 coefficient (optimized at 930 eV) for energies of 930 eV (two upper curves) and 530 eV in the MA mode (two lower ones, see text). Optimization of a 3 dramatically increases the maximal illumination and thus aberration-limited Á even away from E ref .  simulated spectrometer with the grating optimized for 930 eV, the ray-tracing calculated ÁE linewidth depending on r 1 and for an energy of 530 eV (O K-edge). The illumination varies with r 1 and over the plot to keep the Á vertical acceptance constant and equal to a moderate value of 3 mrad. It should be noted that these simulations always keep the spectrometer in focus, i.e. r 2 varies with r 1 and over the plot according to the focal equation (3).
The resolution plot shows a prominent valley. Fig. 4  (bottom) illustrates the evolution of the lineshapes upon crossing the valley by variation of along the marked line of constant r 1 = 600 mm through the points A, B (bottom of the valley) and C separated by 0.075 . The point B is characterized by the symmetric lineshape (again, the asymmetric high-order aberrations may not exactly vanish at this point but yield a symmetric combination) whereas in the points A and C the asymmetry is already significant. Therefore, the best spectrometer resolution in the bottom of the valley corresponds exactly to the symmetric profile (SP) lineshape. Note that upon crossing the valley the asymmetry tail flips from the left to the right side, which ensures there must exist a point where the asymmetry becomes exactly zero in the mathematical sense of zero skewness of the line profile. Therefore, the asymmetry can be not merely minimized, but totally cancelled for any energy away from the reference.
The resolution plot shows that the asymmetry cancellation can also be achieved by variation of r 1 for = constant. Therefore, for every energy there are two alternative ways to maintain the SP spectrometer operation: either by optimizing the grating position along the beam to change r 1 or by optimizing the pitch of the grating to change .
For E ref the resolution plot has the same pattern, i.e. the spectrometer can deliver the SP lineshape with r 1 and different from the reference values (although with some increase of the symmetric aberration broadening and ÁE G optimized for the reference geometry). This degree of freedom also allows compensation of certain manufacturing errors of the a 2 coefficient.
It is instructive to follow changes in resolution with increase of the Á vertical acceptance. Fig. 5 shows the same resolution plot as in Fig. 4 but with Á increased to 6 mrad. Similarly to the previous figure, the panels at the bottom illustrate the evolution of the lineshapes upon crossing the valley. The valley center again corresponds to the SP lineshape. With increase of Á the valley becomes narrower, a consequence of the aberrations scaling up. This makes the spectrometer more sensitive to alignment. It is interesting to note a tiny bump appearing exactly in the valley center (i.e. the exactly symmetric profile has slightly larger FWHM) and a spike of FWHM piling up at the right-hand border of the valley near the point C (owing to formation of a double-peak structure in the line profile).
The effect of Á is further illustrated in Fig. 6 which shows ÁE plots calculated for a series of Á. They correspond to two cross sections of the above resolution plots, along the r 1 = 600 mm line as a function of (a) and along = 88.2 as a function of r 1 (b). As we have already seen in Fig. 5, with an increase of Á the valley narrows, a spike of FWHM gradually forms on the right-hand side of the valley, and a notable bump at the bottom piles up at large Á. A very slight displacement of the SP point can be noted. Most important, however, is that the ÁE degradation in the SP conditions stays insignificant, allowing the spectrometer operation at the highest transmission. Furthermore, the plot in Fig. 6 gives us an estimate of the practical accuracy of the spectrometer settings. The curve for Á = 4 mrad, for example, shows that if we accept a tolerance of 5% on degradation of ÁE relative to its minimum the corresponding tolerances on and r 1 are about AE 0.02 and AE 8 mm, respectively. The same resolution plot as in Fig. 4 but with Á increased to 6 mrad. The SP valley narrows down, making the spectrometer more sensitive to alignment.

Figure 6
Resolution plots as a function of for r 1 = 600 mm (a) and as a function of r 1 for = 88.2 (b) calculated with Á increasing from 1 to 6 mrad in steps of 1 mrad. The SP valley narrows, but ÁE at its bottom increases only marginally.

Evaluation of the symmetric lineshape spectrometer settings
Corresponding to the resolution plot valley, the SP trajectories in the (r 1 , ) coordinates or the corresponding ones in the (r 1 , r 2 ) coordinates define the spectrometer settings to maintain the SP lineshape. We have calculated these trajectories for our model spectrometer in a range of energies from 430 to 1230 eV. First, we evaluated the SP trajectories using the analytical coma-free condition (9). These 'analytical' trajectories are displayed in Fig. 7 (dotted lines). Second, we used the TraceVLS ray-tracing procedure in an optimization loop similarly to the above determination of a 2 . Á in these calculations was kept at 5.2 mrad corresponding to the illumination used in the calculations at E ref . These 'numerical' trajectories are shown in Fig. 7 (solid lines). Obviously the coma-free condition (9) gives an excellent approximation to the SP trajectories. Nevertheless, the full ray-tracing analysis, taking into account the finite illumination and higher-order aberrations, introduces notable corrections, especially at the low-r 1 end. On average in the r 1 range displayed in the plot the corrections are about 0.011 in and 22 mm in r 2 resulting in an increase of E/ÁE by about 1200. The SP trajectories in the (r 1 , ) and (r 1 , r 2 ) coordinates, calculated over a range of energies, determine the required ranges of the r 1 , and r 2 mechanical motions.
It should be noted that prerequisite to maintaining the SP lineshape under energy variations is a mechanical flexibility of the SVLSG spectrometer to vary at least two of the three parameters r 1 , and r 2 . The beamline monochromators in general do not enjoy such a flexibility because of the fixed slit position. In (exactly focusing) spherical-grating monochromators (Peatman, 1997) variation of + with the premirror keeps the beam focused at the slit under energy variations, but there remain no degrees of freedom to cancel the line asymmetry away from E ref unless the grating is translated.

Fixed-inclination and maximal-acceptance operation modes
For any energy one can achieve the SP spectrometer operation by setting different combinations of r 1 and along the SP trajectories. We will show that this remaining degree of freedom may be used in two ways, to maintain for each energy either fixed FC inclination angle or minimal aberrations at large Á. We will refer to these two operation modes as the fixed inclination (FI) and maximal acceptance (MA) modes.
To evaluate the FI mode we have calculated the dependences of defined by (8) along the above 'numerical' SP trajectories. Fig. 8(a) displays these dependences as a function of r 1 . They show dramatic variations and even jump from positive to negative values of , as seen for the lowest energy. It is not practical to follow these variations by changing the detector inclination angle, because this angle should normally stay around its optimal value chosen, on one side, as glancing as possible to reduce the effective pixel size and thus ÁE D and, on another side, above the critical angle where the intensity starts to drop owing to shadowing effects and increasing attenuation in the oxide dead layer (the 20 inclination angle adopted in our case is typical of the modern backilluminated CCD chips).
Although the relatively large focal depth of long spectrometers makes them not very critical on matching the FC to the detector inclination, one can find a mode to operate the spectrometer at fixed (energy-independent) FC inclination. Indeed, Fig. 8(a) shows that for any energy the SP trajectories bear one point where the match is exact (crossings with the = 20 horizontal line). We have found the r 1 and corresponding coordinates of these points by numerical solution of (8) under the SP constraint. The corresponding dependences of and r 1 calculated over a wide energy range are shown in Fig. 8(b). In this way our analysis identifies the FI operation mode of the SVLSG spectrometer which maintains over a wide energy range the SP lineshape and exact match of the FC to the detector inclination.
Principles of the MA mode are illustrated in Fig. 9(a), which shows ÁE dependences of r 1 along the 'numerical' SP trajectory from Fig. 7 for an energy of 530 eV. Whereas for small Á these dependences show a monotonous decrease of ÁE with r 1 , for large Á there develops a pronounced minimum at r 1 ' 750 mm. In this point ÁE is almost independent of Á. Similarly to the effect at E ref , this minimum appears due to the a 3 coefficient. Therefore, for any energy the    SP trajectories bear one point where the aberration-limited Á is maximal, characteristic of the MA operation mode.
We have determined the r 1 and corresponding coordinates of the MA points in an extended energy range by numerical minimization of ÁE under the SP constraint. The results are shown in Fig. 9(b). They identify the MA operation mode of the SVLSG spectrometer which maintains over a wide energy range the SP lineshape and maximal aberrationlimited Á.
Furthermore, we have investigated how large the effect of a 3 is to increase the aberration-limited Á away from E ref . The two lower curves in Fig. 3 show the total linewidth at 530 eV as a function of Á calculated in the MA mode with a 3 = 0 and with our optimized a 3 . Although the optimization was performed at 930 eV, this a 3 increases the width of the lowaberration plateau from $ 2 to 7 mrad, an effect as large as at E ref .
Finally, we have compared over a wide energy range the FI and MA modes in terms of resolution. The calculations were performed with a large Á value of 6 mrad. Fig. 10 (solid lines) shows the calculated ÁE dependences together with those of the Gaussian resolution limit ÁE G (dotted). As expected, in the FI mode the ÁE values are generally above ÁE G owing to the symmetric aberration broadening at this Á. The difference rapidly decreases with decrease of Á and vanishes in the Á = 0 limit. The two dependences coincide at E ref where the a 3 coefficient was optimized to minimize this broadening. In the MA mode, by its design principle, the ÁE dependence almost coincides with its ÁE G limit, providing better resolution with large Á compared with the FI mode. Note that the ÁE G dependences are slightly different in the two modes owing to different trajectories in the (r 1 , , r 2 ) coordinates (see Figs. 9 and 10). Energy variations of the FC inclination in the MA mode, plotted in the corresponding panel of Fig. 10, are large.
Also shown in Fig. 10 (dashed lines) are the ÁE S source size, and the ÁE D detector and ÁE SE slope error contributions to the total ÁE G . The resolution is limited predominantly by ÁE D . This demonstrates that improvement of the spatial resolution of X-ray detectors is the factor most important for further energy resolution progress of the soft X-ray spectrometers.

Software tools
Based on the TraceVLS package, we have developed a userfriendly GUI-based program for fast determination of the optimal spectrometer geometry for varying energy, including the FI and MA modes. The GUI is shown in Fig. 11. First, in the box 'GRATING' one defines the grating parameters. Then in the box 'PARAMETERS' one defines the fixed spectrometer settings, including the detector inclination angle and some of the three geometry parameters r 1 , and r 2 necessary to calculate the remaining ones according to the focalization Energy dependences of the resolution ÁE and its Gaussian limit ÁE G (solid and dotted lines) for the FI and MA modes. Also shown is the ÁE G breakout into the source size ÁE S , detector ÁE D and slope error ÁE SE components (dashed lines) where ÁE D dominates. The line marked (E) in the MA panel shows energy variations of the FC inclination in this mode.

Figure 11
Screenshot of the TraceVLS-based GUI for optimizing the spectrometer geometry for different energies. With the grating optimized at 930 eV, the shown spectrometer settings deliver a SP lineshape at 530 eV.  conditions defined in the box 'FOCUS MODE' below. If one checks the simple focus, the code calculates either out of given (r 1 , r 2 ) or r 2 out of given (r 1 , ) based on the focal equation (3). If one checks for the SP focus, the code calculates (, r 2 ) out of given r 1 or (r 1 , ) out of given r 2 based on two conditions: the focal equation (3) plus zero asymmetry of the line profile as defined by numerical optimization. If one checks the focus in the FI or MA modes, the code calculates all three parameters (r 1 , , r 2 ) based on the two above conditions plus the condition that either matches the detector inclination or the symmetric aberrations for given illumination are minimal, respectively. The results of the calculations are displayed in the box 'RESULTS' as the calculated bare line profile, Gaussian broadening and the resulting total line profile, as well as numerical outputs such as various contributions to the total resolution and the diffraction angles.
Owing to the fast ray-tracing scheme, the TraceVLS-based GUI finds the optimal spectrometer settings for a given energy in less than a second on a low-end PC for the simple or SP focus, and in a couple of seconds for the FI and MA modes. The user-friendly interface allows its use as an online tool in real experiments. It should be noted that similar optimizations using generic ray-tracing software like SHADOW would be far more laborious owing to the necessity to manually set up the computational parameters in each pass of the optimization loop. The code is written in MATLAB and is platform-independent. It is available free for academic users by writing to the first author.

Summary
We have analysed the operation of a spherical-VLS-gratingbased X-ray spectrometer using a dedicated ray-tracing software package TraceVLS, allowing fast optimization of the grating parameters and spectrometer geometry. The analysis is illustrated with optical design of a model spectrometer delivering E/ÁE above 20400 at a photon energy of 930 eV. With a reference energy E ref chosen at 930 eV, the spectrometer geometry is evaluated to minimize the Gaussian line broadening owing to the source size, grating slope errors and detector spatial resolution. The lineshape asymmetry (mostly owing to the coma aberrations) is cancelled by optimization of the a 2 coefficient of the VLS power expansion. At small illuminations the obtained a 2 becomes identical to that yielded by the analytical coma-free condition derived from the optical path function. Furthermore, the remaining symmetric line broadening at large illuminations (owing to higher-order aberrations) is reduced by optimization of a 3 which allows a dramatic increase of the aberration-limited Á acceptance of the spectrometer, in our case by a factor of about 3.5. For any energy away from E ref the exact asymmetry cancellation can be maintained by correcting either r 1 or . The corresponding SP trajectories in the (r 1 , ) and (r 1 , r 2 ) coordinates are calculated from the analytical coma-free condition and, with better accuracy, by numerical minimization of the line asymmetry. The remaining degree of freedom to set different combinations of r 1 and along the SP trajectories is utilized to maintain either energy-independent FC inclination (FI operational mode) or maximal aberration-limited Á acceptance (MA mode) which exploits the effect of the a 3 coefficient to minimize the symmetric aberration broadening. In routine experimental work the optimal r 1 , and r 2 spectrometer settings can be calculated in a fraction of a second using our ray-tracing code wrapped in a user-friendly GUI. Our analysis thus gives a recipe to design and operate SVLSG spectrometers at large angular acceptance and in an extended energy range without any notable degradation of resolution beyond the Gaussian broadening factors. These properties of the SVLSG optical scheme along with its ultimate simplicity suggest its use in the hv 2 spectrometer (Strocov, 2010) where imaging and dispersion actions in two orthogonal planes are combined to deliver the full two-dimensional map of RIXS intensity with simultaneous detection in incoming and outgoing photon energies.