Quick start

Here is a short introduction to the program general usage; even though no detailed information is given about specific functionality, it is probably a good place to start to get acquainted with the software user interface.

After downloading the software archive for your platform and expanding it in a directory of your choice, start the program by double clicking on the ReX executable icon. After the splash screen, the welcome wizard is shown (ReX version >= 0.9.3) providing a few options to get started with powder data analysis.

For this short introduction, we are going to choose the “New analysis wizard”; clicking the corresponding button will bring us to the first page of the analysis setup wizard.

For now, just two options are available, namely Powder diffraction analysis and Powder diffraction simulation; make sure the first one (the default) is selected and click next. The following wizard page will ask to select some powder diffraction data to work on; since we just started the software, no data is available in the project tree and we need to load it from disk. Before doing that, make sure to have downloaded the examples package and uncompressed it in a directory of your choice. After that, click the load data button located to the right of the data selection combo; this will open the data import dialog.

Select the “zincite.dat” powder pattern located in the quick_start folder of the examples package; alternatively, you may just drag and drop the file on the data selection wizard page. A confirmation dialog will appear; make sure the option “Add to current dataset” is selected and click OK, loading the powder pattern and making it visible in the dataset plot window. The Powder diffraction analysis wizard typically continues with the detailed setup of the instrument and sample models, but for the sake of this short tutorial we are going to stop it here and configure the rest manually. To do so, simply click the “Finish” button on the bottom of the wizard page. At this point, a standard powder diffraction analysis setup is configured with a single powder diffraction pattern in the default dataset. Please note that prior to ReX 0.9.3, when no welcome screen and analysis wizard were present, this was the default configuration available on program startup.

By default, the standard perspective (window layout) is shown, displaying the project tree view in the top left area, the properties view in the bottom left and the data plot view on the right. In general, all views can be resized by dragging the border between two adjacent views; specific views (e.g. the 3d structure view) can be shown or hidden as preferred. If needed, the default view layout can be restored by selecting the View->Reset Perspective menu.

The project view is the main entry point for the analysis definition. In our case, the wizard configured for us a default analysis of type Powder diffraction (highlighted in bold in the project tree) whose setup depends on three additional project nodes, namely an Instrument , a Sample and a Dataset :

The instrument and the sample objects taken together represent the powder diffraction model definition, which is used to compute the calculated pattern; the dataset object, on the other side, contains the experimental data. In a typical powder diffraction analysis,  the parameters defining the model are changed in such a way to minimize the difference between the experimental and the calculated pattern.

Two other important views in the ReX user interface are the Properties view and the Parameters view, which show, respectively, the basic properties of the currently selected project element and its parameter tree, if available. Both the properties and the parameters view are context sensitive, that is their content is based on the actual selection in the project view; as an example, select the instrument node in the project tree view to see its properties displayed:

Then, click on the Parameters tab located on the top right: this displays the parameter tree relative to the instrument node (you may need to click on the instrument node twice to display only its parameters):

As a general rule, the properties view displays general, high-level properties of the selected object (e.g. labels, general outlines, physical models, etc), while the parameters view specifically collects their optimizable, numerical-valued properties.

Now we will show in a little more detail how the program’s simulation / optimization engine works. First of all, let’s take a look at the experimental data we just loaded during the wizard; this is a diffraction pattern collected on a pure ZnO powder using a Bragg-Brentano instrument with standard Cu Ka radiation (original source: IUCr CPD Round Robin on Quantitative Phase Analysis). Please note that apart from the wizard configuration, there are several additional ways to load diffraction data into the program, e.g. using the “Load data” command from the program File menu or just dragging and dropping supported data files on the dataset plot window. If a Dataset object is already present in the project tree, you may also import additional patterns to that dataset by selecting it and then selecting the “Load Experimental Data” command from the context menu which shows by clicking the right mouse button (or the equivalent on your platform):

Now, after expanding the Dataset object in the project tree make sure the “zincite_0” pattern subnode is selected so that it is correctly displayed in the dataset plot view.

By default, experimental data is displayed in red, with data points connected by straight lines; the calculated pattern is shown in black (initially just a straight baseline, when no structural data is present in the sample model), while the error line (difference between experimental and calculated data) is shown in violet. You may change the default graphic options by clicking on the “Options” sub-menu from the toolbar located on the top right:

quick_start_plot_options

From the same toolbar, additional graphical configuration options are directly available, as the x and y scale configuration as well as the visibility for single plot elements .

For simplicity’s sake, we are going to reduce the active computation range of the pattern. Make sure the Properties view is visible and that the “zincite_0” pattern is selected in the project tree so that the active pattern data interval is displayed. In the “Active” data subpanel, type 25 and 85 for the X min and X max values, respectively:

The dataset plot gets updated with the new data range. It may also be useful to change the scale of the y plot axis to display the square root of the intensity counts, to better visualize the details in the high angle region of the pattern; to do so, select the “Y axis scale” menu located on the top of the dataset plot view and choose the “square root” option; the plot view is updated accordingly.

quick_start_dataset_plot_02

Now, we are going to modify the diffraction model to try to obtain any meaningful simulated diffraction signal. In general, both the instrument model and the sample model have to be correctly defined to simulate the diffraction experiment; for this simple example, we will disregard a rigorous instrument calibration, which in general is fundamental for obtaining quantitative results. We will thus modify just the sample model by adding to it a single phase representing the Zinc Oxide crystal structure; to do so, right click on the “Sample” object in the project tree, then select the “Load Phase” command import_structure from the context menu in the main toolbar. Alternatively, select the “Load Phase” item from the popup menu which shows up after right-clicking on the Sample object.

From the same “quick_start” folder load the  ZnO.cif structure file; after a confirmation dialog, a corresponding ZnO phase is added to the sample. Now click on the “Update model” button  located on the main program toolbar; the plot window is updated with the predicted diffraction pattern (in black), the error bar (violet) and the reflection marks at the bottom.

It can be clearly observed that the simulated pattern loosely approximates the experimental data: calculated and experimental peak positions corresponds quite closely, while the pattern background and peak intensities are very off.
In this simple case, we can try to manually modify the parameters defining the model to better approximate the data; to do so, make the Parameters view visible by clicking on top of the “Parameters” tab near the properties view; locate the “Scale factor” parameter and modify its value from the default (1.0) to 20.

Again, please notice that the parameters view is context sensitive, that is, its content depends on the active selection in the project tree view; so if you can’t visualize the Scale factor parameter, make sure to click on the Instrument object in the project tree to display all the instrument-related parameters.
Click on the “Update model” button  again to visualize the updated diffraction model:

quick_start_dataset_plot_04

The global instrument scale factor is not generally an interesting parameter to modify or optimize, since single phase scale factors are generally considered. In addition, modifying the parameters by hand obviously does not represent the usual analysis practice, except in particular cases. For real world analyses we can use ReX’s non-linear least squares optimization engine, based on the Levenberg-Marquardt algorithm. To automatically optimize the model and refine the value of one or more parameters in the context of the currently defined Rietveld analysis, it is sufficient to enable their corresponding checkboxes in the parameters view. As an example, we are going to refine the general intensity scale factor and the background parameters. First, select the Scale factor parameter again and enable its checkbox:

Then, scroll down a bit in the parameter list and locate the “Background (polynomial)” parameter group; check it to enable the optimization of all the polynomial coefficients.

Now, start the analysis by clicking on the “Run default analysis” button located on the main toolbar. After a few iterations the refinement will converge and the analysis properties panel will be automatically displayed, showing the optimization results:

Additional information can be obtained in the Log and Results views, which are shown below the Dataset plot view. The figure of merits of this rough refinement are obviously quite poor, mainly because we didn’t take into account a correct instrument calibration; this is especially noticeable from the poor fit of the reflections peak shapes.

You may try to experiment a little bit by manually changing instrument and sample parameters, and see how the fit is affected, or by optimizing them automatically. As a general rule, the automatic optimization works best when only a few parameters are enabled at a time, and their starting values are reasonably close to the physically “correct” values; trying too optimize too many parameters at once, or parameters whose values are too far off may lead to instabilities in the optimization algorithm and/or location of false minima. This particularly holds for properties which have non-linear effects on the diffraction model, as atom coordinates, displacement factors, etc. These topics are discussed more deeply in the advanced tutorials.