Sequential refinement is a way to fit a series of datasets with a set of closely related models that evolve over the course of the measurements. Sequential refinements can be performed in three different ways:
<![if !supportLists]>1. <![endif]>with differing starting parameters for each histogram
<![if !supportLists]>2. <![endif]>with the same starting parameters for each histogram
<![if !supportLists]>3. <![endif]>where the resulting parameters after refinement with a histogram are used as the starting point for the next histogram.
In this example, we will fit a temperature series. Note that it is also possible to fit a temperature series as a combined refinement and, as will be seen, one can still deal with thermal expansion (using the Hydrostatic/Elastic strain terms), but a combined refinement would average the atomic parameters across all temperatures. A sequential refinement allows each data set to determine the atomic parameters; their variation with temperature might be of interest.
If you have not done so already, start GSAS-II. Some of the pictures in this tutorial are from a Mac OSX machine; these illustrate the differences in menu location from Windows/Linux machines.
This example assumes that one is already familiar with use of GSAS-II for simple refinements.
<![if !supportLists]>1. <![endif]><![if !vml]><![endif]>Use the Import/Phase/from CIF file menu item to read the phase information
<![if !supportLists]>2. <![endif]>In the file browser dialog window that is created, change the file type from “CIF file” to “zip archive” and select the SeqTut.zip file (change the file directory to SeqRefine/data). Another dialog window will be created showing all the files in the zip archive. To simplify the view to only show the phase files, type “cif” (or “CIF” – case is ignored) into the filter. Select the CuCr2O4.cif and the CuO.cif input files. Press OK.
(Note that if files CuCr2O4.cif or the CuO.cif already exist, you will be asked to OK overwriting them.)
<![if !supportLists]>3. <![endif]>You will be asked sequentially for the name for each phase. The defaults (CuCr2O4 and CuO) are fine, so OK can be pressed for each question.
<![if !supportLists]>4. <![endif]><![if !vml]><![endif]> Read in the ~7 K dataset (OH_00.fxye) using Import/Powder Data/from GSAS powder data file to open a file browser. Again select “zip archive” and the SeqTut.zip file. Select file OH_00.fxye (use of the filter can again be helpful) and press OK.
You will be shown the first few lines from the file. Confirm that the selected file is correct by pressing OK.
Note that the instrument parameter file with the matching name (OH_00.prm) is read automatically.
<![if !supportLists]>5. <![endif]>Map the phases to the data: After reading in the dataset, a window used to select phases is shown. Select both phases and press OK.
<![if !supportLists]>6. <![endif]><![if !vml]><![endif]>We want to fit the lattice parameters, background, and a phase fraction initially. To illustrate how constraints are used, we will refine both phase fractions, but constrain their sum to be one. To set up the constraint, click on the Constraints item in the data tree and the Select tab/Histogram/Phase menu item, and then click on the Edit/Add constraint menu item.
In the next window use a Filter of scale to make the list shorter and then select the phase fraction for the first phase 0:0:Scale (the second one, 1:0:Scale, would work too)
In the next window, either select the other phase fraction (1:0:Scale) or select all phases (all:0:Scale)
This creates the desired constraint, which forces the sum to be 1. (If the desired sum was different or different multipliers were desired, press the Edit button for the constraint.)
<![if !supportLists]>7. <![endif]>Now we select the variables to refine.
Select the first phase (CuCr2O4) click on the Refine unit cell option (on the General tab). (On a Mac you will likely need to click on the triangle to the left of the Phase entry to “open” the tree item). We also want to refine the phase fraction for this phase, so select the Data tab, click on show PWDR OH_00.fxye Bank 1 and click on the Phase fraction box to cause that to be refined.
Repeat this with the second phase (CuO), by selecting it in the data tree. Then select the General tab and on the Refine unit cell option. We also want to refine the phase fraction for this phase, so select the Data tab, click on show PWDR OH_00.fxye Bank 1 and click on the Phase fraction box to cause that to be refined. Also click on the single microstrain (isotropic) term for this second phase.
<![if !vml]><![endif]>Also select the Background entry under PWDR OH_00.fxye Bank 1 in the GSAS-II data tree (for a Mac, you will likely need to click on the triangle to the left of the entry to “open” the tree item.) Confirm that Background function should already be set as chebyshev and the Refine flag should be checked. Change the No. coeff. to 6 to introduce more background terms.
The histogram scale factor, on the Sample Parameters entry should already be set as refined by default, but you may want to confirm this.
Finally, note that the first broad peak in these data is spurious. It is known to arise from the kapton window in the cryostat used for sample cooling; this was confirmed by collecting data without a sample. We could model this peak, but it is easier to simply drop the data below the first peak at ~5 degrees. To do this, select the Limits entry for PWDR OH_00.fxye Bank 1 and in the Tmin/changed box (to lower left) change it to 4.5. Important: you will have to select the data box (it will turn blue) and then enter the number (4.5) and then click on some other box in the window so that the change registers.
<![if !supportLists]>8. <![endif]><![if !vml]><![endif]>Optional: confirm that the initial parameters have been selected correctly for refinement using the Calculate/View LS parms menu item for the main GSAS-II data ttree window. There will be 15 refined parameters: 0::Ax (x=0,1,2) and 1::Ax (x=0,1,2,4), the reciprocal lattice metric terms for each phase; :0:Scale, the histogram scale factor, :0:Back:x (x=0-5), the six background coefficients and ::constr0 which is generated from the constraints. The phase factors, x:0:Scale (x=1,2) are shown as constrained.
<![if !supportLists]>9. <![endif]>Use the Calculate/Refine main GSAS-II menu item to initiate the refinement. Since the project has not been saved, you will be asked to select a name (and optionally a directory) for the GSAS-II project (.gpx) file. The file name SeqTut.gpx is assumed here. The refinement progresses quickly to a Rw of ~16%.
<![if !supportLists]>10. <![endif]>There are several additional variables that should now be added. One should always refine a sample displacement parameter or perhaps instead a zero correction. In this case, the best choice is to add the Sample X displ. parameter on the Sample Parameters section of histogram PWDR OH_00.fxye Bank 1. (NB: a data range >>90 degrees is needed before the Sample Y displ. term can be included). Note that since this instrument is very well characterized, there is no need to refine any of the instrumental terms.
<![if !vml]><![endif]>Selecting the PWDR OH_00.fxye Bank 1 entry shows the “Rietveld plot” and zooming in on different regions of the pattern provides insight on how the fit could be improved. You can alter the view to show the square root of the intensity (use the ‘S’ key to toggle this). The background is not well fit in the low angle range and examination shows a “hump” of low-angle scattering from ~4.5 to 6 degrees. This is more easily fit by adding a background peak than extra terms to the background function. Select the Background item in histogram PWDR OH_00.fxye Bank 1 and change Peaks in Background to 1. Change the peak position (pos) to the approximate peak center (5.25 degrees) and set the intensity (int) and Gaussian width (sig) to be refined. Important: note that one must click on another box to ensure that input is recorded.
Once the fit has been improved we can then add the position of this peak to the fit.
<![if !vml]><![endif]>While in other projects I might postpone this until later, we can also start on improving the peak fit. We will do this by varying the sample broadening for the major phase (since the instrumental terms are very good.) Select the first phase (CuCr2O4) and its Data tab, click on the Cryst. Size and microstrain parameters to add them to the fit.
There are now 20 refined parameters and a repeat of the fitting (Use the Calculate/Refine menu item) causes the fit to improve to a wR of <16%.
<![if !supportLists]>11. <![endif]>We can now include the position flag (pos/refine) for the background peak in the refinement. Do this at the Background item, as before. Be sure to click on some other box after clicking on the refine flag, so that the setting is recorded.
Close examination of the pattern shows that the peak widths are still not as well fit as desired. Since strain broadening seems more significant that sample broadening, we could use an anisotropic strain model. Rather than choosing the relatively complex generalized model, we can introduce only two terms with the uniaxial model. Trial and error will show that the 010 direction works best. Click on the first phase (CuCr2O4) and Data tab and select uniaxial for the Mustrain model and use 0 1 0 for the Unique axis, HKL . Select refinement for both Equatorial and Axial mustrain.
Repeating the refinement causes the wR to drop to ~14%. Clicking on the Covariance data tree item shows that the goodness of fit (GOF) is 1.16 (corresponding to a reduced χ2 of 1.2) with 23 refined parameters. While atomic parameters could now be refined, as shown in the plot, this is clearly a good enough place to start refinement with all the datasets.
There is one significant difference between fitting a sequence of datasets versus fitting a single data set. Rather than fitting lattice constants (for which there will be only one set for each phase in the entire refinement), we will use the Hydrostatic/Elastic strain terms (parameters <p>:<h>:Dxx) to treat the change in lattice parameters. These items describe the change in lattice parameters and appear in the Phase Data tab, where there is a set for each histogram assigned to the phase. We will make a switch to use this for the current dataset, in preparation for the sequential refinement with all datasets.
Also at this point we will temporarily remove variables that could make the fit diverge as the lattice constants shift. As an example, when initially fitting a model with peaks that overlap with the observed peaks, but not very well, the fit might be improved by a change in the phase fractions (that might eliminate our impurity CuO phase) or make peaks quite a bit broader than appropriate, these changes are improbable and could result in a model that is less correct than the starting point but still be a local LS minimum. In such cases the best-fit model may never be found. Accordingly, we will turn off refinement of all parameters except those that determine peak positions (the Dxx terms) and the overall scale factor. We might include the background terms since they are unlikely to affect convergence.
<![if !supportLists]>1. <![endif]>Select the first phase (CuCr2O4) and on the General tab, click on the Refine unit cell option to turn off refinement.
<![if !supportLists]>2. <![endif]>On the Data tab, click on the D11, D22 and D33 terms to refine the lattice strain terms. While here, to simplify convergence for the sequential refinement, where lattice constants change significantly, turn off the refinement of the three peak width terms and the phase fraction. The Data window should look something like
<![if !supportLists]>3. <![endif]>Click on the second phase (CuO) and on the General tab, click on the Refine unit cell option to turn off refinement.
On the Data tab for CuO, click on the D11, D22, and D33 terms to refine the lattice strain terms and turn off refinement of the phase fraction. We could refine the D13 term (which corresponds to the CuO β* angle), but we do not expect this to change much and expect the refinement to be relatively insensitive to this, due to the small number of CuO peaks that are in the pattern.)
<![if !supportLists]>4. <![endif]>Also at this stage, turn off the all the background refinement terms by clicking on Background on the histogram tree item and removing checks from all items (be sure to click elsewhere in the window before going on to the next step.)
<![if !vml]><![endif]><![if !vml]><![endif]>
Likewise, for the histogram Sample Parameters, turn off the Sample X displ. parameter by clicking on the Sample Parameters item in the histogram entries.
<![if !supportLists]>5. <![endif]>One can confirm that the number of parameters is now 7 (3 Dxx terms for phase 1, 3 Dxx terms for phase 2 and a scale factor.) If the refinement is repeated, the fit quality does not change, since these parameters are completely equivalent to the previous. There may result in very non-zero values for the Dxx parameters, but these are much smaller than their uncertainties and are thus within noise of zero.
In this step we bring in the remaining data, duplicate the histogram parameters as well as the phase/histogram parameters and set up to perform a sequential fit.
<![if !supportLists]>1. <![endif]><![if !vml]><![endif]>The remaining datasets are read using Import/Powder Data/from GSAS powder data file to open a file browser. Again select zip archive and the downloaded SeqTut.zip file. Select all the .fxye files except OH_00.fxye (use of the filter can again be helpful to show just the data file; press Set All and then unselect the one unneeded file).
This time one must select the instrument parameter file.
Set all data sets to use the two phases, as before in step 1 #6.
Note that the files must be read in in the sequence they will be processed. This is not an issue here, but for some sequential refinements, one may need to use multiple Import operations to read the files in the desired order or rename files so they are listed in the correct order in the file browser.
<![if !vml]><![endif]>Optional: Note that the default graphics mode is to display the last dataset read in. If you want to see the entire ensemble of data sets, click on the main entry for any of the datasets (for example PWDR OH_00.fxye Bank 1), click on the frame of the plot window and press the “m” key. (Alternately, press the “K” icon from the list at the bottom of plot, between the “floppy disk” and “question mark” icons and then select “m: toggle multidata plot” from the pop-up window). The ‘U’, ’D’, ’R’ & ‘L’ keys control the appearance of a ‘waterfall plot’. You can then select the ‘C’ key for a contour plot of all the data; use ‘U’ and ‘D’ keys to change the contrast.
I’ve use ‘D’ to increase the contrast & zoomed in to a location that shows the effect of temperature on the peak positions.
In this step we bring in the remaining data, duplicate the histogram parameters as well as the phase/histogram parameters and set up to perform a sequential fit.
<![if !supportLists]>1. <![endif]><![if !vml]><![endif]>Copy the histogram parameters from the first histogram to the new ones: Select the original PWDR OH_00.fxye Bank 1 entry. Use menu command Commands/Copy params.
<![if !vml]><![endif]>This causes a dialog box where the sections to be copied are selected. We need to duplicate the Limits, Background and Sample Parameters between all histograms. The Instrument Parameters have not been changed in this exercise and are all read from the same instrument parameter file, but there is no harm in copying them, so the default entries do not need to be changed. Press OK. Note that all parameters are copied except measurement information such as setting angles, temperature, etc.
An additional dialog window is shown which asks which histograms should receive the parameters. Press Set All to select all remaining histograms and then press OK.
That the copy has been performed can be demonstrated by examining any of the additional histogram plots (to see the changed lower limit), etc. Next we need to copy the Phase/Histogram parameters within each phase.
<![if !supportLists]>2. <![endif]>Select the first phase (CuCr2O4) and its Data tab. Then press the Copy data button for PWDR OH_00.fxye Bank 1;
a dialog window appears to select where to copy the parameters. At present GSAS-II includes the originating dataset in the list, and there is no harm in copying parameters to all histograms (including the origin), but this is a good chance to show how the toggle button is used. Select only the OH_00.fxye entry. Then press the Toggle All button to invert the selections. Then press OK.
<![if !vml]><![endif]><![if !vml]><![endif]>
It can be verified that the copy took place by clicking “Show” for additional banks.
<![if !supportLists]>3. <![endif]>Copy the Phase/Histogram parameters within the second phase by clicking on it (CuO) in the data tree (and possibly on the Data tab.) Then press the Copy? button and select the histograms as done in the previous step
At this point we determine which histograms will be used in the fit and set that the resulting parameters from the results of each refinement will be used for the subsequent refinements.
<![if !supportLists]>1. <![endif]><![if !vml]><![endif]>First, select the Controls item in the data tree and press the Select data button.
This opens a window where all histograms can be selected (it would be equally valid to skip the first histogram, since that has already been fully fit). Press OK and note that the Controls window now lists the number of datasets in the sequential refinement and two new controls.
<![if !supportLists]>2. <![endif]><![if !vml]><![endif]>Check the Copy results to next histogram checkbox. This is essential. If this is not selected, then every refinement will start with the current parameters (which are all identical, since they were set with the Copy operations.) The first few refinements will go well, but after the temperature has changed enough, the starting lattice parameters (determined from the cell and Dxx values) will be too far off and the refinements will fail.
Note that the Reverse order checkbox causes the sequential refinement to start with the last histogram, not the first. Sometimes this is useful, but not here.
<![if !supportLists]>3. <![endif]>Change Max cycles to 10. This is important, so that refinements have enough cycles to fully adjust to the changes in lattice parameters before being used as the starting point for the next refinement.
<![if !supportLists]>4. <![endif]><![if !vml]><![endif]>Start the sequential refinement with Calculate/Sequential refine; this will take some time as the refinement works its way through all the histograms.
Note that if the copy operations in Step 4 were not performed correctly, the parameters in each refinement will not agree and the refinement will stop with an error such as this:
(This error results if the parameters for the second phase were not copied in part 3 so that the phase fraction and strain broadening are retained for all but the first histogram and the 1::Dii terms are only included the first.)
<![if !supportLists]>1. <![endif]>When the refinement completes, a window will be displayed where you are asked if you want to load the results:
After doing OK, the Sequential Results item in the data tree is automatically selected, which displays a summary of the refinement results as a large table.
The second column shows the weighted profile R-factor, from each fit. This shows a steady increase with temperature, as might be expected if there were a systematic change in some sample parameters, such as strain or background or even atomic coordinates (which have not yet been fit). The Δχ2 value in the third column shows the percent improvement in χ2 seen in the last cycle of refinement. (If this changes from 4.1 to 4.0, then the value will be 100*(4.1-4.0)/4.0, or 2.5). Since the convergence criterion in the controls is 0.0001 (or 0.01%) we can see that only one refinement failed to converge. However, these shifts are still quite small, so that there is no reason to provide further cycles of refinement without adding new variable parameters.
Subsequent columns will show any of the sample parameters that vary across the datasets, here only temperature and then the direct cell lattice constants for each phase, generated from the Ax and Dij terms. Scrolling further shows the values of each refined parameter.
Before going farther, it is useful to review the trends in the lattice parameters as a sanity check. This can be done by double-clicking on a column of the table, such as the 0::b parameter, which displays this plot:
<![if !vml]><![endif]>Pressing the “K” icon or pressing the “s” key brings up a menu where the x-axis can be selected as temperature. If the plot fails to update, click on another column and then return to the original column.
At this point we choose to continue the refinements from their current values (note that the Copy results to next histogram checkbox is automatically unchecked after a successful sequential refinement.) including some additional parameters in the refinement. We will do this is a few steps.
<![if !supportLists]>1. <![endif]>Restore the refinement of background parameters as before for any one histogram and then use the File/Copy flags menu item to copy these refinement flags (only) to all other histograms. NB: Copy would copy the parameter values as well; probably don’t want to do that here.
<![if !vml]><![endif]><![if !vml]><![endif]>
<![if !supportLists]>2. <![endif]>Likewise, include the Sample X displ parameter and again use the Command/Copy flags menu item.
<![if !supportLists]>3. <![endif]>For Phase parameters add the three broadening terms for the CuCr2O4 phase and the press the Copy flags? button. (Important: not the Copy button!) For the CuO phase, add the single sample broadening term and the remaining lattice parameter via the D13 term. Again, use the Copy flags? button. Note that an additional step is needed in order to vary Phase fractions, as will be discussed below.
<![if !supportLists]>4. <![endif]>Start the sequential refinement again with the Calculate/Sequential refine menu item. The fits are significantly improved at higher temperatures, with Rwp values between 13.8 and 17.
<![if !supportLists]>5. <![endif]>We can now add the phase fractions into the refinement, by clicking on the Phase fraction checkbox and Copy Flags button for both phases. However, if the refinement is attempted it will fail as soon as the second histogram is refined with this error:
One additional step is needed to switch the constraints to work properly. Note that constraint we defined before (on 0:0:Scale and 1:0:Scale) pertains only to the first histogram. Note that a constraint is ignored if none of the variables in it are included in the refinement, so this constraint only affects the first histogram, giving rise to the error above. We could set up a constraint for each histogram that has been added, but this would be rather tedious to set up. The alternate is to set up a constraint where a wildcard (*) is used. Wildcards only apply to sequential fits and causes the current histogram number to be inserted for the * when each histogram is used.
To set up the new constraint, click on the Constraints item in the data tree and the Select tab/Histogram/Phase menu item, and then click on the Edit/Add constraint menu item. From the menu, we want one of the two x:*:Scale wild card phase fractions; they are at the bottom of the list
There will only be one possible matching variable in the next window, so select that and press OK.
The initial and the most recently defined constraints will then be shown.
These two constraints will interfere when refining the with first histogram, so press the Delete button for the first one to remove it.
<![if !supportLists]>6. <![endif]>Start the sequential refinement again with the Calculate/Sequential refine menu item. Three new columns appear at the end of the table for ::constr0 (generated by the constraint) and the initial variables, 0:*:Scale and 1:*:Scale. Changes to the Rwp values are quite small, even though the value for the minor phase changes significantly. This indicates that the refinement is relatively insensitive to these values.
The last thing we will add to the refinement will be atomic parameters. Note that these are handled a bit differently than the previous things we have refined. There is only one set of coordinates for each phase and these will be refined for each histogram, but are not saved individually, except in the summary table. If we restart the refinement, the coordinates from the last histogram will be used to fit the first. The Reverse order checkbox on the Controls causes the sequential refinement to start with the last histogram, which would avoid this problem.
Select the CuCr2O4 phase to and then the Atoms tab. Double-click on the refine label at the top of the atoms table, a refinement controls dialog opens, select X to refine coordinates (only O has coordinates not fixed by symmetry) and U to refine the atomic displacement (Uiso) values. Press OK.
Note the change in the atom table.
Note that since these parameters are shared directly in all histograms, no Copy or Copy flags menu item is needed or even available.
<![if !supportLists]>7. <![endif]>Start the sequential refinement again with the Calculate/Sequential refine menu item. The fits are significantly improved at higher temperatures, with Rwp values between 13.8 and 16.4. Be sure to save the project file by selecting the File/Save project menu item, since this will used in a later tutorial.
This completes the sequential refinement tutorial, although many more things could be attempted to further improve the refinement quality. In the Parametric Fitting and Pseudo Variables for Sequential Fits tutorial, functions of fitted parameters are computed and plotted and results are fitted to equations of state.