The Portable CMPR program

Extensively revised distribution -- 24/Sep/98; UNIX release updated 10/Oct/98 to run with BLT 2.4f

CMPR is a multipurpose program that can be used for displaying diffraction data, manual indexing and peak fitting and other nifty stuff. I consider it to be my "swiss army knife" for diffraction. Any useful manipulation that I need will probably end up here eventually. CMPR requires the Tcl/Tk and BLT packages and optionally uses Tix, when available. It has been tested on both UNIX computers (SGI and LINUX) and on computers running Windows-NT & -95. It will also probably run on Macintosh computers, but I do not plan to pursue this myself. (Click here to volunteer yourself.)

The program incorporates several small FORTRAN programs containing routines borrowed from lots of sources: The reflection generation code traces back to the NIST AIDS*83 (C. Hubbard, J. Stalick, A. Mighell & others), space group extinctions from NRC symmetry codes (A. C. Larson) and peak fitting uses GPLSFTA (D. Cox, W. Hamilton, L. Finger & many others).

Installation

Click here for UNIX installation instructions.

Click here for Windows-95 and -NT installation instructions.

Pretty pictures of CMPR

Click here to see screen images from CMPR.

Documentation

The following few paragraphs describe how the program works and the various modes within the program.

Mouse actions

It is possible to enlarge the size of the plot window by dragging the frame of (the border surrounding) the plot window. The scale of the plot will adapt to show the full range of all displayed data. However, it is possible to "zoom in" and display a smaller region of the data by clicking in two opposite corners of the region to be shown with the left mouse button (a left-click). Zooming in can be done multiple times. It is also possible to "zoom out" and show the previous view of the data by clicking on the right mouse button (a right-click).

Most modes within CMPR display a list of datasets that have been read. Files are selected by clicking on them with the left mouse button (left-click). The control and shift keys can be used to modify which files are selected. Holding the control key down and clicking the left mouse button (control-left-click) causes the file to be selected or unselected. Holding the shift key down and dragging the left mouse button across part of the list of files (shift-left-drag) causes those files to be selected.

Read

This section of the code is used to read diffraction data in a number of formats.

To read a file, select the format on the right and then select a file on either the window that pops up (Windows) or on the central pane (UNIX). Note that files can be read either by double-clicking (with the left button) on them or by pressing the Open (or Read) button.

After a file has been read, it appears in the plot window and the name appears in box on the left. Double-clicking (with the left button) on a file name causes all selected files to be displayed.

It is quite easy to extend CMPR to support additional formats as well. (No compiler is needed). For information on creating a new routine for reading data, see file "notes_on_read_routines" and the read_*.tcl files.

Write

This causes the selected file(s) to be written. At this time the only supported file format is one for export to spreadsheet programs. The box to the right shows the directory where the files will be written. Note that forward slash characters (/) are used, even for Win-95 and -NT.

Plot

The plot mode is used to choose different files for display. Double-clicking or using the "Update Plot" button causes the current files to be displayed. The "Postscript out" button causes a postscript copy of the plot window to be created (see the DisplayOptions mode for where the file is created and what happens to it).

The way that files are displayed is controlled by the buttons to the right. Select one or more files and then select which features will be changed. The changes will be made when the "Apply Changes" button is pressed.

Rescale

This is used to modify data or how it is displayed.

The x-axis units can be changed from 2theta values to other units with the first set of options. Y values can be scaled as the Square Root of the Intensities [Sqrt(I)], Logarithm (base 10) [Log(I)] or the signal-to-noise ratio (I/sigma of I) [I/sig(I)]. It is also possible to add or multiple or the x or y values by arbitrary values.

Note that changes are applied when the "Rescale" button is pressed and scaling is applied multiple times unless that "Reset previously applied scaling" checkbox is selected. This means that if the Y multiplier is set to 2.0, the range of intensities will double each time the Rescale button is pressed, unless "Reset previously applied scaling" is selected, in which case any previous scaling is ignored and the y values will be set to double their initial values.

Combine

Combine is used to create a new data set by adding or subtracting data sets that have already been read. The data sets must start and end with the same angles for the command to function properly.

HKLGEN and EditCell

These modes generates the allowed reflections for a given set of unit cell constants. Reflections can be omitted based on the presence of selected symmetry operations or based on the selection of a space group. Space groups are entered as used in GSAS. Enter the centering condition and then the symmetry along each appropriate axis, with spaces between each axis. Append a final "R" for rhombohedral settings. Some examples are: "P 1 21/c 1" or "P 21/c" for P 21/c and "R 3 m" for and "R 3 m R" for the hexagonal and rhombohedral settings of R 3 m, respectively. If an incorrect space group is entered, no error message is generated, but no extinctions are generated.

Unit cells may be input with either direct or reciprocal cell parameters in both HKLGEN and EditCell. Use of reciprocal cell parameters has proven valuable for indexing powder diffraction data with low symmetry unit cells where some reciprocal unit cell vectors are known from electron diffraction.

In HKLGEN, once the appropriate values have been entered, and the "Compute" button is pressed, a table of reflections is generated. This table can be saved to disk.

In EditCell, the reflections are both generated and plotted, optionally superimposed on data. A set of reflections is generated using the "Compute" button and then a set of data can be superimposed on the reflections by selecting the data set from the file list on the left using a double-click or by selecting the file and pressing "Update Plot". Selections between previously computed reflection lists can be made using the "Select peaklist" button in the upper left.

Unit cell symmetry can be raised by selecting a higher symmetry cell from the list in the middle. To lower the symmetry, a new peaklist must be created. Reflections that would be extinct based on a space group or symmetry operation can be highlighted using the extinction information in the upper right. Note that reflections that were previously removed due to symmetry will not be highlighted, so that if space "F m m m" is used to generate the reflections and "F d d d" is used to highlight extinctions, the reflections extinct due to face centering will be omitted and the reflections extinct due to the d-glides will be highlighted.

The plot will respond to changes in the unit cell parameters or zero correction made either by typing value(s) into the entry boxes or by sliding the bars to the left of each number. The zero correction is added to two-theta values. Whenever a data set is reselected, using the "Select peaklist" button in the upper left, the current value for the unit cell parameters are made the central value for the slider and all reflections within the requested angular range (see DisplayOptions) are generated.

Individual reflections can be labeled by holding the Shift key and clicking on the reflection position with the left mouse button (shift-left-click). All reflections can be labeled by holding Shift key and double-clicking anywhere in the plot with the left mouse button (shift-left-doubleclick). Individual reflection labels will be erased automatically after 10 seconds. This time can be changed in the DisplayOptions page; a erase time of 0 means that reflections labels are not automatically erased. To clear labels for all reflections, holding the Shift key and click anywhere with the right mouse button (shift-right-click). The size of reflection labels can be changed on the DisplayOptions page.

Note that the size for the reflection markers, with respect to the Y axis, is determined by the "Maximum and Minimum Y values" on the right side of the screen.

Fit

Fit is used for profile fitting of selected regions of a pattern. Peaks are fit with a pseudo-Voigt where eta is the "mixing term." A value of 0 for eta is a completely Gaussian peak shape and a value of 1 is a completely Lorenztian peak shape.

To fit peaks, first a data set is selected using the button in the upper left. Then a range of data is selected using the mouse to zoom in on a region, or by typing a upper and lower two-theta value in the "Range to fit" boxes. The range must contain less than 1000 data points.

Peaks are added to the table by pressing the "set" button to the right of the peak table and then clicking with the left mouse button on the appropriate location on the graph while holding the control key down (control-left-click). Peaks can also be redefined using this same mechanism. It is also possible to add peaks by holding down the control key while double-clicking (control-left double-click) on the peak.

Once at least one peak has been entered, and a suitable range has been selected, a "Run GPLSFT" button appears. Select the parameters to be refined, by clicking on the appropriate boxes to the right of the parameters and then press "Run GPLSFT" to optimize the parameters. The least-squares algorithm in the program is far from robust. You are encouraged to first refine the area and FWHM terms and then add background and eta and peak positions after reasonable fits are obtained.

The GPLSFT program can use the Finger-Cox-Jephcoat correction for peak asymmetry. For this correction, three terms must be known: the diffractometer radius, the half-height (or half-width) of the sample and of the detector. Values may be specified in any consistent units. NIST would prefer that you use metric units, of course. While these values can be refined, do so with care: do not refine too many variables at the same time, use a small number of cycles and set the damping factor to a small number.

Note that the output from the refinement is either shown on the plot, or in a separate window, determined by a value set in the DisplayOptions page.

DisplayOptions

This page is used to set values used in other parts of the program.

The "Plot options" determine how data is displayed and recorded

The "Peak Fit Options" are used for the Fit section of the program. The "EditCell options" are used in the EditCell section of the program.

Help

This provides a bit of information about the modes of the program.

Customizing

CMPR is designed to be expanded. Read the code and send me any extensions you create. Have fun! 
Neither the author nor the U.S. Government makes any warranty, expressed or implied, or assumes any liability or responsibility for the use of this information or the software described here. Brand names cited here are used for identification purposes and do not constitute an endorsement by NIST.

Brian Toby (Brian.Toby@NIST.GOV)
9/98