Customizing EXPGUI and Associated Programs

The EXPGUI GSAS graphical user interface can be modified in many ways quite easily. This document describes how the GUI works and how to modify the menus without significant reprogramming.

EXPGUI

The main GUI is created by file expgui, which in turn uses the following files sequentially: Two additional files are read if they are found:

The first three files, (readexp.tcl, gsascmds.tcl, gsasmenu.tcl) must be located in the same directory where the expgui file is found. The localconfig file also is read from this directory, if it exists. The final file, .gsas_config, is read from the user's login directory (UNIX) or C:\ (Windows). The localconfig and .gsas_config are intended to contain system-wide and user-level default values for parameters that are described in this document. Most routines have a "Save Options" command that writes some of the current parameters to file .gsas_config. Note that information in .gsas_config overrides that in localconfig. No error occurs if either of these files are not found.

The readexp.tcl and gsascmds.tcl files contain tcl procedures that are used for more than one application, so it is convenient to place them in separate files. They are only of interest to someone trying to debug or add new functionality to expgui.

The gsasmenu.tcl file defines the contents of the menu bar, the contents of the button bar and definitions for each command. The contents of this file are designed to be modified and extended by users, either by editing the file, or by overridding definitions in the localconfig or .gsas_config files. The important variables defined in the gsasmenu.tcl file are:

expgui(menunames)
This list defines the menu bar headings other than File, Options & Help
expgui_menulist
Each array element, e.g. expgui_menulist(file) and expgui_menulist(powder), defines commands to be added to a menu heading. Each command will appear as an array element in expgui_cmdlist.
expgui_cmdlist
Each array element, e.g. expgui_cmdlist(Save) or expgui_cmdlist(expnam) contains two items. The first defines a tcl procedure to be executed when the command is invoked, or "-" if no command will be invoked and the second contains help information describing what the command does. Note that when menu item is selected the variable cmd is set to the name of the command, so
    expgui_cmdlist(powpref) {{runGSASwEXP $cmd} {Powder data preparation}}
means that "runGSASwEXP powpref" will be invoked when powpref is invoked. . For example, when powpref is selected, the tcl command "runGSASwEXP $cmd" is invoked, where variable cmd is set to "powpref".
expgui(buttonlist)
This list defines the commands that will appear on the button bar where each item that appears on the button bar must have a matching pair of entries in expgui_cmdlist. Thus if the command
   set expgui(buttonlist) {expnam expedt genles ortep fourier forsrh forplot lstview}
is placed in the localconfig or .gsas_config files this will redefine the contents of the button bar.
In addition to the variables defined in the previous file, expgui, uses a small number of array for other configuration options. They are:
expgui(scriptdir)
This determines where files such as readexp.tcl, etc. are located. This defaults to the location where expgui is located so it rarely needs to be changed.
expgui(gsasdir)
This contains the location of the GSAS directory, if it is not the parent director where expgui is found. This determines where a number of GSAS data files will be located. If expedt crashes when you try to add new atoms, this is probably wrong.
expgui(gsasexe)
This determines where the GSAS executable files are located. You might want to change this is you keep multiple versions of GSAS around or if you keep the GSAS files in a different location than the default or want to keep the tcl files somewhere other than in a subdirectory of the GSAS files.
expgui(coordfont)
Sets the font used for the coordinates scroll box
expgui(histfont)
Sets the font used for the histogram scroll box
liveplot(hst)
Sets the default histogram used for liveplot
liveplot(legend)
Sets the default value for display of the legend in liveplot
The following variables are written to .gsas_config when "Save Options" is used. These variables are all set from the GUI and therefore do not need to be edited manually.
expgui(archive)
This defines the default state for the archive flag, where 0 is off and 1 is on. When archive is on, a copy of the .EXP file is saved before a new version of the file is saved and before EXPEDT is run.
expgui(asorttype)
This determines the atom sort mode.
expgui(hsorttype)
This determines the histogram sort mode.
expgui(filesort)
This determines the default file sorting mode for the expnam command.
env(GSASBACKSPACE)
Used only for UNIX: This determines if the default definition for the backspace key is overridden; some UNIX systems need this so that expedt and other terminal-oriented programs work correctly and other systems do not. You can toggle this option using the "sets an environment variable needed by the "Override Backspace" option on the file menu.

LSTVIEW

The localconfig and .gsas_config files are read, if present. The following options are available for customization in these files:
txtvw(menulength)
This limits the number of entries that can exist in a menu. For example, the default is 25, so when more than 25 cycles are found in a .LST file, only the last 25 are listed in the "Go To"/cycle submenu.
txtvw(maxchars)
This limits the maximum number of characters that will be read from an existing .LST file to speed the start of the program. The default is ~1Mb for UNIX systems and ~200K for Windows.
The following variables are written to .gsas_config when "Save Options" is used. These variables can be set from the GUI and therefore do not need to be edited manually.
txtvw(followcycle)
This sets the initial value for the "Auto Advance" button in the "Go To" menu. When this is true, the program will show the last cycle in the file. As new cycles are added, the "view" is advanced.
txtvw(font)
This sets the font used for LSTVIEW. See documentation on the font command in Tk for details on font naming.
One additional variable is present that I don't suggest using at present:

LIVEPLOT

The localconfig and .gsas_config files are read, if present. Note that some of these options are relevant only if the tcldump program is present.

The following options are available for customization in these files:

peakinfo(flagn)
These variables define if peak positions will be shown for reflections in phase "n". Reflections will be shown if the value is non-zero.
peakinfo(colorn)
These variables define the default colors for reflections in phase "n"
peakinfo(dashesn)
These variables define if peaks will be dashed for reflections in phase "n" (UNIX only). Lines will be dashed if the value is non-zero.
peakinfo(minn) and peakinfo(maxn)
These variables dictact the placement vertical position for reflection markers, when manually placed (see expgui(autotick), below). To draw to the edge of the screen, use -Inf and Inf.
The following variables are written to .gsas_config when "Save Options" is used. These variables are all set from the GUI and therefore do not need to be edited manually.
graph(printout)
This is set to 1 if PostScript files will be printed and 0 if they will be written to disk (for Windows all files should be written to disk).
graph(outname)
This is the default for the file name used when PostScript files will be written to disk.
graph(outcmd)
This is the default for the command used to print PostScript files (Unix only).
graph(legend)
Sets the default value for display of the legend in liveplot and widplt.
peakinfo(obssym)
Symbol for observed data points. Valid choices are square, circle, diamond, plus, cross, splus and scross.
peakinfo(obssize)
Size for the symbol for observed data points. A value of 1 corresponds to about 1/8 inch (about 3 mm).
expgui(pixelregion)
When hkl values are loaded (using tcldump) and reflections are labeled, reflections can be labeled using a Shift-Left-Mouse click. All labeled reflections within expgui(pixelregion) pixels of the mouse position are assumed to be overlapped and are labeled.
expgui(fadetime)
The time in seconds before reflection labels are removed. A value of zero means that reflections must be deleted manually (Shift-Right-Mouse).
expgui(lblfontsize)
A size for reflections labels in pixels.
expgui(hklbox)
If this variable is non-zero, reflection indices are shown in a box.
expgui(autotick)
If this variable is non-zero, reflection markers positions are set automatically.

Using TCLDUMP with LIVEPLOT. LIVEPLOT works with the standard GSAS program HSTDMP, but it works faster and is more powerful when used with the TCLDUMP program. Instructions for downloading this file can be found in the installation notes for Windows and UNIX.

Combining CMPR and LIVEPLOT. If you have CMPR installed on your computer, you can use superimpose on the GSAS results the peaks for an arbitrary unit cell. If desired, space group extinctions can even be shown. This is pretty neat! To enable this feature, you must have a version of CMPR downloaded after 4 May 1998 (see the CMPR installation instructions.) For UNIX, create a link from in the expgui directory to file cellgen.tcl in the CMPR directory. For example:

         ln -s /usr/local/cmpr/cellgen.tcl /usr/local/gsas/expgui/cellgen.tcl 
For Windows, copy all the CMPR .tcl and .exe files into the expgui directory.

Combining LOGIC and LIVEPLOT If you have LOGIC installed on your computer, you can superimpose peaks for a entry from the ICDD/JCPDS database on a pattern in LIVEPLOT. This is also pretty neat! To enable this feature, you must have a version of LOGIC downloaded after 4 May 1998 (see the LOGIC installation instructions.) For UNIX, create a link from in the GSAS GUI directory to file icddcmd.tcl in the LOGIC directory. For example:

         ln -s /usr/local/powdersuite/icddcmd.tcl /usr/local/gsas/tcl/icddcmd.tcl 
For Windows, copy all the LOGIC files into the expgui directory.

WIDPLT

The widplt script is used to display the FWHM for one or more histograms from a .EXP file. At this point it only works for CW data. It is often convenient to add for reference the expected instrumental curves as options to the menu. This can be done by creating a file called widplot_name. For example, renaming the example_widplt_BT1 file supplied with the distribution to widplt_BT1 will cause the FWHM curves for the NIST BT-1 instrument to be added to the menu of defined FWHM values.

Creating such a file is easy. To add a entry define the following five array elements using a single, unique element name and then append that element name to variable datalist. Define

    set UVWP(Ge15) {398.5 -343.2  163.0 0}
    set XY(Ge15) {0 0}
    set wave(Ge15) 2.0775
    set lblarr(Ge15) "BT-1 Ge(311) 15'"
    set ttrange(Ge15) "5 160"
    lappend datalist Ge15 
Array element UVWP(item) contains the (Gaussian) GU, GV, GW and GP values, while XY(item) contains the (Lorentzian) LX and LY terms. Array element wave(item) contains a wavelength, array element lblarr(item) contains the text to be shown on the "Plot Contents" menu and ttrange(item) defines the range the function is valid.

The following variables are written to .gsas_config when "Save Options" is used. These variables are all set from the GUI and therefore do not need to be edited manually.

graph(printout)
This is set to 1 if PostScript files will be printed and 0 if they will be written to disk (for Windows all files should be written to disk).
graph(outname)
This is the default for the file name used when PostScript files will be written to disk.
graph(outcmd)
This is the default for the command used to print PostScript files (Unix only).
graph(legend)
Sets the default value for display of the legend in liveplot and widplt.
graph(plotunits)
Sets the units used for displaying the data. Values are "d", "q", "", for d-space, Q and 2-theta, respectively.
graph(equivwave)
Sets the wavelength used for displaying data, if blank, no conversion is done and data are shown in their original wavelength.

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

This GUI is written by Brian H. Toby of the NIST Center for Neutron Research, Brian.Toby@NIST.GOV.

GSAS is Copyright, 1984-1997, 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 GUI is not subject to copyright. Have fun.

Brian Toby (Brian.Toby@NIST.GOV)
$Revision: 105 $ $Date: 2009-12-04 23:00:29 +0000 (Fri, 04 Dec 2009) $