Fit Peaks/Autoindexing in GSAS-II

In this exercise you will use GSAS-II to search for a unit cell that matches a set of diffraction peaks -- a process known as auto-indexing. First peaks must be located and optimized and then indexing can be done.


If you have not done so already, start GSAS-II.

Step 1: read in the data file

1.      Use the Data/Read powder data menu item to read the data file into the current GSAS-II project. This read option is set to read any of the powder data formats (except neutron TOF time map files) defined for GSAS (angles in centidegrees). It will also read the xye format (angles in degrees) used by Topas, etc.  Change the file directory to Exercises/LaB6 to find the file; you may need to change the file type to All files (*.*) to find the desired file.

2.      Select the 11bmb_3844.fxye data file in the first dialog and press Open. There will be a Dialog box asking Is this the file you want? Press Yes button to proceed.

3.      Select the 11bmb_3844.prm instrument parameter file in the second dialog and press Open. The 11BM-B instrument processing software automatically produced this file when the corresponding fxye file was created from the 12 detector raw data.


At this point the GSAS-II data tree window will have several entries



and the plot window will show the powder pattern


Step 2: Select Limits

 This pattern has much more data than we need, so it is helpful to cut down the range. Click on the Limits item in the GSAS-II data tree. The small window is repainted. Use the changed row of entry boxes to set Tmin and Tmax to 4 and 27.5. Notice on the plot that the limit lines have moved to these positions; the green lower limit is just below the 1st peak and the red upper limit is in a wide gap between peaks. You may also drag the limit lines to the desired location or place them by a left mouse click on a data point for the lower limit or a right click on a data point for the upper limit.


Step 3: Determine Peak Positions

1.      Click on the Peak List item in the GSAS-II data tree. This creates an empty window of peak positions (the Limits window is erased). At this point it is wise to

 zoom in on the data that will be used for indexing.


2.      Click on the Zoom button, , then press the left mouse in one corner of the region to be used; holding the mouse button down, drag over the region to the opposite corner; a box will be drawn over the region to be zoomed.


3.      Important: Click on the Zoom  button again to turn off the zoom mode.


4.      Using the left mouse button, click on a data point near the top of each peak to be added to the peak list. It is usually best to start at the upper end of the pattern as the next peak to pick isn’t obscured by the tool tip. As this is done, a vertical blue line is drawn in the plot window  for each peak selected



and peaks are added to the Peak List window in order of increasing 2Q.



Note that if peaks are not being added, you probably have not exited zoom mode.


Add approximately 20-25 peaks total to the peak list (there will be 20 in this example). Be sure to add the lowest angle peaks that are visible in the plot. You may drag a peak position as needed; be sure the zoom/shift buttons are off. A position may be deleted with a right click with the mouse on the blue line.

Step 4: Refine Peak Positions

This refinement proceeds stepwise; first doing the default refinement and then adding a parameters to complete the fitting,


1.      Refine the peak intensities and the background. These parameters have their refinement flags turned on by default. Use the menu item Peak Fitting/LSQ PeakFit on the Peak List window. Do NOT use the Calculate/Refine menu item in the GSAS-II data tree window; that it to be used for Rietveld/Pawley refinements. You will be asked to save the current project before the fit will proceed; change directory if desired and provide a suitable name (we assume LaB6). A window will show the progress of the refinement and will close when the least-squares fit is complete (usually very fast). The plot is updated with the fit, the peak list window is updated with the new peak values and a summary of the refinement is shown on the console window as well.




2.      Now add refinement of the peak positions. This can be done by clicking on all the refinement flags for the individual peaks or it is possible to set them all at the same time using this recipe:

a.       single-click on any value in the table to select it, for example the first peak position. A black box appears around the value. If the field if opened for editing (the box turns to blue), select a different item in the table.

b.      double-click on the refine label above the peak position check-boxes. The entire column of checkboxes is highlighted in blue. Press the y key to turn on all refinement flags (n would turn them off).


3.      Next, repeat the refinement using the Peak Fitting/LSQ PeakFit menu item in the Peak List window.


4.      Now, select peak widths for refinement. This can be done by refining sigma (Gaussian width) and/or gamma (Lorentzian width) for individual peaks, but here we can constrain the peaks to follow an instrumental broadening equation. Select the Instrumental Parameters item in the data tree. This opens a window for peak profile terms


The plot window shows the resolution curves corresponding to the values of the Gaussian U, V, W, Lorentzian X & Y coefficients; ‘+’ marks show the individual values based on the sig & gam values for the peaks in Peak List. Select the refine flag checkbox for Gaussian U, V, W, and Lorentzian X, Y.


5.      Then, repeat the refinement. First click on the Peak List item in the data tree and then refine using the Peak Fitting/LSQ PeakFit menu item. At this point a good fit should be seen by zooming in on individual peaks. (For example see



The Rwp is ~6% as shown on the console window. Again the Peak List entries are all updated with new values and those in Instrument Parameters are also updated.

Step 5. Prepare Indexing Peak List

A separate list of peaks is kept for use in autoindexing. It is found in the Index Peak List item in the data tree. In the initially empty window created by this action, use menu item Index Peaks Operations/Load to copy the fitted peaks from the Peak List.



Note that by default all peaks are selected to be used. You may choose to not use a fitted peak (e.g. if suspected as from a contaminant).

Step 6. Run Autoindexing

Select the Unit Cells List data item. This brings up a window for indexing and cell refinement options



For the most rapid search (since we know the right answer), select Cubic-P and launch the search using menu item Cell Index/Index Cell. The search then runs and the console shows a running list of possible cells as they are found; the sorted by M20 list of possible matching cells is shown in the Unit Cells List window


Step 7. Review Cell Choices

Review the list of cells associated with the Unit Cells List data item. Note that as one selects a unit cell, the generated reflections for that cell are shown in the plot with dashed red lines. Sliding the cursor over these lines shows a small popup window with the indexed hkl for them. Note how the first cell in the list (M20=2961.34) with a=5.87864 Å generates very many lines with no corresponding peaks




while the (M20=609.02) cell with a=2.93932 Å generates not enough lines to match all the peaks


Step 8. Select/Refine Cell

Select the cell with M20 = 2961.34 with a = 4.1568 Å. This indexes all peaks with almost a perfect fit to the peak positions (compare dashed red lines to solid blue ones). Import the cell information using the Cell Index/Copy Cell menu option. Then optimize the cell by refining the lattice parameters and the two-theta zero: click on the refine checkbox next to the Zero offset value and then the Cell Index/Refine Cell menu option. The a cell parameter value shifts from 4.15679 to 4.15684 when zero is refined. Press the Show refined hkl positions + Zero offset button to update the plot including the refined Zero offset (in this case hardly anything happens!)



Notice that a new entry heads the list in the Indexing Result section of the Cell Index/Refine window with an improved M20(=3614.66) and a new value for Zero offset is shown.


(Optional) Finally, use of the Cell Index/New phase menu option allows one to create a phase with these lattice parameters in the data tree under Phases.  A name for the new phase is requested. This creates the tree item Phases (if it wasn’t already present). This new phase can be used in future analysis (e.g. Rietveld or Pawley refinement).


To continue with the second part of this exercise, do the menu item File/Close project in the GSAS-II data tree window. You will be asked if you want it saved; if Yes then all the peak fitting/indexing & cell refinement results will be saved to the LaB6.gpx file. If No then the file will remain as it was when created at Step 4 above.

2nd Fit Peaks/Autoindexing in GSAS-II

In this exercise we will fit peaks and index them for the new mineral jadarite (aka “kryptonite”). The data was also collected on 11BM-B at APS. The unit cell is monoclinic so is a more substantial test of the indexing capability of GSAS-II.

Step 1. Read in the data.

The file is \Exercises\krptonite\11bmb_6231.fxye; it has a corresponding prm file. Load them in & the plot is



I’ve zoomed in & shifted the plot some to highlight the lower part of the pattern.

Step 2 Set limits

Set the limits as 3 and 10.

Step 3 Pick peaks

Pick all peaks you can see between the limits (including the small ones). Note some peaks have shoulders most notably at 5.07, 6.04, 7.81deg. I found 28 peaks (there were a few very weak ones I skipped – they might be from a second phase? We’ll see later).


Step 4. Refine peaks

Following the steps above, refine the peaks and the profile shape parameters in Instrument parameters. You will be asked for a project file name at the first refinement (I used ‘jadarite’). In the end my refinement converged at Rwp=13.18% and some peaks do show some discrepancy as the sample is more complex than the simple U, V, W, X, Y model can accommodate. However, this is good enough to proceed.

Step 5. Prepare Indexing Peak List

As before do Operations/Load/Reload in the Index Peak List window.

Step 6. Index the cell

Let’s assume that we know the cell in primitive monoclinic. In a real world case we wouldn’t know this and we would have to try each Bravais lattice. These can be done as a group, but it takes time to go through all the bad cases.

Select Monoclinic-P and do Cell Index/Refine/Index cell in the Unit Cells List window. Progress will be much slower and suitable results will be slow in coming so be patient. Watch the console window; the right answer will have an obviously large M20 (~630) and a volume of ~594Å3 (10th column of console display). Once this is seen (it may take more than one try to get this) you can stop the indexing search by pressing Cancel on the progress bar window. It may take more than one press to fully stop it. My result was



Notice an equally good M20 result with twice the volume. The plot shows every peak indexed including a couple of weak peaks not selected for the peak fitting.



Although the weak peak at 2Q~7.3 has a shoulder that wasn’t indexed. I presume that is a contaminant. By sliding the cursor over the index lines without any visible peak you can see that the missing ones are (010, 100, 001, 110, 030, 111, 20-1, 10-2, 041, 050, 21-2, 23-1, 22-2, 141, 201,102, 15-1, 112, & 24-1). Many of these are accidental but the 0k0; k≠2n and h0l; h+l≠2n ones characterize the space group P21/n. Armed with this information you can Make new phase for the indexed cell (I called it ‘kryptonite’) and set the space group in the Phase Data for kryptonite window.



Setting the space group will show a window with some information. Press OK to close it.



This concludes this exercise. The features of the Phase Data window will be presented in other exercises.