Collaboration Meeting on "Simulation and Modeling for SR Sources and X-Ray Optics"


Summary of Collaboration Meeting on “Simulation and Modeling for SR Sources and X-Ray Optics”

1. General Information about the Collaboration Meeting

The Collaboration Meeting was held in the scope of activities envisaged by the DOE SBIR (Phase II) grant on "Development of Software Framework for X-Ray Optics Simulation and Modeling" awarded to RadiaSoft LLC and BNL and targeting to improve X-ray optical simulations for US DOE BES Light Source facilities.  The attendees of the Meeting represented the European Synchrotron Radiation Facility (ESRF) - Manuel Sanchez del Rio (MSR) and Mark Glass (MG); ELETTRA - Luca Rebuffi (LR); Advanced Photon Source at Argonne National Laboratory (APS at ANL) - Ruben Reininger (RR) and Xianbo Shi (XS); RadiaSoft LLC - David Bruhwiler (DB) and Rob Nagler (RN); and National Synchrotron Light Source II at Brookhaven National Laboratory (NSLS-II at BNL) - Lutz Wiegart (LW) and Oleg Chubar (OC).

The Collaboration Meeting participants were welcomed by Paul Zschack, the NSLS-II Photon Sciences Division Director. In his welcome talk, Paul described the successful commissioning and the transition to user operation of the first NSLS-II beamlines and emphasized importance of simulations for the design and commissioning of new beamlines, as well as eventually for simulation of entire experiments at Light Sources.

The main presenters (MSR,MG, LR, XS, DB, LW and OC) then delivered ~15 scheduled talks during 2 days
of the Meeting, as this was envisaged by the Meeting Agenda. The talks concentrated in the activity around the two main packages used for beamline modeling: SHADOW (geometrical ray-tracing) and SRW (physical optics). They covered historical evolution, theoretical basement of different calculation methods, recent updates in core functionalities, programming interfaces (both in python), and graphical user interfaces and user front-ends. The slides of the presentations are published in the Collaboration Meeting web site. The following sections summarize the contents of the presentation, divided in three categories: i) methods and algorithms, ii) programming and user interfaces, and iii) simulation of experiments.

2. Presentations and Discussion on Physical Optics Simulation Methods

2.1. Summary of Presentations

In the area of theoretical basement of physical optics simulations, first the high-accuracy approach used
by SRW was described by OC. This approach is based on integrating of retarded potentials for the initial calculation of non-correlated frequency-domain electric fields of radiation from individual “macroelectrons”, and then applying Fourier optics and compatible methods for simulation of propagation of these fields, followed by summing up of the corresponding intensities (normal or mutual) for accurate description of characteristics of propagated partially-coherent SR. Besides the high accuracy, the advantage of this method is its generality (it is applicable to any type of SR and nearly any type of optical systems used at Light Sources, thanks to recent implementation of “propagators” for different types of X-ray optics). Even though the method is CPU-efficient for fully-coherent and partially-coherent beams at high degree of coherence, its disadvantage is relatively low numerical efficiency for low-coherence beams (in its current implementation in SRW). On the other hand, the method is very easily parallelizable, offering nearly linear reduction of calculation time with the increase of number of processor cores used.

XS also commented the possible use of Low-discrepancy sequences (e.g. Halton sequences) for filling the
electron phase space and reduce considerably the CPU time in multi-electron partially-coherent SRW calculations. Some results on converge were shown and questions on accuracy, biasing and CPU efficiency were raised.

Ray-tracing codes, which are based on geometrical optics, have been extensively used by the
synchrotron radiation community for optical design and beamline optimization. The merit of the geometrical optics approach to represent the propagation of the beam through the beamlines has been challenged by the recently constructed and planned low emittance sources. In order to include the diffraction effects from apertures (slits or finite optics acceptance) and figure errors on optics, HYBRID was developed by XS and RR and presented in this meeting. The method uses ray-tracing as the back bone and applies wavefront propagation when the beam is clipped. The method provides a high efficient representation of the partial coherent radiation propagation by means of convolution through ray resampling at the cost of some accuracy as bench marked against SRW. As an easy add-on to any ray-tracing program (as its recent implementation in SHADOWVUI), HYBRID is a useful tool for beamline design and optimization as well as for the specification of the beamline optical components.

In addition to the two calculation methods described above, a possible approach to increasing the
efficiency of the partially-coherent SR calculations, eventually without reduction of accuracy and generality, was described by MG. This approach is being developed in the framework of the PhD thesis of MG. It is based on decomposition into coherent modes (as defined by Mandel and Wolf) of initial partially-coherent SR obtained using the convolution theorem, and subsequent propagation of the coherent mode fields (rather than the fields from “macro-electrons”), that can potentially reduce a required total number of coherent wavefront propagations for a given accuracy level.

2.2. Discussion and Conclusions

Discussions related to physical-optics calculation methods revealed importance of availability of different methods for treating different types of scientific and engineering problems. E.g., according to RR, optical design can be accomplished using less accurate and CPU-efficient methods like the HYBRID code. The expected performance calculated using such scheme can be then accurately determined using codes like SRW. On the other hand (according to OC) for such applications as source and optical element diagnostics, the accuracy of calculations can’t be compromised; as well as the generality of calculation methods can’t be compromised at development of new types of sources and optics and/or new optical schemes. It was recognized that some functions / parts of the SRW code, such as SR calculation, CPU-efficient fully coherent 2D wavefront propagation through different types of optics, economic (in terms of memory use) types of Fourier-optics propagators with semi-analytical treatment of the quadratic phase term, wavefront resizing/resampling (to ensure accuracy of propagations), 1D and 2D convolutions – can be successfully used by other methods and tests (in particular the HYBRID method and the coherent mode decomposition based one), separately from the general SRW function for partially-coherent calculations. To fully exploit these possibilities, a few more “interface” functions may need to be added to the SRW C Application Programming Interface and Python binding. OC confirmed that these functions can be easily added in the scope of the on-going collaborations. The interest for the end user is the availability in user friendly environments of all these different methods that balance CPU efficiency and accuracy in the results, a subject discussed in the following section.

3. Presentations and Discussion on Front-Ends and Interfaces

3.1. Summary of Presentations

A considerable progress was made by the European and US teams in the area of development of
Graphical User Interfaces (GUI) for simulations with SHADOW, SRWand possibly other codes. In addition to the existing old GUIs (such as SHADOWVUI, XOP/IDL, IGOR Pro) several new GUIs have emerged.

LR described development activities at ELETTRA in creating a new graphical environment (OASYS) for combining different packages based on the ORANGE. ORANGE is an open source project developed,
using Python and the Qt graphical package, at Ljubljana University (Slovenia) for scientific and engineering calculations driven by widgets, with graphical representation of a workflow. LR’s presented a fully new complete interface for SHADOW within OASYS called “ShadowOui”. Thanks to the powerful visual programming functions, OASYS / ShadowOui can be used both by SR beamline design professionals and by less experienced SR users and by students. Only client based calculations are supported at present, but widgets with remote access to web services and databases are easily implementable. A MacOSX ready-to-go App is already available, while a manual installation is needed for Linux systems (pre-compiled releases based on Python virtualenv are planned).

DB presented recent development of the RadiaSoft LLC – the “Sirepo” web-based framework including a 
GUI (implemented in JavaScript) and supporting automatic generation of Python scripts from graphical representation of a beamline. The framework supports simulations with SRW and, on a long run, is planned to support simulations with SHADOW and possibly other codes. The framework allows for both client and server/cloud based calculations and targets large categories of users, including beamline developers, scientists supporting beamline operation, SR users preparing their experiments at Light Sources, students at Universities, and others. A remarkable feature of this framework is the absence of need to perform any complicated client-side installations before starting calculations.

A fundamental subject of the on-going collaboration between European and US teams is the
development of a “Glossary” and a general Python class structure enabling description of SR sources, individual optical elements and entire beamlines, for subsequent simulations by different computer codes interfaced to Python (first of all SHADOW and SRW). The idea is to define and create a common Python middle layer that could allow running both SRW and SHADOW codes from the same user interface (either OASYS or Sirepo). In this respect, MSR and MG presented the “Optics” Python module prototype developed by them (name to be possibly changed in the future), including a prototype class structure that implements a mechanism to define the physical items of the beamline (component glossary) combined with a system of “drivers” to call different programs (SHADOW, SRW and others).  Several scrips are available illustrating simulation of the emission and focusing of bending magnet SR by SHADOW and by SRW codes from the same initial input. LR presented a prototype for the integration of the SRW and SHADOW codes into the same GUI (OASYS) demonstrating the suitability of the “Optics” middle layer.

3.2. Discussion and Conclusions

It is understood that the different GUI projects (and the associated frameworks/environments) presented – OASYS (ORANGE based) and “Sirepo” (web and client based) – are complementary to each other; they target somewhat different applications and user groups, and their development has to continue in parallel (at ELETTRA and ESRF for OASYS, and at RadiaSoft and BNL for “Sirepo”, with exchanges of information between the two groups).

The development of the “Optics” Python module for “code-independent” description of SR sources and
X-ray optics has to continue as well, to extend the general class structure and to increase the number of examples on a short run. On a longer run, this project can be used for supporting SRW simulations in OASYS and SHADOW simulations in “Sirepo”. In the future, the common “Glossary” may be implemented not only in the form of Python class structure, but also in other formats (e.g., json files).

Considerable efforts must be dedicated to facilitating distribution and installation of software, via
installation packages (e.g. “pypi” as used by OASYS), binary distributions, and using “container” technologies (as used by RadiaSoft).

The importance of powerful and reliable GUIs, correctly configured with simulation codes, eventually
available from Cloud / Internet, was emphasized by J. Lidestri from New-York Structural Biology Center.  The availability of the software from Cloud can be particularly interesting for users performing X-ray optics and other related simulation only occasionally.

4. Presentations and Discussion on Applications of the Radiation Propagation Codes for Simulating Experiments and Experimental Data Processing.

4.1. Summary of Presentations

LR presented results of detailed SHADOW calculations performed in the scope of his PhD thesis work with ShadowOui targeting simulation of X-ray Powder Diffraction (XPD) experiments, and in particular calculation of “instrument function” for this type of experiments. The calculation was based on geometrical ray-tracing, taking into account rocking curve data from SHADOW/XOP, and adding the sample simulation that includes propagation and diffraction of rays by crystallite powder in glass capillaries. A very good agreement was shown between the ab-initio calculations of the instrumental function and its fit to the Caglioti equations with experimental beamline calibrations using LaB6 NIST reference at two powder diffraction beamlines (ELETTRA and APS). XS commented on importance of such simulations for XPD beamlines, in particular for the Damping Wiggler based XPD beamline at NSLS-II.

LW made a presentation on the application of SRW code (and it’s new “Virtual Beamline” module) for
computer-assisted commissioning of the Coherent Hard X-ray (CHX) beamline at NSLS-II. The presentation covered studies and interpretation of aberrations introduced by imperfect surfaces of crystals of the dual-crystal monochromator at CHX, estimation of the degree of coherence using the Boron-fiber and slit-diffraction techniques, and start-to-end simulation of coherent X-ray scattering experiments at partially-coherent illumination of samples. LW emphasized the importance of such simulations for the optimal use of CHX beamline for different types of samples in different scattering schemes. A special point was made on estimation of CPU-efficiency of the partially-coherent SRW calculations in parallel mode for different optical schemes. In particular, it was shown that the simulation of the Boron-fiber interference experiment at CHX was giving reasonable results already after several minutes of execution on a ~8 core server (with full convergence taking place after several hours of the execution). Advantages of the generality of SRW code (i.e. its applicability to different types of experimental schemes at different beamline locations and operation modes) and its accuracy were emphasized. Future plans for using SRW functions for developing or/and fine-tuning data processing algorithms for the coherent scattering experiments at partially-coherent illumination were mentioned.

4.2. Discussion and Conclusions

All participants agreed about high importance of extending the SR propagation codes to simulation of user experiments, especially the experiments at new low-emittance high-brightness storage ring sources and at free-electron lasers. This can dramatically increase the amount of applications of the codes, and may greatly help in making the best use of the high brightness and high coherence of the new sources in different types of user experiments. 

The importance of making the SR emission and propagation simulation codes available, via easy-to-use
interfaces, to different categories of users, including students, was also recognized by all Meeting participants.