Fluoroapatite GSAS/EXPGUI Example


This example uses a fits the structure of fluoroapatite  to laboratory x-ray data.  See https://subversion.xor.aps.anl.gov/trac/EXPGUI/browser/tutorials/tutorial4 to download the three files needed to work through this example (FAP.GSA, FAP.cif, INST_XRY.PRM) one at time (To download, click on the file and then use at bottom of page "Download in other formats:" Original Format to start the download). Or, click on https://subversion.xor.aps.anl.gov/EXPGUI/tutorials/tutorial4/FAP.zip to download four files (FAP.GSA, FAP.cif, INST_XRY.PRM plus FapatitleExample.pdf) one at at time.


Step 1. Start EXPGUI

Starting EXPGUI is different on different operating systems, but once EXPGUI is started, the window below is displayed:

Here, enter a name for the experiment file (your choice).  Press Read. Since this is a file we want to create as new, rather than one exists, we get a warning box:

Press Create and enter an arbitrary title (for your own use) in the next window:

Press Continue. EXPGUI then opens the main window (see below) and brings you to the phase panel (this is a hint as to what you need to do). Note that almost all other tabs are disabled (also a hint).

Step 2. Add a Phase to the Experiment

Now press Add Phase to enter the structural information. Note that we are going to read a cell and atoms in one step, but this can be done in multiple steps. This information can be read from a file or be typed into windows.

Here we read from a CIF file by changing PowderCell .CEL file to Crystallographic Information File (CIF). This brings up a window where we can select the CIF file (note this window will appear different depending on the operating system):

Press Open. Lattice/space group information is loaded into the previous window for us:

Look this information over; it is not always correct – particularly check the space group (at least one space is needed here between the P and the 6, for example). Here all is OK so, press Continue. EXPGUI then shows the generated symmetry operations:

It is a good idea to check these against the International Tables Volume A. These are correct, so we press Continue. Next we need to add atoms. Since these were read from the CIF, EXPGUI now opens a new window where we can see the atoms read from the file:


Note that these Uiso values are very large! This CIF must have them wrong. We can change them now by typing in values, but instead we will deal with this later. The input is otherwise OK, so press Add Atoms to continue. Now the Phase panel has been filled out with our first (and in this case, only) phase. Note we can now access the Powder panel.

Step 3. Add a Powder Dataset to the Experiment

So lets do that, click on the Powder tab near the top to open the panel seen below. Now we will add data (a histogram in GSAS jargon).


Press Add New Histogram button (at bottom). The window below opens. Here we will enter the data file name by pressing the upper Select File button

The file selection window opens. Select the FAP.GSA data file:

Then press Open. We now need an instrument parameter file to specify the data type, to provide default peak widths, etc. We will use a GSAS-distributed file for this. Press the lower Select File button and select file INST_XRY.PRM

Then press Open. You may get a warning that you can ignore (just press OK):

The powder histogram information is now ready to be added to the experiment, but before we do that we might want to change the data limit to use less data. One can use RAWPLOT to look at the data, but here letŐs use all the data (to 130 degrees).

Press the Add button to add the data.  The data are read into GSAS and the window is closed. We can now see that a data set is referenced in the Powder panel:


Step 4. Inspect the Computed Pattern

Before we do any refinements, we should see what the computed pattern from our input parameters looks like. To prevent changes being made to any refinable parameters, go to the LS Controls panel and set the Number of Cycles to 0 (middle of panel):

We now need to run POWPREF and GENLES. To start running the first, press the powpref button on the toolbar near the panel top (it can also be run from the item found on the Powder menu). A terminal window will pop up and show the following output:

Press Enter in that window to continue, which causes the EXPGUI window to be redisplayed. Running POWPREF makes some minor changes to the EXP file, which causes the window below to be displayed on top of the EXPGUI window. In this case, either answer works, since the changes are so minor, but to load the revised file into EXPGUI, press Load New, which is the usual action.

Then press the genles toolbar button to start that program. With 0 cycles, it will only compute the powder intensities, but not refine any parameters. The summary output from the program is shown below. The complete output is placed in the .LST file (which can be viewed with the lstview toolbar button – an optional exercise for the reader.)

As before press Enter in the terminal window and then Load New in the next window. Now press the liveplot toolbar button to see a plot. We see the plotted data as below, but note there is no computed intensity (shown by a red line that is covered by the green line for background).

We can zoom in on a section of the pattern by dragging a box by pressing the left mouse button in one corner of the box and dragging the mouse to the opposite corner. (Click with the right mouse button to zoom out; on mac X11 settings determine what one needs to do to simulate this). f we zoom in enough, as below, we see that there are computed intensities, but they are very weak. The max is computed with perhaps 50 counts, while the raw data have 20,000 counts.

While we could try to refine the scale factor the fit is so poor this might not work if any other variables are included. Instead, lets instead manually change the scale factor to be a factor of 400 (20,000/50) larger. One the Scaling panel we see the Scale Factor is currently 1, so we set it to 400, as below:

We then rerun GENLES by pressing the genles button, we press Enter and Load New as before. The Liveplot window automatically updates to show us the new plot as below:

Or when we zoom out:

Note that observed and computed peaks are more or less lining up. This means the unit cell parameters are close enough to start with. Note however that the computed intensities fall off way too fast. This is due to the Uiso values we input being too high as was noted before. Lets change them. Select the Phase panel, then drag the mouse to select all input atoms as below:

Press Modify Atoms button near the bottom of the Phase panel. LetŐs put in a quite small value for Uiso of 0.01. Do this by entering 0.01 for the Uiso or Uequiv value in the new window.

Press Set U button just below and then press the Close button. Note the Uiso values are now changed on the Phase panel:

To see the effect on the intensities, recompute them using GENLES, as before (press the genles buttonÉ). Liveplot now shows much better agreement with intensities, though now our scale factor is now too big.


Step 5. Start Refining Parameters

The agreement between observed and computed parameters is now good enough that we can start refining the model to better fit the data. First change the Number of Cycles to 3, on the LS Controls panel as below, so that GENLES will optimize selected parameters when it is run.

Select the Refine Cell checkbox on the Phase panel, as below, so that pair of parameters (a=b and c) can be refined.

My preference is to use the simplest background function, which is type 1 and start with a small number of background parameters. On the Powder panel, change the background to type 1 with six parameters by pressing the Edit Background button (in background box near top-middle). This opens the Edit Background  window shown below. On it select Function Type from the drop down list as 1, and the Number of Terms as 6.

Then press the Continue button at the bottom. This closes the Edit Background window. On the Powder panel, confirm that Refine background checkbox is selected so that the 6 background terms will be refined.

Now lets refine by pressing the genles button. The output from GENLES, shown below as with the beginning and end in different windows shows the χ2 dropping from 6813 to 74. This is a huge improvement in the fit achieved by optimizing 9 variables, as noted on the output. The 9 variables are the 2 cell parameters, 1 scale factor and 6 background values.

Liveplot will also show the fit looks better, as below.

Since the cell dimensions have changed a fair amount, it is a good idea to rerun powpref and genles again. After that χ2 drops to 61.


The question then becomes, what aspect of the fit is causing the biggest contribution to the differences between the observed and computed pattern. Zooming in on the pattern in liveplot shows the match is not too bad. The peak shape is a bit narrow, but does not seem like the major problem, see below.

However, clearly there are some significant differences in intensities, so perhaps refining structural parameters might help. To do this, select to refine the atom positions (as allowed by symmetry) and Uiso values by going to the Phase panel and selecting all atoms, as before, but this time click on the X and F checkbuttons (at the bottom left of the panel). The X option refines all coordinates that are not constrained by symmetry; the U option varies Uiso values (and Uij as allowed by symmetry for anisotropic atoms). This is shown below. Note that if this structure were a bit more complex, we might have initially grouped some Uiso values or only varied some of the heavy atoms, but 7 atoms, some on special positions is not that complex and these data go to quite high angle for lab data.

Press genles to refine. The agreement improves only a little bit, so this was not the biggest problem.


Now lets improve the peak shapes. The initial profile is not fitting the tails of the pattern well (see the liveplot example above), so letŐs refine the two Lorentian terms LX and LY – but one at a time.

Click on LX on the Profile panel and then run GENLES using the genles button. χ2 drops to 29. That clearly mattered


Try the same with LY turning LX off.

Run GENLES, but note that χ2 barely drops, so we do not need this parameter. We can reject the change by pressing Continue with Old on the reload window.


Lets try the Gaussian GU, GV & GW terms without LX or LY:

Run GENLES, but χ2 barely drops just a bit, to 26. Now we can try LX together with the GU, GV & GW terms, as below.

Since the peak shape has been changed a fair amount, this time letŐs run POWPREF and then GENLES. χ2 drops quite a bit, to 17. So it is a good idea to run POWPREF and then GENLES just to confirm that not much changes.


Since this is Bragg-Brentano (lab) data, lets correct for sample shift and transparency (since the sample is not that absorbing).  Turn on the profile shft and trns terms:

When we ren GENLES the χ2 drops quite a bit, to 5. Again since peaks have moved, lets run POWPREF and then GENLES again. χ2 drops even more, to 3.26. Repeating that again causes no improvement.  


Note that the trns parameter turns out to be quite close to 0 (within a bit more than one sigma, so trns is not too important). This large drop in χ2 implies that the shft parameter was causing large deviations between the observed and computed patterns in the fit once we had gotten the χ2 around 60. In retrospect, it might have been a good idea to introduce shft into the refinement at that point rather than this late in the process.


Step 6. Finishing Up the Refinement

To paraphrase Peter Stephens, we will never finish the refinement, since there are always more options and programs we can explore to try to improve the fit. But there are a few more likely places that we should look for additional parameters that would bring the χ2 closer to the ideal (1.0).


One is the two asymmetry values (S/L and H/L) depend on the instrument configuration. There is no reason to believe that the default values (0.01) in this instrument parameter file will be correct. However, GSAS does not refine these parameters very well. We donŐt know the size of the sample and slits used for the measurement, but we can try changing them manually. If they are both set to 0.012, as below, the χ2 drops a little bit, to 3.246.

If we move that a bit more, to 0.015, the χ2 increases to 3.57. Setting S/L and H/L to 0.013 or 0.011 are also not better than 0.012, so that is about the best we can do with those parameters.


Preferred orientation is always something that should be considered. We can test for this quickly using the SH Pref Orient (spherical harmonics preferred orientation) panel. When first selected there are no terms to refine, as shown below:

If we set the Spherical Harmonic Order to 2 in this symmetry, we get one refinable term, so I am willing to set the order higher to get a few more terms.

Setting the to Spherical Harmonic Order 4 brings us to only two preferred orientation terms:


If we add them to the refinement by checking the Refine ODF coefficients checkbox and then running GENLES, we see a small drop in the χ2 to 3.093 with texture terms that a very close to zero. It is not clear if this improvement is meaningful.


Looking closely at the fit in liveplot at this stage, we can see that the profile is not perfectly fit, as seen below,

also in a few places, reflection intensities are off by a little bit:

There are really no options for improving the profile. Also, there are no reasonable ways to increase the complexity of the structural model, so I would have to say we are tentatively done and accept this as the best fit to the data, unless any more good ideas pop up.