1 Introduction
The dynamic mechanical properties of materials are strongly dependent on the temporal evolution of material structures at the micro mesoscale, and have important applications in extreme scenarios such as celestial evolution and inertial confinement fusion[ Reference Yoo 1 – Reference Betti and Hurricane 3 ]. The average grain size and grain distribution are the key microstructure characteristics that affect the physical and chemical properties[ Reference Offerman, van Dijk, Sietsma, Grigull, Lauridsen, Margulies, Poulsen, Rekveldt and van der Zwaag 4 – Reference Chan, Cherukara, Loeffler, Narayanan and Sankaranarayanan 6 ], representing the fundamental qualities of polycrystalline materials, and therefore are of vital importance in predicting material responses, evaluating the kinetic phase transformation process and gaining insight into the physical properties.
As a microstructure characterization technology, small-angle X-ray scattering (SAXS) is of significant value in high-pressure material science[ Reference Bagge-Hansen, Bastea, Hammons, Nielsen, Lauderbach, Hodgin, Pagoria, May, Aloni, Jones, Shaw, Bukovsky, Sinclair, Gustavsen, Watkins, Jensen, Dattelbaum, Firestone, Huber, Ringstrand, Lee, van Buuren, Fried and Willey 7 – Reference Shi, Zhang, Chen and Luo 10 ] and high-power laser experiments[ Reference Kluge, Rödel, Metzkes-Ng, Pelka, Garcia, Prencipe, Rehwald, Nakatsutsumi, McBride, Schönherr, Garten, Hartley, Zacharias, Grenzer, Erbe, Georgiev, Galtier, Nam, Lee, Glenzer, Bussmann, Gutt, Zeil, Rödel, Hübner, Schramm and Cowan 11 , Reference Deng, Zhang, Cao, Chen and Luo 12 ]. In a typical scattering experiment, the X-ray impacts the sample at a small angle and is scattered. The intensity of the scattered wave is measured and recorded by the detector and presented as a scattering pattern. For example, in the dynamic compression experiment of polymer dissociation, nanocrystalline solid particles can be formed and then consolidated into larger particles[ Reference Kraus, Vorberger, Pak, Hartley, Fletcher, Frydrych, Galtier, Gamboa, Gericke, Glenzer, Granados, MacDonald, MacKinnon, McBride, Nam, Neumayer, Roth, Saunders, Schuster, Sun, van Driel, Dppner and Falcone 13 , Reference Kraus, Hartley, Frydrych, Schuster, Rohatsch, Rödel, Cowan, Brown, Cunningham, Van Driel, Fletcher, Galtier, Gamboa, Garcia, Gericke, Granados, Heimann, Lee, MacDonald, MacKinnon, McBride, Nam, Neumayer, Pak, Pelka, Prencipe, Ravasio, Redmer, Saunders, Schölmerich, Schörner, Sun, Turner, Zettl, Falcone, Glenzer, Döppner and Vorberger 14 ]. In the process of nucleation and subsequent phase transformation in such materials[ Reference Schuster, Hartley, Vorberger, Döppner, van Driel, Falcone, Fletcher, Frydrych, Galtier, Gamboa, Gericke, Glenzer, Granados, MacDonald, MacKinnon, McBride, Nam, Neumayer, Pak, Prencipe, Voigt, Saunders, Sun and Kraus 15 ], the average particle size, grain size distribution, particle shape, spacing, particle content and other microstructure characteristics will all affect the morphology and intensity of the scattering spectrum.
The inversion of nanoparticles due to phase transition in extreme conditions is a major challenge. Extracting particle size distribution from the scattering pattern is a typical ill-posed problem. Algorithms such as maximum entropy, renormalization, regularization, the non-negative least squares method and other methods have been widely used to extract the particle size distribution from the scattering data and extensively implemented in software such as Irena, IsGISAXS and McSAS[ Reference Jemian, Weertman, Long and Spal 16 – Reference Breßler, Pauw and Thünemann 20 ]. These algorithms are mainly searching for optimization parameters that satisfy the condition of ${\chi}^2$ = constant, where ${\chi}^2$ describes the degree of correlation of the fitting. Among them, McSAS adopts the Monte Carlo method, which uses rejection sampling for optimization by replacing model contributions in the dataset. At the end of the optimization process, the fitting parameter values from each model in the dataset determine the final size distribution. During the SAXS analysis and the microstructure inversion, it is usually necessary to establish a sample model first, run simulations of the scattering process and compare them with the experimentally observed pattern, and then repeat the process numerous times as well as adjust several parameters until this model is closest to the experimental result. Running simulations for each optimization step is time-consuming and requires considerable computing power[ Reference Gaus, Bischoff, Bussmann, Cunningham, Curry, Juncheng, Galtier, Gauthier, García, Garten, Glenzer, Juncheng, Grenzer, Gutt, Hartley, McBride, Metzkes-Ng, Huang, Hübner, Kraus, Nagler, Nakatsutsumi, Pelka, Prencipe, Nikl, Lee, Ota, Randolph, Rödel, Sakawa, Schlenvoigt, Šmíd, Treffert, Voigt, Schramm, Zeil, Kluge and Cowan 21 ].
With the emergence of fourth generation X-ray free electron lasers, it is possible to quickly image and obtain in situ response of materials, for example, in dynamic shock-compression environments[ Reference He, Rödel, Lütgert, Bergermann, Bethkenhagen, Chekrygina, Cowan, Descamps, French, Galtier, Gleason, Glenn, Glenzer, Inubushi, Hartley, Hernandez, Heuser, Humphries, Kamimura, Katagiri, Khaghani, Lee, McBride, Miyanishi, Nagler, Ofori-Okai, Ozaki, Pandolfi, Qu, Ranjan, Redmer, Schoenwaelder, Schuster, Stevenson, Sueda, Togashi, Vinci, Voigt, Vorberger, Yabashi, Yabuuchi, Zinta, Ravasio and Kraus 22 ]. Large quantities of data, with laser shock drivers reaching repetition rates of up to 10 Hz[ Reference Zastrau, McMahon, Appel, Baehtz, Brambrink, Briggs, Butcher, Cauble, Chen, Damker, Deiter, Eggert, Falk, Fletcher, Glenzer, Göde, Harmand, Higginbotham, Konôpková, Kraus, Liermann, Nakatsutsumi, Pelka, Priebe, Redmer, Schropp, Smith, Sperling, Thorpe and Toleikis 23 ], also pose a demand for rapid inversion of SAXS. In recent years, with the continuous advent of machine learning, it is possible to quickly retrieve scattering images and conduct on-site analysis. In view of the strong mapping ability of artificial neural networks (ANNs), it can be well applied to in situ classification and quantification of scattering images, including grazing-incidence small-angle scattering (GISAS)[ Reference Van Herck, Fisher and Ganeva 24 ], coherent diffraction imaging (CDI)[ Reference Cherukara, Nashed and Harder 25 ], microstructural characterization in 3D samples[ Reference Chan, Cherukara, Loeffler, Narayanan and Sankaranarayanan 6 ], etc. The ability of ANNs to quickly and accurately identify the main characteristics is very important for the rapid characterization of crystal grain distribution, thus having a practical significance for the research in microstructure and phase transformation of dynamically compressed materials.
In this work, we apply a fully connected, dense, feedforward network according to the principle of SAXS to extract the mean grain size and grain size distribution of nanocrystals from in situ SAXS images in experiments, allowing automatic acquisition of microstructure information and avoiding the traditional tedious manual fitting process. Using the trained network, the particle distributions obtained from simulation data are verified to be in good agreement with the theory. Taking a typical nanoparticle transformation experiment as an example[ Reference He, Rödel, Lütgert, Bergermann, Bethkenhagen, Chekrygina, Cowan, Descamps, French, Galtier, Gleason, Glenn, Glenzer, Inubushi, Hartley, Hernandez, Heuser, Humphries, Kamimura, Katagiri, Khaghani, Lee, McBride, Miyanishi, Nagler, Ofori-Okai, Ozaki, Pandolfi, Qu, Ranjan, Redmer, Schoenwaelder, Schuster, Stevenson, Sueda, Togashi, Vinci, Voigt, Vorberger, Yabashi, Yabuuchi, Zinta, Ravasio and Kraus 22 ], we use the network to retrieve the average grain size as well as the grain distribution, and compare it with other methods to ensure that the neural network prediction is meaningful and applicable for SAXS. This network is also suitable for the case of spherical voids in porous materials. The beneficial modifications based on our network are applicable to the arbitrary size inversion of other shapes with density contrast from SAXS, which is of great value for the on-site characterization of materials under dynamic compression.
2 Training the neural network
According to the principle of SAXS, we can establish a fully connected feedforward network that corresponds exactly to our physical phenomena. The dataset with various particle distributions as well as their volume fractions (representing particle concentration) is used as the labels of the network, while the corresponding scattering intensities are used as the input dataset. For the predicted particle distributions from the neural network, the loss function of the training and validation data can be calculated and the network parameters are adjusted to minimize the loss. The process can then be repeated for several epochs until an acceptable loss value is reached.
2.1 Data generation
The dataset for the neural network is generated on the basis of the classical SAXS theory. The expected scattering intensity ${I}_{\mathrm{abs}}$ in absolute units can be defined using the following[ Reference Rödel 26 ]:
where $q$ is the wavenumber, $\varphi$ is the volume fraction of the nanoparticles, 1– $\varphi$ is the volume fraction of the solution, $V$ is the volume of a single nanoparticle, $\Delta {\rho}_{\mathrm{s}}$ is the total scattering length density contrast between solids and solutions and $F(q)$ and $S(q)$ represent the form factor and structure factor, respectively. When assuming spherical nanoparticles in one case, the form factor $F(q)$ can be expressed as follows:
where $R$ is the effective radius of the scatterer. By introducing the repellent potential $U(r)$ of the hard-sphere in the Percus–Yevick closure[ Reference Wertheim 27 – Reference Pedersen 30 ], the structure factor can be described as follows:
We created a dataset of scattering intensity generated by hard-spheres with an effective particle size range of 1–9 nm and a volume fraction range of 0.1–0.5, which corresponds exactly to our physical conditions[ Reference Kraus, Vorberger, Pak, Hartley, Fletcher, Frydrych, Galtier, Gamboa, Gericke, Glenzer, Granados, MacDonald, MacKinnon, McBride, Nam, Neumayer, Roth, Saunders, Schuster, Sun, van Driel, Dppner and Falcone 13 , Reference Schuster, Hartley, Vorberger, Döppner, van Driel, Falcone, Fletcher, Frydrych, Galtier, Gamboa, Gericke, Glenzer, Granados, MacDonald, MacKinnon, McBride, Nam, Neumayer, Pak, Prencipe, Voigt, Saunders, Sun and Kraus 15 , Reference He, Rödel, Lütgert, Bergermann, Bethkenhagen, Chekrygina, Cowan, Descamps, French, Galtier, Gleason, Glenn, Glenzer, Inubushi, Hartley, Hernandez, Heuser, Humphries, Kamimura, Katagiri, Khaghani, Lee, McBride, Miyanishi, Nagler, Ofori-Okai, Ozaki, Pandolfi, Qu, Ranjan, Redmer, Schoenwaelder, Schuster, Stevenson, Sueda, Togashi, Vinci, Voigt, Vorberger, Yabashi, Yabuuchi, Zinta, Ravasio and Kraus 22 ]. For example, we estimated the size of the generated nanoparticles from shock-compressed polymer samples via other diagnostics (such as X-ray diffraction) to be several nanometers, with a volume fraction between 10% and 50%. Considering the possible distribution range of actual grain size in these experiments, we chose particle size distribution between 0.9 and 9.9 nm as the target labels, represented by 100 equally discrete probability values. When creating a random particle size distribution, we selected the composition of three Shulz distributions with random effective radii as the total probability for different particle sizes. To assess the robustness of the network, we artificially added 0–3% noise to the theoretical SAXS intensity data. This is based on the fact that the error of SAXS lineouts obtained on a high-energy X-ray light source is mainly related to the instrument and light source quality, which causes an intensity error of less than 2%[ Reference He, Rödel, Lütgert, Bergermann, Bethkenhagen, Chekrygina, Cowan, Descamps, French, Galtier, Gleason, Glenn, Glenzer, Inubushi, Hartley, Hernandez, Heuser, Humphries, Kamimura, Katagiri, Khaghani, Lee, McBride, Miyanishi, Nagler, Ofori-Okai, Ozaki, Pandolfi, Qu, Ranjan, Redmer, Schoenwaelder, Schuster, Stevenson, Sueda, Togashi, Vinci, Voigt, Vorberger, Yabashi, Yabuuchi, Zinta, Ravasio and Kraus 22 ]. ANNs can generalize well to any particle size distribution by training on this simple data. In addition, the $q$ range that can be detected by an SAXS detector from beamline experiments is about 0.4– $1.05\;{\mathrm{nm}}^{-1}$ . Correspondingly, we selected the same $q$ range of scattering intensity in our ANN dataset, and took 1000 equally discrete intensity values within this range as well as the volume fractions (which can be estimated by comparing static experiments with dynamic experiments) as the input set (see Figure 1 for the input and output parameters). The detailed parameter information in the dataset is shown in Table 1. We set 80% of the data in the dataset as the validation set and the remaining 20% as the testing set.
In order to prevent the slow convergence of features during optimization[ Reference Lecun, Bottou, Orr and Muller 31 ], it is necessary to preprocess and normalize the data, which is an important step of neural network training. The entire dataset was scaled after creating the training-validation databases so that all the input and target features were in the range [0, 1] according to the following:
where $z$ represents the dataset of a certain feature, ${z}_i$ represents a sample of $z$ and max( $z$ ) and min( $z$ ) are the maximum and minimum values of $z$ , respectively. The scaling is undone afterward.
2.2 Compilation and training of the ANN
The compilation of the neural network and the training were performed using the Keras package running the TensorFlow backend[ Reference Chollet 32 ].
We established a fully connected dense feedforward network according to our physical case with a rectified linear unit (ReLU)[ Reference Agarap 33 ] as the nonlinear activation function. The input layer includes 1000 discrete intensity values as well as one volume fraction value, while the output layer contains 100 discrete probability values representing size distribution. The middle three hidden layers have 128, 64 and 32 neurons, respectively. We chose the mean absolute error (MAE) as the loss function in the training and testing process (see Equation (5)). The backpropagation[ Reference Rumelhart, Hinton and Williams 34 ] and the stochastic gradient descent optimization algorithm[ Reference Bottou 35 ] were used to adjust the weights and biases iteratively until the loss function was minimized. In each iteration process, the network calculated the gradient of the batch loss relative to the weight and then updated the weight accordingly:
The ANN was trained along with adjusting the memorization capacity (the number of hidden layers or neurons) to find the optimal network structure, avoiding an underfit and overfit. In each training process, 4680 datasets with more than 4 million trainable parameters were trained.
Figure 2 shows the training and validation loss or accuracy as a function of epoch. The validation loss is very close to the training loss, indicating that although the model is complex, it does not overfit the training data, and has good generalization ability in the verification dataset.
3 Evaluation of the trained network
Based on the trained neural network, the grain distribution can be quickly and reliably retrieved from scattering data. Therefore, the property of the trained network should be evaluated by measuring its performance in a large number of theoretical data.
3.1 Applying the ANN to the theoretical models
Figure 3 depicts the predictions of the trained ANN on several theoretical data. After inputting the theoretical SAXS intensity lineout data with 0–3% noise to the trained ANN, the network can directly give the particle distribution, as shown in the blue histogram in the right-hand column of Figure 3. Aiming at arbitrary particle distribution with various patterns, our predicted particle distribution and the effective radius are in good agreement with the theoretical ones. Conversely, the corresponding SAXS lineout can also be calculated from the predicted distribution, as shown in the left-hand column of Figure 3, which is almost consistent with the original theoretical SAXS lineout in the majority of cases, implying a high reliability in the prediction of arbitrary particle distributions from theoretical data with noise.
However, for simple distributions with small particle radii, the difficulty of fitting increases due to the tiny variation of scattering intensity in the range of $0.4\hbox{--} 1.05\;{\mathrm{nm}}^{-1}$ , as shown in the first panel in the right-hand column of Figure 3. The more complex the intensity curve and the larger the particle radius, the higher the fitting accuracy.
3.2 Applying the ANN to the experiments
In order to evaluate the performance of the ANN on the experimental data, we assess the ANN with the real-time in situ SAXS experimental data measured in dynamic experiments. Five SAXS intensity data of shock-compressed $100\;\mu \mathrm{m}$ polyethylene terephthalate (PET)[ Reference Lütgert, Vorberger, Hartley, Voigt, Rödel, Schuster, Benuzzi-Mounaix, Brown, Cowan, Cunningham, Döppner, Falcone, Fletcher, Galtier, Glenzer, Garcia, Gericke, Heimann, Lee, McBride, Pelka, Prencipe, Saunders, Schölmerich, Schörner, Sun, Vinci, Ravasio and Kraus 36 ] at various probing times under approximately 100 GPa were obtained at the Linac Coherent Light Source (LCLS) laser facility. The details of the experiment can be found in previous work[ Reference He, Rödel, Lütgert, Bergermann, Bethkenhagen, Chekrygina, Cowan, Descamps, French, Galtier, Gleason, Glenn, Glenzer, Inubushi, Hartley, Hernandez, Heuser, Humphries, Kamimura, Katagiri, Khaghani, Lee, McBride, Miyanishi, Nagler, Ofori-Okai, Ozaki, Pandolfi, Qu, Ranjan, Redmer, Schoenwaelder, Schuster, Stevenson, Sueda, Togashi, Vinci, Voigt, Vorberger, Yabashi, Yabuuchi, Zinta, Ravasio and Kraus 22 ]. The in situ SAXS lineout data were used as input of the network, then the particle distribution can be predicted by the trained ANN. As shown in Figure 4, the predicted distributions at various probing times are compared with those obtained from an analytical method (applying the non-negative least squares method)[ Reference Rödel 26 ] and the Monte Carlo method[ Reference Pauw, Pedersen, Tardif, Takata and Iversen 19 , Reference Breßler, Pauw and Thünemann 20 ]. The left-hand panel reveals the particle radius distribution obtained by the three methods, while the right-hand panel exhibits the corresponding fitting lineouts. Interestingly, the three methods consistently point out that the mean particle size gradually increases with time in the shock-compressed PET. It can be seen that the mean size predicted by the ANN is relatively close to that of the Monte Carlo method, and both of these methods can obtain arbitrary size distribution and find a more discrete distribution at the last two probing times. As an analytical model, a Schultz distribution[ Reference Kotlarchyk and Chen 37 , Reference Als-Nielsen and McMorrow 38 ] is assumed with the polydispersity $p=\sigma$ / $R\approx 0.1$ , resulting in systematically larger effective radius at latter times than that of the other two methods. In fact, due to the complexity of the dynamic compression process, the nanoparticles generated from the sample are usually too discrete and too arbitrary to be simply represented by a certain distribution. Therefore, the acquisition of arbitrary distribution from raw SAXS data will better reflect the actual situation, as predicted by the ANN and Monte Carlo method. Of course, in the actual experimental process, one still needs to azimuthally integrate the original 2D scattering pattern as well as subtract the backgrounds, which requires batch processing on written codes and usually takes a few minutes to complete. Afterwards, among the three methods, the ANN can invert the particle distribution from the scattering data with a few milliseconds of computing time on a standard laptop, while the Monte Carlo method takes 10–30 minutes and the analytical method requires even more time per shot because it often requires manual input to achieve good convergence, and therefore poses challenges when scaled to high-repetition-rate experiments or online analysis. Comparatively, in the experimental process of compact beam time from raw images to size distribution, the ANN is very suitable for in situ data analysis, which is of great significance for the promotion of physical experiments and timely parameter adjustment. In further research, the process parameters of the Monte Carlo method, such as the local volume fraction and scattering length density, can serve as intermediate inputs for the ANN to finely tune the network. This kind of physics-informed neural network (PINN) is very promisingly beneficial for improving the accuracy of size distribution inversion from experimental data.
Other aspects of actual experiments, such as the bandwidth and the high harmonics of the probe light spectrum, can also affect the size distribution inversion from SAXS[ Reference Chen and Luo 39 ]. For the shock-compression phase transition described above, the accuracy of the experiment is not that high and the influence of the spectral bandwidth and high harmonics can be ignored. Of course, in some more precise SAXS inversion problems, the influence of the spectrum cannot be ignored. In these cases, the ANN can be constructed through the following methods: directly input the scattering spectrum and particle size distribution obtained from the specified spectrum into the ANN for training, or add parameters representing the spectral features to the ANN for training.
4 Conclusions
To conclude, in view of the request for rapid analysis of generous SAXS data at large-scale laser facilities, in this work, we apply a dense forward network to inversely retrieve the mean grain size and particle distribution from SAXS data, allowing automatic acquisition of microstructure information without tedious manual fitting in traditional methods. Our trained network performs well in grain distribution prediction on experimental data with single-species particles. The predicted results have good consistency with the Monte Carlo method, which also inversely retrieve the arbitrary distribution and is more efficient.
Since the scattering intensity comes from density contrast, theoretically, our trained network can also be applied to the case of void distribution with spherical shapes in porous materials, but its effectiveness still needs further experimental verification. In further work, two possible improvements can be considered if this network is to be applied to non-spherical particles or voids. One is that the network needs to be retrained for particles or voids of specific shapes, and the method of constructing and training the network can be consistent with this work. A more universal approach is to add additional factors representing the shape of particles to the input of the network on the basis of this method, and then retrain the network. In short, the powerful advantages of the ANN can be utilized in the study of dynamic physical processes by adding scattering shape parameters, optimizing model structures, etc. In addition, improvements in the diagnosis of the experiment, such as increasing the scattering angle range and improving the signal-to-noise ratio, can also enhance the accuracy of the results obtained from the ANN model.
Acknowledgements
The authors are grateful for the use of the experimental data. This work was supported by the Helmholtz Association under VH-NG-1141 and ERC-RA-0041. Z.H. acknowledges the support from the National Natural Science Foundation of China under Grant No. 12304033 and the financial support from China Scholarship Council.