electronic reprint Journal of

Applied Crystallography ISSN 0021-8898

Editor: Gernot Kostorz

GenX: an extensible X-ray reflectivity refinement program utilizing differential evolution ¨ Matts Bjorck and Gabriella Andersson

Copyright © International Union of Crystallography Author(s) of this paper may load this reprint on their own web site or institutional repository provided that this cover page is retained. Republication of this article or its storage in electronic databases other than as specified above is not permitted without prior permission in writing from the IUCr. For further information see http://journals.iucr.org/services/authorrights.html

J. Appl. Cryst. (2007). 40, 1174–1178

¨ Bjorck and Andersson

¯

Reflectivity refinement program

computer programs Journal of

Applied Crystallography

GenX: an extensible X-ray reflectivity refinement program utilizing differential evolution

ISSN 0021-8898

Matts Bjo ¨rck*‡2 and Gabriella Andersson Received 23 May 2007 Accepted 14 September 2007

# 2007 International Union of Crystallography Printed in Singapore – all rights reserved

Department of Physics, Uppsala Universitet, Box 530, SE-751 21, Uppsala, Sweden. Correspondence e-mail: [email protected]

GenX is a versatile program using the differential evolution algorithm for fitting X-ray and neutron reflectivity data. It utilizes the Parratt recursion formula for simulating specular reflectivity. The program is easily extensible, allowing users to incorporate their own models into the program. This can be useful for fitting data from other scattering experiments, or for any other minimization problem which has a large number of input parameters and/or contains many local minima, where the differential evolution algorithm is suitable. In addition, GenX manages to fit an arbitrary number of data sets simultaneously. The program is released under the GNU General Public License.

1. Introduction Nowadays, X-ray reflectivity is a standard tool for examining thin layered materials such as semiconductor heterostructures, metallic multilayers and thin film systems in general. Knowledge of the structural parameters, such as interface roughness, density and thickness, is vital for the understanding of other sample properties. However, the refinement of these parameters is cumbersome using ordinary fitting techniques such as the simplex method. This type of fitting usually requires a large user effort to refine the starting guess manually in order to get close enough to the solution for the optimization to converge. During the last decade, an alternative route to the traditional optimization algorithms for X-ray scattering has evolved, namely the genetic algorithms. A number of articles have reported the suitability of various genetic algorithms for the fitting of scattering problems (Wormington et al., 1999; Feng & Dong, 2006) and for reflectivity in particular (Ulyanenkov et al., 2000; Ulyanenkov & Sobolewski, 2005; Wormington et al., 1999; Politsch & Cevc, 2002). The main advantage of using genetic algorithms is that they avoid quite effectively being trapped in local minima, which are characteristic of reflectivity refinement. Also, they are more efficient than Monte Carlo and direct search algorithms, since they take advantage of the values of previous function evaluations. In addition, they manage multidimensional optimization efficiently and are easy to implement in computer programs. Genetic algorithms are nowadays usually included in most commercial X-ray reflectivity refinement software (for example, PANalytical X’Pert Reflectivity, Bruker AXS LEPTOS, Bede REFS). However, these programs are usually aimed more at the commercial market than for the use of scientists. As scientists are more involved in the study of new phenomena, where standard models might not be applicable, the software demand is different. For example, new sample models might need to be developed and tested, or the old models might need to be changed. Also, the use of different particles, such as neutrons, might be necessary to resolve the structure. In view of these demands, we have developed a flexible and easily extensible refinement program, GenX, using the differential evolution algorithm ‡ Present address: Swiss Light Source, Paul Scherrer Institut, 5232 Villigen PSI, Switzerland.

1174

(Storn & Price, 1997). This is a genetic algorithm which has been shown to be efficient for fitting various X-ray scattering problems (Wormington et al., 1999). The aim of the program is to have a graphical user interface for ease of operation, while at the same time allowing users to extend it with their own models and to modify standard models. In this article we present our implementation to meet these needs. It should be emphasized that the program is not limited to fitting X-ray reflectivity data. For example, models for refining neutron reflectivity are also available. In addition, other problems could also benefit from using GenX for refinement.

2. Technical details GenX has been developed in the programming language Python under Windows. However, the Python environment and its extensions are available for a number of operating systems, namely Windows, Linux/Unix and Mac OSX. GenX has so far been used successfully under Windows and Linux. The following components and versions need to be installed before running GenX: (a) Python > 2.3.5, http://www.python.org; (b) SciPy > 0.5, http://www.scipy.org; (c) numpy > 1.0, http://numpy.scipy.org; (d) WxPython > 2.6, http://www.wxpython.org. These distributions are completely free and their homepages are included in the list above. After installation, the GenX software package is extracted. The file GenX.py is run with the Python interpreter. Under Windows it is enough to double click on the file. More detailed comments on the installation and the different files included in the distribution can be found in the manual and the ‘readme’ files. For Windows users it is recommended to use Python Enthought Edition, http://code.enthought.com, which contains the necessary packages.

3. Algorithms 3.1. Differential evolution

Like most evolutionary algorithms, the differential evolution algorithm consists of the creation of a number of individuals, the parameter vectors. This population is then changed according to a

doi:10.1107/S0021889807045086

electronic reprint

J. Appl. Cryst. (2007). 40, 1174–1178

computer programs

Figure 1 The creation of the trial vectors in the differential evolution algorithm.

certain scheme to create new individuals that are better fitted than the previous population, which is called a generation. The procedure is repeated until a stopping criterion is fulfilled. In GenX, the maximum number of generations is used as the stopping criterion. The creation of a test population is shown schematically in Fig. 1. First, two different parameter vectors are chosen at random and their difference taken. This difference is scaled with the mutation constant km . The new vector is added to the so-far-best vector, denoted by the flag ‘best’. To create the test vector, the elements of the original parameter vector are exchanged for those of the newly created vector. This is done with a probability described by the crossover constant, kr . The same procedure is then applied to every parameter vector in the parent population. Then, each member of the test population is compared with the parent population and the fittest, i.e. most suitable, parameter vector is chosen to proceed to the next parent population. 3.2. X-ray and neutron reflectivity

A brief statement about the algorithms used to calculate the X-ray and neutron reflectivity will be made in this section. Since the models presented here are free standing from the fitting part of the program, it is possible to incorporate new models if necessary. The simulations of specular X-ray reflectivity are made with the Parratt algorithm (Parratt, 1954). The roughness is assumed to have a Gaussian distribution and is included as corrective factors to electric field amplitudes at the interfaces according to the Nevot–Croce model (Tolan, 1999). The Henke tables (Henke et al., 1993; http://wwwcxro.lbl.gov/optical_constants/) are used for calculating the refractive indices of the materials. The present implementation of the Parratt algorithm has been validated against other X-ray reflectivity packages such as IMD (Windt, 1998) and WinGixa (Parratt, 1954; de Boer, 1991). Also included in the GenX distribution is a model for calculating diffuse scattering from a layered material using the distorted-wave Born approximation (DWBA). The algorithm for calculating the diffuse scattering from a multilayer can be found in several papers (Kondrashkina et al., 1997; Schlomka et al., 1995; Pape et al., 1998). The effect of interdiffusion on the diffuse scattering has been included according to Pape et al. (1998). The correlation function used is (Ming et al., 1993; Tolan, 1999)    Ci;j ðRÞ ¼ i j exp ðjRj=Þ2h exp jzi;j j=? ;

4. Program organization The use of a programming language like Python is vital for making a portable easily extendable program. This is largely due to its objectoriented syntax and scripting capabilities. In addition, Python has a large package repository, with packages for numerical computing and graphical user interfaces (GUIs). In order to make the program extendable it has been written in modules, separating the GUI from the underlying physical models and fitting algorithms. A graphical representation of the organization of the program can be seen in Fig. 2. In Fig. 2, the grey square named GenX represents the main program and the white squares inside represent the different modules of the program. Thus, the action of loading the data and defining which parameters to fit is handled from within the GUI. The fitting algorithm, Differential Evolution, is controlled from the GUI as well. However, the definition of the model to fit is completely separate from the main program and consists of a Python script file loaded dynamically during execution. For the X-ray reflectivity models supplied with the program there are separate free standing libraries, Model Library, which are loaded from the user script where the definition of the sample is made. In practice, this implies that the user can modify or create new physical models and use these for fitting data with GenX without having to resort to the more difficult task of manipulating the GUI. Fig. 3 shows the layout of the GUI. The main window shows the data and the simulation. In addition, the main window contains folders to show the progress of the fitting. One folder shows the figure of merit as a function of generations. Another folder is for viewing

ð1Þ

where the indices i and j refer to the respective layers, h is the jaggedness parameter, zi;j is the distance between interfaces i and j,  is the in-plane correlation length, ? is the out-of-plane correlation J. Appl. Cryst. (2007). 40, 1174–1178

length, and  refers to the roughness of the interface indicated by the subscript. This model, excluding interdiffusion, has been successfully tested against Sergey Stepanov’s X-ray Server (http://sergey.gmca. aps.anl.gov/). For neutron reflectivity without magnetic contrast, the calculation uses the Parratt algorithm (Parratt, 1954) described above. For nonspin-flip neutron reflectivity with magnetic contrast, the program also uses the Parratt algorithm, as described by Penfold & Thomas (1990). It is also possible to calculate the neutron reflectivity in the case of spin-flip reflectivity using the matrix method (Blundell & Bland, 1992). It should be stressed that the figure-of-merit function, which describes how well the model fits the measured data, is of vital importance for any fitting algorithm. For reflectivity experiments, the measured and simulated data are usually compared on a logarithmic scale (Tolan, 1999; Wormington et al., 1999). However, the choice of figure-of-merit function depends on the class of problem to be fitted, and care must be taken to use a suitable function.

Figure 2 The different modules in the program. Note that the Model Library is free standing.

Bjo¨rck and Andersson

electronic reprint



Reflectivity refinement program

1175

computer programs the spread of the population. Lastly, there is one folder for viewing the dependence of the figure-of-merit function on one parameter. The parameter spreadsheet is used as input for the parameters to fit, to define their minimum and maximum allowed values, and as output/input for the best values and the errors in the parameters as obtained from the fitting algorithm. The smallest window is used to load and process the raw data to be fitted. The processing is made by typing a suitable Python expression. In addition, the program allows multiple data sets to be loaded and fitted simultaneously. The editor window is used for writing a script to define the sample structure and the Sim function.

5. Program use The input for GenX consists of three parts: loading of the data, definition of the simulation through a script, and definition of the parameters to fit. First, the experimental data to be fitted have to be loaded. This is Figure 3 accomplished through the GUI, Fig. 3(d). A screenshot of the GUI for GenX showing the different windows: (a) the editor, (b) the main window, (c) the The data have to be in columnar ASCII parameter spreadsheet, and (d) the window for loading data. format. Second, the model of the sample has Layers is a list of the layers building the stack and Repetitions is to be defined, which is done by writing a Python script where the the number of repetitions of the stack. In the same manner, the stacks sample is created by defining the different layers. An example for an are arranged into a sample in the following manner: Stacks contains [Fe/Pt] multilayer with 25 repetitions is shown below. a list of the stacks in the sample, Ambient defines the ambient media and Substrate defines the substrate. Next, an instrument object is created, consisting of the wavelength of the radiation (Wavelength), the incident intensity (I0) and the units of the data (Coordinates) where 1 corresponds to the angular space in degrees and 0 corre˚ 1. Lastly, the function to simulate the sponds to reciprocal space in A data (Sim) is created with the data as input. This function calls the SimSpecular function of the sample and returns the calculated intensity. Finally, the different parameters to be fitted have to be defined. This is done through the GUI (Fig. 3c), where each parameter has a function associated with it. In the ModelInterdiff library, the member variable of each object has an associated function. These functions follow the syntax ½objectName:set½Varname, where the variable name has its first letter capitalized. To refine the thickness of the Fe layer, the input would be MLFe:setD. Note that the use of functions allows for parameter coupling and the introduction of userdefined parameters. For example, the thickness of the repetition length and the thickness of one constituent can be used instead of the individual thicknesses in the example above. Using this approach usually increases the speed of convergence.

6. Examples of results In the first line the model to use (ModelInterdiff) is imported. Then the refractive indices (nFe; nPt) of the materials used are calculated. The layers are defined with their respective parameters: the refractive index, n, the thickness of the layer, d, the roughness, sigmar, and the density of the material relative to the defined refractive index, reldens. The layers are arranged into stacks, i.e. multilayers, which have the parameters Layers and Repetitions.

1176

Bjo¨rck and Andersson



This section will present some examples of the results obtained with GenX. The details of the growth can be found elsewhere (Andersson et al., 2007). In order to improve the growth, a buffer consisting of a thin layer of Fe followed by a Pt layer was grown prior to the deposition of the multilayer. The multilayer had 25 repeats of Fe and Pt. The nominal values and the structure are shown in Table 1. The X-ray reflectivity of this sample was measured on a Bruker D8 with

Reflectivity refinement program

electronic reprint

J. Appl. Cryst. (2007). 40, 1174–1178

computer programs Table 1 The nominal and refined values of the parameters for the Fe/Pt multilayer. Each layer is denoted by its composition and by whether the layer is in the multilayer (ML) or in the buffer (Buf). d denotes the thickness of each layer and  the roughness of the top interface of each layer. The values inside parentheses denote the errors of the refined parameters. Parameter

˚) Nominal d (A

˚) Refined d (A

˚) Refined  (A

Ambient Top Pt ML Fe ML Pt ML Fe Buf. Pt Buf. Fe Substrate

— 15.7 11.4 15.7 11.4 39.2 5.7 —

— 16.0 11.1 16.1 11.1 43.2 3.7 —

— 2.1 (0.1, 18) 3.4 (0.2, 0.6) 2.6 (0.1, 0.1) 3.4 (0.2, 0.6) 2.5 (0.4, 0.4) 0.09 (0, 1.3) 0.08 (0, 1.6)

(0.4, 0.3) (0.3, 0.7) (0.7, 0.3) (0.3, 0.7) (0.6, 0.9) (1, 0.9)

Figure 5

Cu K1 radiation, using a Go¨bel mirror and Ge beam compressor as primary optics and a slit as secondary optics. To simulate the data, a Gaussian was convoluted with the calculated values to simulate the finite resolution of the instrument and a footprint correction, over-illumination at small incident angles, was included in the calculations (Gibaud et al., 1993). Also included in the simulations was an additional layer of Pt at the top, denoted Top Pt in Table 1. This can be thought of as a way of modelling that the top layer is different with respect to both roughness and structure. The refined value of the absolute logarithmic figure-of-merit function used was 0.094. The measured data and the best fit can be seen in Fig. 4. The refined values are shown in Table 1 and they are in good agreement with the nominal values. The errors stated in the table correspond to a 5% increase in the optimal figure of merit. It should be noted that the substrate roughness and the roughness of the top layer are difficult to refine, as seen from the error bars. Fig. 5 presents the diffuse reflectivity from the sample described above. Rocking curves, ! scans, were made around the two first Bragg peaks. In addition, a longitudinal 2 scan measurement was made with an offset of 0.5 . Since the simulation of off-specular data is time consuming (one simulation of the three scans shown in Fig. 5 takes about 1.5 min to calculate), the data were fitted manually. Solid lines represent the simulation and circles the measured data. For the ˚ , the simulations shown, the in-plane correlation length was  = 20 A jaggedness was h = 0.25 and the out-of-plane correlation length was ˚ . The thicknesses and the total amount of roughness and ? = 350 A

Rocking curves around the first and second Bragg peak of the Fe/Pt multilayer. The inset shows a longitudinal 2 scan offset by 0.5 .

interdiffusion were taken from the refinement of the specular data. 2 2 The relative amount of interdiffusion, int =tot ¼ 0:85, was used to reproduce the measured data. The deviations around the specular component in the rocking curve are due to figuring (e.g. bending or mosaicity) of the sample. However, the more pronounced deviation seen in the inset is probably due to an oversimplified model for the vertical correlations of the interfaces. A more complete model should include different correlations between different interfaces and possibly also a correlation frequency dependence.

7. Conclusions Compared with normal fitting routines, the use of the differential evolution algorithm has had a great impact on the refinement of X-ray reflectivity data. The speed of refinement has become greater, and the certainty in the refined parameters has also been improved, partly thanks to the inclusion of error bars on each parameter. One considerable advantage compared with previously existing programs is the modularity, which facilitates the implementation of new models where the underlying physics can be parameterized instead of the method-specific parameters. Examples of this include modelling of non-independent interfaces by slicing the layers into very thin sublayers and fast refinement of the concentration of individual atomic species in an alloy. The flexibility is largely due to the scripting capabilities of the model definition. Another capability that has proved valuable is the possibility of fitting multiple data sets. For example, reflectivity patterns collected under different circumstances, e.g. varying temperature or energy or using different probes, can be fitted simultaneously with the same model.

8. Program distribution GenX is freely available from the authors under the GNU General Public License (GPL). A webpage (http://genx.prog.googlepages. com/) exists for the distribution of the program. The package contains the Python source code, example files for fitting and the manual for the program. Figure 4 An example of refinement of a Fe/Pt multilayer. The circles are the experimental data and the solid line is the best fit. The inset shows an enlarged region with the Kiessig fringes visible.

J. Appl. Cryst. (2007). 40, 1174–1178

The authors would like to express their gratitude toward David Eastwood and Andrew Wildes for their interest in the program, as Bjo¨rck and Andersson

electronic reprint



Reflectivity refinement program

1177

computer programs well as toward Adrian Rennie for valuable discussions. The Swedish Research Council (VR) is acknowledged for financial support.

References Andersson, G., Bjo¨rck, M., Lidbaum, H., Sanyal, B., Chacon, C., Zlotea, C. & Valizadeh, S. (2007). J. Phys. Condens. Matter, 19, 016008. Blundell, S. & Bland, J. (1992). Phys. Rev. B, 46, 3391–3400. Boer, D. de (1991). Phys. Rev. B, 44, 498. Feng, Z. J. & Dong, C. (2006). J. Appl. Cryst. 39, 615–617. Gibaud, A., Vignaud, G. & Sinha, S. K. (1993). Acta Cryst. A49, 642–648. Henke, B., Gullikson, E. & Davis, J. (1993). Atom. Data Nucl. Data Tables, 54, 181–342. Kondrashkina, E., Stepanov, S., Optiz, R., Schmidbauer, M., Kler, R., Hey, R., Wassermeier, M. & Novikov, D. (1997). Phys. Rev. B, 56, 10469–10482.

1178

Bjo¨rck and Andersson



Ming, Z., Krol, A., Soo, Y., Kao, Y., Park, J. & Wang, K. (1993). Phys. Rev. B, 47, 16373–16381. Pape, I., Hase, T., Tanner, B. & Wormington, M. (1998). Physica B, 253, 278– 279. Parratt, L. G. (1954). Phys. Rev. 95, 359. Penfold, J. & Thomas, R. (1990). J. Phys. Condens. Matter, 2, 1369–1412. Politsch, E. & Cevc, G. (2002). J. Appl. Cryst. 35, 347–355. Schlomka, J., Tolan, M., Schwalowsky, L., Seeck, O., Stettner, J. & Press, W. (1995). Phys. Rev. B, 51, 2311–2321. Storn, R. & Price, K. (1997). J. Glob. Optim. 11, 341–359. Tolan, M. (1999). X-ray Scattering from Soft-Matter Thin Films. Heidelberg: Springer. Ulyanenkov, A., Omote, K. & Harada, J. (2000). Physica B, 283, 237–241. Ulyanenkov, A. & Sobolewski, S. (2005). J. Phys D, 38, A235–A238. Windt, D. (1998). Comput. Phys. 12, 360–370. Wormington, M., Panaccione, C., Matney, K. & Bowen, D. (1999). Philos. Trans. R. Soc. London Ser. A, 357, 2827–2848.

Reflectivity refinement program

electronic reprint

J. Appl. Cryst. (2007). 40, 1174–1178

electronic reprint GenX: an extensible X-ray reflectivity ...

Correspondence e-mail: [email protected]. GenX is a versatile program using the differential evolution algorithm for fitting. X-ray and neutron reflectivity data.

640KB Sizes 2 Downloads 213 Views

Recommend Documents

electronic reprint GenX: an extensible X-ray reflectivity ...
In addition,. GenX manages to fit an arbitrary number of data sets simultaneously. The .... large package repository, with packages for numerical computing and.

electronic reprint Bis(tetraethylammonium)
geometry is the reduction of the SРCuРS angle from 120 as a consequence of the ... (Bruker, 2001); data reduction: SAINT; program(s) used to solve structure: ...

electronic reprint Bis(tetraethylammonium) bis ...
Mo–S3. 2.2089 (5). Mo–S4. 2.2143 (5). S1–Cu1. 2.2136 (5). S2–Cu1. 2.2111 (5). S3–Cu2. 2.2156 (5). S4–Cu2. 2.2101 (5). Cu1–C1. 1.889 (2). C1–N1. 1.137 (3).

electronic reprint Bis(N-phenylpyrazole-1 ...
Author(s) of this paper may load this reprint on their own web site provided that this cover page is retained. ... Correspondence e-mail: [email protected].

electronic reprint Bis(N-phenylpyrazole-1 ...
Author(s) of this paper may load this reprint on their own web site provided that this cover page is retained. ... Correspondence e-mail: [email protected].

MAO - an Extensible Micro-Architectural Optimizer - Research at Google
a long and painful analysis using the available hardware ... Our analysis of several hardware .L3 ...... an accessible low-level optimizer designed to help software.

electronic reprint A second tetragonal polymorph of ...
axis, requiring equal occupancy of two sets of four positions for the S atoms. There is additional disorder as a result of. 8.2(2)% substitution of Cl by Br, arising ...

electronic reprint Full-profile refinement by derivative ...
Applied. Crystallography. ISSN 0021-8898. Received 1 March 2004. Accepted 27 June 2004 й 2004 International Union of Crystallography. Printed in Great Britain · all rights reserved. Full-profile refinement by derivative difference minimization. Leo

electronic reprint Bis(N-phenylpyrazole-1 ...
Data-to-parameter ratio = 16.1. For details of how these key ... 2000); cell refinement: SAINT. (Bruker, 2000); data reduction: SAINT; method used to solve struc-.

electronic reprint Linear and circularly polarized light to ...
investigation of local atomic and electronic anisotropy, as well as local magnetic moment and magnetic order in magnetic systems. In this paper we discuss the ...

An extensible, open source, ODBC and JDBC driver - GitHub
Dec 19, 2013 - Avatica remote JDBC driver. Java client. Avatica. RPC. Protocol. Avatica local JDBC driver. Java VM. Java app. Avatica SPI. Provider X. Client.

electronic reprint Structure of laccase from ...
Jan 1, 2011 - 3(c) and 3(d) show positive peaks of an Fo À Fc electron- .... Kapral, G. J., Murray, L. W., Richardson, J. S. & Richardson, D. C. (2010).

electronic reprint Linear and circularly polarized light to ...
instantaneously circular motion, so that its acceleration is perpendicular to its ..... fluorescence mode using a Ge 15-element solid-state detector. 0.5 mm slits ...

electronic reprint Optimal side-chain packing in proteins ...
graphic apparatus, theory and interpretation, numerical analysis and other ... assigning side-chain rotameric states that maximize the electron density map.

electronic reprint The high-resolution structure of the ...
Republication of this article or its storage in electronic databases other than as specified ..... sodium ion with the participation of the carbonyl O atom of Gly91 in.

electronic reprint Structure of laccase from ...
The data- collection and processing parameters are given in Table 1. The enzyme ... Initial phases were assigned by molecular replacement in. MOLREP (Vagin ...

Xray 4wd-Mini_UserGuide-06212017.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Xray ...

A short manual for GenX
Aug 2, 2007 - less room for hard to find reference errors in the programming. Also, if the right .... If this box is checked the active data set will be plotted and ...

Google XRay: A Function Call Tracing System
Apr 5, 2016 - XRay enables efficient function call entry/exit .... functions to enable function call logging. 3. When tracing is explicitly turned off, we do either ...

the fundamentals of light, shadow and reflectivity By ...
Nov 21, 2014 - Life is constantly creating and also you need some brand-new book ... Of Light, Shadow And Reflectivity By Scott Robertson, Thomas Bertling the very best .... computer system or in your home or even in your laptop computer.

Reprint storage.pdf
Page 1 of 13. 123. Journal of Sol-Gel Science and. Technology. ISSN 0928-0707. J Sol-Gel Sci Technol. DOI 10.1007/s10971-015-3690-8. Long-term ...