Quick start

This is a quick introduction to the program general features; 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, start ReX by double clicking on the program icon.The default perspective 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 needed. 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. By default, a project starts with one single Rietveld-type analysis, visualized by an analysis node, which is related to other three sub-nodes, namely an Instrument node, a Sample node and a Dataset node:




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 fundamental views in ReX are the Properties view and the Parameters view, which show, respectively, the basic properties of the selected 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 and / or complex properties of the selected object (e.g. labels, general outlines, high level physical models, etc), while the parameters view specifically collects their optimizable, double-valued properties.

Now we will show in a little more detail how the program’s simulation / optimization engine works. First of all, download the quick start tutorial example data and unzip the archive in a directory of your choice. Next, import the “zincite.dat” diffraction pattern by selecting the “Dataset” object in the project tree; then click on the “Load Object” menu item from the context menu showing in the main toolbar. Alternatively, you can also right click on the “Dataset” object and select the same command from the corresponding popup menu:




After a confirmation dialog, the imported powder pattern is displayed in the plot view. This is a ZnO diffraction pattern collected on a Bragg-Brentano instrument with Cu Ka radiation (original source: IUCr CPD Round Robin on Quantitative Phase Analysis).




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 located on the toolbar the top right:




For simplicity’s sake, we are going to reduce the active computation range of the pattern. Make sure the Properties view is visible; after expanding the parent Dataset object, select the “zincite_0” pattern; the active pattern data interval is displayed in the properties view. In the “Used” 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 squared roots 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.




Now, we are going to modify the experiment model by adding a crystal phase to the sample. 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 can just load the Zinc Oxide crystal structure file from the tutorial directory and see how the simulated pattern gets modified.

To do so, right click on the “Sample” object in the project tree, then select the “Load Phase” item 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 tutorial directory load the  ZnO.cif structure file; 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 seen that the simulated pattern loosely approximates the experimental data: calculated and experimental peak positions closely corresponds, while the pattern background and peak intensities are clearly wrong.
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.




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:




Obviously, modifying the parameters by hand does not represent the standard practice, except for very trivial cases. For real world analyses ReX offers a 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 “Start optimization” button located on the main toolbar. The analysis panel is automatically displayed, showing the optimization progress:




The refinement should converge after one or more iterations; finally, the plot window gets refreshed with the updated fit:




This concludes the quick start tutorial. You may try to experiment a little bit by manually changing 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, as trying too optimize too many parameters at once 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.