Home | Instruments | Contacts | Search | SiteMap | NIST Home |
The Portable CMPR program |
The most recent additions
are noted with , while
noteworthy revisions added in the last few revisions are marked
with
.
CMPR is a multipurpose program that can be used for displaying diffraction data, pattern indexing and peak fitting and other nifty stuff. I started writing this program as a replacement for a VAX program that I also called CMPR, but it has evolved to have quite different features. I consider CMPR to be my "swiss army knife" for diffraction. Any useful manipulation that I need will probably end up here eventually. Other people have also started adding their own modules to CMPR. I will gladly accept contributed code to add new features to CMPR. If you want to do this but need some help getting started, please contact me.
CMPR requires the
Tcl/Tk and BLT packages.
Starting with this version, CMPR no longer uses Tix for fancy GUI features,
instead it uses the
BWidget package. The BWidget package is included
in the CMPR code, so it does not need to be installed within Tcl/Tk.
CMPR is developed and tested on UNIX computers (SGI and Linux). It also runs on computers with the Windows-95 & Windows-NT (V4.0) and Windows-98 operating systems, but I do little Windows testing myself. It will also probably run on Macintosh computers, but it will require some work on porting parts of the BLT package as well as some AppleScript work. (Any volunteers?)
The program incorporates several small FORTRAN programs containing routines borrowed (mostly with permission) from lots of sources:
Mailing List |
Installation |
Documentation |
Pressing the "z" or "Z" key (Z for Zoom) allows the zoom to be set manually
by entering minimum and maximum values for the x- and y-axes.
Most modes within CMPR display a list of datasets that have been created or read in. I call these in-memory datasets buffers.
To read a file into a buffer, 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 if the legend is active (see the Display options page) the name appears in the legend. Also see the buffer selection section to see how one or more buffers can be plotted.
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 the Customizing section, below.
It is quite easy to extend CMPR to support writing additional formats as well. (No compiler is needed). For information on creating a new routine for writing data, see the Customizing section, below.
The "Postscript out" button causes a postscript copy of the plot window to be created. Settings on the Display options page determine where the file is created or how it is printed.
Plots can be exported to
grace, a publication-quality graphics package
where the displayed plot can be enchanced and annotated. This works
very nicely.
This page is also used to change the way a file is displayed. This is done by selecting the file(s) to be changed and then using the appropriate checkboxes to select the color, line type, symbol type and size. The changes will be made when the "Apply Changes" button is pressed.
It is also possible to transform the x and y scales.
The x-axis can be transformed between Q, d-space and 2-theta units
for an arbitrary wavelength.
Intensities (y values) can be transformed to square roots
[Sqrt(I)], base 10 logarithms [Log(I)]. The I/sig(I) mode divides each
intensity by its estimated error, providing an estimate of the
signal-to-noise and the
I2/sig(I)2 mode scales each intensity value so that
that estimated error is the square-root of the intensity, thus
showing raw counts prior to scaling (or the equivalent).
Conversion is done before constants are added or multiplied.
Changes are applied when the "Rescale" button is pressed. If more than one scaling or transformation is applied, the operation is applied to the results from the previous operation. However, if the "Reset previously applied scaling" checkbox is selected, the x and y values are reset to the values that were read in, before any scaling or transformation is done.
Space groups should be entered as specified in GSAS: Enter the centering condition or cell type (P, R, A, B, C, I or F) 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 P21/c and "R 3 m" and "R 3 m R" for the hexagonal and rhombohedral settings of R3m, 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. The reflections are generated and placed in a separate window when the "Compute" button is pressed. This table can be saved to a disk file by entering a file name and pressing the "Save as" button.
Unit cells may be input with either direct or reciprocal cell parameters. 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.
Symmetry can be specifed by space group or by selecting individual translational symmetry operations. 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 P21/c and "R 3 m" and "R 3 m R" for the hexagonal and rhombohedral settings of R3m, respectively. If an incorrect space group is entered, no error message is generated, but no extinctions are generated.
After the unit cell parameters have been entered and the "Compute" button is pressed, reflections are generated and displayed as a stick figure. At this point list of buffers is then displayed. If symmetry information was entered before the compute button was pressed, the extinct reflections are not included in the reflection list. If symmetry information is entered after the compute button is pressed, the extinct reflections are highlighted in yellow. To superimpose the stick figure on one or more buffers, select the buffers and press "Update Plot" button.
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. 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.
To redisplay a previously generated set of reflections, select the appropriate buffer using the "Select peaklist" button in the upper left of the page. Note that this recenters the unit cell sliders and recomputes the reflections within the requested angular range (see Display options).
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 typically be erased automatically after a given number of seconds, set in the Display options page; an erase time of 0 means that reflections labels are not automatically erased. Holding the Shift key and click anywhere with the right mouse button (shift-right-click) clears labels for all reflections, The size of reflection labels can be changed on the Display options page. (see Display options).
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.
In the example images, (GUI or PLOT), the reflection list was generated using space group R -3 but then space extinctions for R -3c are labeled. Thus, the reflections made extinct by the c-glide are shown in yellow. Reflections extinct in R -3 are not shown.
To fit peaks:
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.
By default fit results are shown superimposed on the plot of the fit, but the results can be placed in a separate window by deselecting the "Report fit results in plot window" checkbox on the Display options page.
The "FWHM" setting controls the width of the Gaussian convolution function for all of the above computations. It seems that it is best to set this to the approximate FWHM seen for peaks in the data.
The "Sensitivity" and "ESD" settings are used only for peak searching. Both are used to reject peaks below signal-to-noise criteria, but the exact functioning of these settings is not well understood.
This code is still under development and comments and suggestions can be offered to Dick Harlow.
The list of peaks is compiled into a buffer by using Peaks and/or using Fit (Fit is recommended for the most accurate peak positions). The peak list is then selected with the button on the upper left. A list of peaks is then shown to the right, where it is possible to select which peaks are used for autoindexing. Input files are created for all that are selected via the checkboxes to the left when the "Write file(s) & Run" button is pressed. For each selected program, it is then possible to select that the program be run in "foreground" (CMPR pauses while the run progresses) or in "background" (CMPR continues). Note that values for various program options are provided in the center section of the this page. Defaults values are used for all program options. However, it is possible to override these values from this section. For example, on the GUI example, the maximum cell length allowed by TREOR is increased to 30 Angstrom.
Once any of the programs have been run, the output file can be examined using the "Review Output" button. Two windows are created: the first shows the output file from the indexing program in a scrollable window and the second window shows the unit cells that have been located. Pressing the "Set" button to the left of any cell parameters causes those values to be loaded into EditCell. This allows the unit cell to be compared to an observed diffraction pattern.
Selecting the "Display Options" menu item opens a window used to set values used in other parts of the program (click here to view). The sections within this window are:
Help is invoked by pressing the F1 key or using "Help on current page"
in the Help section of the menubar.
The help is somewhat context-sensitive help as the
section of help information relevant to the current page is displayed.
Customizing |
CMPR reads default values by sourcing file localcmds.tcl from the directory where CMPR is installed and then file .cmpr_init from the user's home directory (or C:\.cmpr_init in windows). There are no errors if either or both files do not exist. Various Tcl commands can be placed in this file. One example is:
set graph(font) 18
Many other options can be modified in this fashion. Users are referred to the CMPR code to find them and see how they work.
lappend command(cmdopt) -xxx set command(-xxx) readxxxdatadefines that command
cmpr.tcl -xxx yyy.xxxcan be used to read file yyy.xxx using read routine readxxxdata (see below)
You can define as many options as you want or none, but be sure to define them in pairs, as above. If you don't want to support reading this type of file from the command line, you don't need to include these two statements.
lappend command(readtypes) "LHPM/RIET7"define a command to read the data
lappend command(readproc) ReadLHPMdefine a list of allowed datatype suffixes
lappend command(filterlist) {dat}If you will have upper and lower case versions for Unix, you might want to do the following:
if {$tcl_platform(platform) == "windows"} { lappend command(filterlist) {dat} } else { lappend command(filterlist) {dat DAT} }Define a datatype listing (not used at present) to describe the suffix:
set command(ReadLHPM_dat_type) "LHPM/RIET7 data" set command(ReadLHPM_DAT_type) "LHPM/RIET7 data"Note that the info in parentheses corresponds to the name used for command(readproc) followed by each value used for command(filterlist).
proc ReadLHPM {file} { global command if {$file == ""} return pleasewait "reading file $file" set ret [readLHPMdata $file] donewait if {$ret != ""} {return $ret} showlastentry $command(read_filelist) }
Look at the other read routines to see examples.
The CMPR program will automatically include the new format the next time it is started. Likewise, to remove a format all that need be done is to change the file name so that it starts with something other than read_ or end with something other than .tcl, for example note the files named Example_read_*.tcl.
lappend command(writetypes) ".csv (Spreadsheet)" lappend command(writeproc) writelistcsv
if {[set ${data}(type)] == "peaks"} {to take different action depending on if a peak file is being written Likewise, you can use the statement
if {$command(writeunits) == 0} {to take different action if scaled values or original values should be written.
Look at the other write routines to see examples.
The CMPR program will automatically include the new format the next time it is started. Likewise, to remove a format all that need be done is to change the file name so that it starts with something other than write_ or end with something other than .tcl.
Comments, corrections or questions: crystal@NIST.gov
lastmod(); ?>
$Revision: 1.6 $ $Date: 2001/11/09 19:01:47 $