A Graphical User Interface for GSAS

Note that the current EXPGUI release is intended to work with the current GSAS release. [EXPGUI v1.47 or later requires GSAS from Oct 2001 (or later) for all features to work as described].

EXPGUI is a graphical interface for the Los Alamos GSAS package. EXPGUI does two things: it can be used to directly modify the GSAS experiment file with a graphical user interface (GUI) and it can be used to invoke the programs inside the GSAS package such as EXPEDT, GENLES, FOURIER... These programs can be run from a menu or in many cases by pressing buttons. EXPGUI is written using the Tcl/Tk scripting language.

This web page describes the different actions that can be accomplished with the different panes and the contents of the menus. The table below contains links to the other web accessible documentation.

GUI Sections Least Squares Phase info Histogram info
Scaling info Profile terms Constraints
Preferred Orientation Menus  
Installation Notes: Unix Windows Customization
Tutorials: TOF CW Neutron  
Messages: Error Warning Informational
Other: Introduction Recent & Planned
J. Appl. Cryst.

Citations. The appropriate citations to be used for GSAS and EXPGUI are:

Mailing List. If you would like to get news about about new features & bug fixes in EXPGUI and also support the project by demonstrating how many people use it, please send e-mail to Brian.Toby@NIST.GOV.

A. Experiment file editing

When an experiment (.EXP) file is read, a copy is made in local computer memory. In most cases, values are changed in this "in memory" copy of the experiment file as this information is changed by the user on the screen. EXPGUI Screen snapshot New! If there is an error in the typed value, (for example if "1..0" is typed, or "1.5" is typed where an integer is expected), these values are not saved. In this case, the text is turned red, to indicate that an error is present, as shown in the figure to the left, where "90.000x" has been entered for alpha. The edited version of the experiment file is written back out to disk when the "File/Save" or "File/Save as" menu bar options are used. The File/Save operation is done automatically before any GSAS programs, such as GENLES or EXPEDT, are run.

Since the GSAS experiment file is quite complex, values are grouped together by function, approximately following the outline of the EXPEDT program. Each set of values is given a "tabbed pane" on a window that has the appearance of a notebook (see below).

The notebook pane tabs.
EXPGUI Screen snapshot
In some cases, where values are too numerous or complex to fit onto the notebook pane, one or more buttons may be present on a pane that will create a separate window, where the associated values can be modified. These values are not recorded in the "in memory" copy of the experiment file unless the "Save" button on this window is pressed. If "Cancel" is pressed, no changes are made. Each notebook pane is listed below with a link to the web page documenting that pane.

A.1 Least Squares (LS) Controls Pane

A.2 Phase Pane

A.3 Histogram pane

A.4 Scaling pane

A.5 Profile pane

A.6 Constraints pane

A.7 Preferential Orientation Pane

B. Shortcuts

B.1 Multiple Histogram Selection

This mode allows parameters to be changed for groups of histograms. When the "Multiple Histogram Selection" mode is off, it is possible to modify parameters and refinement flags for only a single histogram, but the other settings allow groups of histograms to be selected and modified. (see Mouse Actions).

It does not make sense, however, to globally modify instrument-related parameters and flags for different histogram types. So global actions can be limited to a single class of histogram types (e.g. TOF, CW Neutron,...), which allows these parameters to be set for groups of similar histograms. Thus, if this mode is set to "All" the Histogram and Profile panes are disabled.

The setting for "Multiple Histogram Selection" mode is displayed above each histogram selection box and is selected using the "Multiple Hist. Selection" item on the Options menu to create a submenu or by clicking on the display. Note that another option in this "Multiple Hist. Selection" submenu is an option "Group Phases Together" that controls how EXPGUI treats phases having the same profile type that is used when multiple histograms are selected. If the "Group Phases Together" option is on, then the refinement flags for all phases with the same histogram types are grouped together, when possible. If this option is off, phases are treated separately. New! If the left mouse button is used to click on the selection mode display, the mode is cycled between the available modes. If the right mouse button is used, the mode is reset, to disable multiple histogram selection.

B.2 Mouse Actions

A range of atoms or (in multiple selection mode) histograms may be selected by dragging (holding down) the left mouse button. It is also possible to select a range by using the Shift key with the left mouse button. To select or deselect individual entries, use the Control key with the left mouse button. Pressing the right mouse button selects all entries in a list.

C. Menu Commands and Programs

GSAS programs are invoked either through use of the menu bar

The menu bar.
EXPGUI Screen snapshot
or by "pressing" a button on the button bar. The button bar simply provides an easy way to access commonly used actions on the menu bar. Users can configure the menu bar to include their own preferred actions and, with some knowledge of the program and Tcl/Tk, add their own commands to the menu bar or button bar.

The button bar.
EXPGUI Screen snapshot

Invoking of GSAS programs

When GSAS programs are invoked, in most cases EXPGUI is suspended while the GSAS program is run in a terminal (or DOS) window. When the terminal window is closed, EXPGUI is restarted. If desired (see the "Iconify during GSAS" option) while this occurs, EXPGUI can be made into an icon to save screen space.

Once the GSAS program has finished, if the program has modified the .EXP file, "File has been modified..."message box similar to the one to the left is displayed (also see the more complete discussion on the messages page. Note that this message can be avoided if the "Autoload EXP" option is used.

Note that in both Windows-95 and Windows-NT, a file named EXPGUI.LCK is created while the GSAS program runs. The presence of this file is used to suspend the LIVEPLOT program, since LIVEPLOT has sometimes crashed when run at the same time as GENLES (no such problem has been seen in Unix). This file is deleted when the GSAS program completes.

In Windows-9x, the Winexec package is used to execute a command that creates a DOS window. The GSAS programs are then run by a batch file in this DOS window. Due to limitations in Tcl/Tk & Windows, the DOS window runs independently of EXPGUI, so the lock file (EXPGUI.LCK) is also used to suspend EXPGUI. While EXPGUI is waiting, the Please wait... window shown to the left is displayed. When the GSAS program completes, the lock file is deleted, the window automatically disappears and EXPGUI resumes. Should a problem arise where the file is not deleted, EXPGUI can be resumed by pressing the "Continue" button.

GSAS menus

A description of the EXPGUI menus follows. Use the links to obtain more information, including a very brief description of the function of each menu option. Note that an option may appear under more than one menu.

C.1 File Menu

The options on the File menu as is the custom contains the commands for reading and writing experiment files, as well as starting and ending the program.

C.2 Options Menu

This menu contains options that determine how EXPGUI runs.

C.3 Powder Menu

This menu contains links to GSAS programs used for powder diffraction analysis.

C.4 Single Crystal Menu

This menu contains links to GSAS programs used for single-crystal diffraction analysis.

C.5 Graphics Menu

This menu contains links to several GSAS and non-GSAS programs (such as LIVEPLOT and WIDPLT) used for graphical display of data and results.

C.6 Results Menu

This menu contains links to several GSAS and one non-GSAS (LSTVIEW) programs that are used for analysis of results.

C.7 Calculations Menu

This menu contains programs for useful crystallographic computations.

C.8 Import/Export Menu

This menu contains utilities for importing information into GSAS and exporting.

D. EXPGUI Utility Features

EXPGUI adds a number of useful functions to the GSAS package. Some, but not all, of these features are graphically oriented.


LSTVIEW is used to browse through the GSAS output listing. It is invoked by the "lstview" command in the GUI. New!LSTVIEW can also be used to shorten the .LST file by removing older results from the beginning of the file. New!LSTVIEW can also be used to plot R-factors and parameter shifts as a function of the cycle number.
EXPGUI Screen snapshot


LIVEPLOT shows the observed, calculated and difference plots for powder refinements. The plot is updated as the refinement progresses. The mouse can be used to zoom in on sections of the plot. LIVEPLOT uses the BLT graphics package.
LIVEPLOT Screen snapshot
New! LIVEPLOT can now be enhanced to superimpose peak locations for input unit cells or peaks from JCPDS/ICDD entries. See the LIVEPLOT web page for further documentation, and in particular, the See the LIVEPLOT customization information.


New! BKGEDIT is used to fit a GSAS background function to a set of fixed background points that are input using the mouse. The mouse can also be used to zoom in on sections of the plot. BKGEDIT uses the BLT graphics package.
BKGEDIT Screen snapshot
See the BKGEDIT web page for further documentation.


EXCLEDT is used to edit the range of data used from a histogram. The upper & lower ranges can be adjusted to include more data or use less. Also, it is possible to remove sections of the data (exclude regions) that have known systematic errors that cannot be modeled. EXCLEDT uses the BLT graphics package.
EXCLEDT Screen snapshot
See the EXECLEDT web page for further documentation. New! EXCLEDT can now be used to change the simulation range for dummy histograms.


WIDPLT is used to plot the peak widths that are generated by a set of GSAS profile terms (constant wavelength equations, only). The parameters from each phase & histogram will be read from the .EXP file. It is also possible to input parameters manually. By creating a special file ( described in the customization information), it is possible to define reference curves that are loaded automatically for comparison.
EXPGUI Screen snapshot

ABSPLT is used to plot the absorption/reflectivity correction for a histogram. Values are loaded from the histogram(s), but can be edited manually.

WIDPLT and ABSPLT both use the BLT graphics package.

D.6 File Conversions

GSAS data, experiment and instrument parameter files are expected to have a format with exactly 80 characters per line followed by a carriage return and then a linefeed (82 characters total per line). Files in this format can be read in "Direct Access" mode. Recent versions of GSAS will attempt to detect and repair files that are not in this format, but if the file is incorrectly formatted and by chance the length of the file is divisible by 82, the problem in the file format will not be detected. The Convert menu in can be used to convert files into the correct format. The original version of the file is retained and renamed.

D.7 Compute Composition

The composition box shows the unit cell and asymmetric unit composition for all phases in a material. Site multiplicities and occupancies are taken into account.

D.8 Delete History Records

Every time a GSAS program (including EXPGUI) is run, an entry is added to the "history records" in the .EXP file. After 999 entries have been written, no more can be added to the file. Further, reading large numbers of history records can slow the GSAS programs (this is less of a problem on faster computers). For these reasons, it may be a good idea to prune the older history records from the file. If more than 100 history records are found in an experiment file, EXPGUI suggests that the older history entries be deleted. Alternately the File/EraseHistory command can be used to invoke the this option.

On the dialog the number of history records to be retained is specified. Also, after records have been deleted, the remaining records can be renumbered starting with 1, so that the 999 record limit is not reached.

E. Coordinate Export & Import Features

EXPGUI can be used to read coordinates in formats not supported in GSAS. Coordinates can also be exported in a variety of formats as well.

E.1 Coordinate Import Formats

Coordinates can be imported using the
"Add Phase", "Add Atoms" or "Replace Phase" buttons on the Phase Pane, by choosing the format from the pull-down list to the right of the "Import atoms/phase from" button. The formats currently supported are listed below. Note that it is relatively easy to add new routines for importing coordinates; see the customization information for more details.
Crystallographic Information File (CIF)
Coordinates can be read from single block or multiblock CIF files using DDL1. If more than one block containing coordinates is found in the file, a CIF browser is available to help select the desired block.
PowderCell .CEL files
This format is used by the DOS and Windows PowderCell program, a valuable program for the transformation and visualization of structures.
GSAS .EXP files
This routine is used to copy coordinates, unit cell parameters and space group information from other GSAS experiment (.EXP) files.

E.2 Coordinate Export Formats

Coordinates can be written using the Import/Export=>"Coord Export" menu. Note that contents of the submenu will depend on the number of export routines found in the EXPGUI directory when the menu is first created, thus it is relatively easy to add new routines for importing coordinates; see the
customization information for more details.
Crystallographic Information File (CIF)
Powder Diffraction Crystallographic Information files (pdCIFs) can be created by the GSAS2CIF program. The GSAS2CIF menu item invokes this program.
MSI .xtl format
This writes a .xtl file, as is used in Insight-II and Cerius2 (Molecular Simulations, Inc.). The routine attempts to convert GSAS space group names properly, as well as correctly label "Origin 2" setting, however, the naming conversion will not work for all valid GSAS space groups. Some effort may be needed by the user to get everything worked out correctly.
PLATON .spf (Standard Parameter File) format
This writes a .spf file, as used in Platon and Pluton by A. L. Spek. Some attempt is made to get space group naming right, but there is no assurance of quality here.
SHELX .ins format
This writes coordinates and symmetry, as used in the SHELX-97 program, and perhaps as used some other programs, such as CrystalMaker. In addition to exporing the coordinates and displacement parameters, the fields that are generated are TITL, CELL, LATT, SYMM and SFAC. Note that the wavelength, included as the first number on the CELL "card", is set to the arbitrary value of 1/2.


The Tcl/Tk program is a platform-independent scripting language that is used to implement most of EXPGUI. This software is available for free and must be loaded in order to use EXPGUI. See the installation notes for Windows, and for UNIX for information on how to do this. While learning Tcl/Tk is a great thing to do, it is not a requirement for using or installing EXPGUI.


BLT Package

La (Linear Algebra) Package

    The Hume Linear Algebra Tcl Package, La, is used by the BKGEDIT routine to perform least-squares fitting. If the package can not be found, the routine cannot run. If the package cannot be found, a message, "Error -- Unable to load the La package" will be displayed. This should not happen, since the package is included with the EXPGUI files. So if get this error you probably have an incomplete installation. Note that the La package requires Tcl/Tk version 8.1 or higher, so that if you are using an older version of Tcl/Tk, you will need to upgrade. See the installation instructions for Windows, and for UNIX for more information on Tcl/Tk.


Praise to Larson and Von Dreele for GSAS, Ousterhout for Tcl/Tk, Przemek Klosowski for convincing me to learn Tcl/Tk and Jonathan Wasserman for helping get this project started. Thanks also to Pamela Whitfield of the NRC (Canada) for writing large sections of the Preferential Orientation Pane and the Profile Constraints pane code and to John Cowgill for the "Export to GRACE" code.

GSAS is written by Allen C. Larson and Robert B. Von Dreele, MS-H805, Los Alamos National Laboratory, Los Alamos, NM 87545. Problems, questions or kudos concerning GSAS should be sent to Robert B. Von Dreele at vondreele@lanl.gov EXPGUI is written by Brian H. Toby of the NIST Center for Neutron Research, Brian.Toby@NIST.GOV with help from Jonathan Wasserman.

GSAS is Copyright, 1984-2000, by the Regents of the University of California. The GSAS software was produced under a U.S. Government contract (W-7405-ENG-36) by the Los Alamos National Laboratory, which is operated by the University of California for the U.S. Department of Energy. The U.S. Government is licensed to use, reproduce, and distribute this software. Permission is granted to the public to copy and use this software without charge, provided that this notice and any statement of authorship are reproduced on all copies. Neither the Government nor the University makes any warranty, express or implied, or assumes any liability or responsibility for the use of this software.

The author of EXPGUI is a U.S. Government employee which means that EXPGUI is not subject to copyright. Have fun with it. Modify it. Please write new sections and make them available to the rest of the world.

Neither the U.S. Government nor any author 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 herein are used for identification purposes and do not constitute an endorsement by NIST.

Comments, corrections or questions: crystal@NIST.gov

$Revision: 565 $ $Date: 2009-12-04 23:08:18 +0000 (Fri, 04 Dec 2009) $