source: trunk/doc/expgui_cfg.html @ 271

Last change on this file since 271 was 270, checked in by toby, 11 years ago

# on 2000/08/21 19:33:31, toby did:
describe coordinate import routine
pretty up page with links table

  • Property rcs:author set to toby
  • Property rcs:date set to 2000/08/21 19:33:31
  • Property rcs:lines set to +98 -1
  • Property rcs:rev set to 1.10
  • Property rcs:state set to Exp
  • Property svn:keywords set to Author Date Revision Id
File size: 25.8 KB
Line 
1<HTML>
2   <META NAME="Author" CONTENT="Brian H. Toby">
3   <TITLE>Customizing EXPGUI and Associated Programs</TITLE>
4<HEAD>
5</HEAD>
6<BODY BGCOLOR="#FFFFFF">
7
8<A HREF=http://www.ncnr.nist.gov>
9<IMG SRC="http://www.ncnr.nist.gov/images/ncnrtrans.gif" 
10alt="Link to NIST Center for Neutron Research home page"
11ALIGN=RIGHT></A>
12<A HREF=http://www.nist.gov>
13<IMG SRC="http://www.ncnr.nist.gov/images/webidblue_2lineright.gif" 
14alt="Link to National Institute of Standards & Technology home page"
15ALIGN=LEFT></A>
16<CENTER>
17<A Href="http://www.ncnr.nist.gov/programs/crystallography/software/tclpkgs.html">
18<IMG SRC="tcltklogo100.gif" 
19alt="Link to Tcl/Tk information">
20</CENTER></A>
21<hr>
22
23<TABLE BORDER BGCOLOR="#FFFF40" ALIGN=RIGHT>
24<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
25</TH></TR></TABLE><BR CLEAR=ALL>
26
27<CENTER>
28<H1>
29Customizing EXPGUI and Associated Programs</H1></CENTER>
30
31The EXPGUI GSAS graphical user interface can be modified in many
32ways quite easily.
33This document describes how the GUI works and how to modify the menus without
34significant reprogramming. A little bit of programming in Tcl/Tk can go a
35long way in adding new features. See the
36<a HREF="#Customizing">Customizing</A> examples, below.
37
38<H3>EXPGUI</H3>
39The main GUI is created by file expgui, which in turn uses the following files
40sequentially:
41<UL>
42<LI><TT>readexp.tcl</TT>
43<LI><TT>gsascmds.tcl</TT>
44<LI><TT>gsasmenu.tcl</TT>
45</UL>
46Two additional files are read if they are found:
47<UL>
48<LI><TT>localconfig</TT>
49<LI><TT>.gsas_config</TT>
50</UL>
51<P>The first three files,
52(<TT>readexp.tcl</TT>, <TT>gsascmds.tcl</TT>, <TT>gsasmenu.tcl</TT>)
53must be located in the same directory where the <TT>expgui</TT> file is found.
54The <TT>localconfig</TT> file also is read from this directory, if it exists.
55The final file, <TT>.gsas_config</TT>, is read from the user's login directory (UNIX) or <TT>C:\</TT> (Windows).
56The <TT>localconfig</TT> and <TT>.gsas_config</TT> are intended to
57contain system-wide and user-level default values for parameters
58that are described in this document. Most routines have
59a "Save Options" command that writes some of the current parameters to
60file  <TT>.gsas_config</TT>. Note that information in <TT>.gsas_config</TT>
61overrides that in <TT>localconfig</TT>.
62No error occurs if either of these files are not found.
63
64<P>
65The <TT>readexp.tcl</TT> and <TT>gsascmds.tcl</TT> files contain
66tcl procedures that are
67used for more than one application, so it is convenient to place them
68in separate files. They are only of interest to someone trying to debug
69or add new functionality to expgui.
70<P>
71The <TT>gsasmenu.tcl</TT> file defines the contents of the
72menu bar, the contents of the
73button bar and definitions for each command. The contents of this file
74are designed to be modified and extended by users, either by editing the file,
75or by overriding definitions in the <TT>localconfig</TT> or
76<TT>.gsas_config</TT> files.
77
78The important variables defined in the <TT>gsasmenu.tcl</TT> file are:
79<DL><DL>
80<DT>expgui(menunames)<DD>
81This list defines the menu bar headings other than File, Options & Help
82<DT>expgui_menulist<DD>
83Each array element, e.g. expgui_menulist(file) and expgui_menulist(powder),
84defines commands to be added to a menu heading. Each command will appear
85as an array element in expgui_cmdlist.
86<DT>expgui_cmdlist<DD>
87Each array element, e.g. expgui_cmdlist(Save) or expgui_cmdlist(expnam)
88contains two items. The first defines a tcl procedure to be executed
89when the command is invoked, or "-" if no command will be invoked and
90the second contains help information describing what the command does.
91Note that when menu item is selected the variable cmd is set to the
92name of the command, so
93<PRE>
94    expgui_cmdlist(powpref) {{runGSASwEXP $cmd} {Powder data preparation}}
95</PRE>
96means that "runGSASwEXP powpref" will be invoked when powpref is invoked.
97. For example, when powpref is selected, the tcl command
98"runGSASwEXP $cmd" is invoked, where variable cmd is set to "powpref".
99<DT>expgui(buttonlist)<DD>
100This list defines the commands that will appear on the button bar where
101each item that appears on the button bar must have a matching pair of entries
102in expgui_cmdlist.
103Thus if the command
104<PRE>
105   set expgui(buttonlist) {expnam expedt genles ortep fourier forsrh forplot lstview}
106</PRE>
107is placed in the <TT>localconfig</TT> or <TT>.gsas_config</TT> files this will
108redefine the contents of the button bar.
109</DL></DL>
110
111In addition to the variables defined in the previous file, expgui, uses
112a small number of array elements for other configuration options. They are:
113<DL><DL>
114
115<DT>expgui(scriptdir)<DD>
116This determines where files such as <TT>readexp.tcl</TT>, etc.
117are located. This defaults to the location where <TT>expgui</TT> is located so
118it rarely needs to be changed.
119
120<DT>expgui(gsasdir)<DD>
121This contains the location of the GSAS directory, if it is not the
122parent director where expgui is found.
123This determines where a number of GSAS data files will be located. If expedt
124crashes when you try to add new atoms, this is probably wrong.
125
126<DT>expgui(gsasexe)<DD>
127This determines where the GSAS executable files are located.
128You might want to change this is you keep multiple versions of GSAS
129around or if you keep the GSAS files in a different location than
130the default or want to keep the tcl files somewhere other than
131in a subdirectory of the GSAS files.
132
133<DT>expgui(coordfont)<DD>
134Sets the font used for the coordinates scroll box
135
136<DT>expgui(histfont)<DD>
137Sets the font used for the histogram scroll box
138
139<DT>liveplot(hst)<DD>
140Sets the default histogram used for liveplot
141
142<DT>liveplot(legend)<DD>
143Sets the default value for display of the legend in liveplot
144
145<DT>expgui(initstring)<DD>
146Defines commands to be executed by EXPGUI after all other commands
147have been run. This is used to define initialization commands in
148the <TT>localconfig</TT> or <TT>.gsas_config</TT> files that cannot be
149run at the time when the files are sourced. <I>(added in EXPGUI v1.21)</I>
150</DL></DL>
151
152The following variables are written to <tt>.gsas_config</tt> when
153"Save Options" is used. These variables are all set from the GUI and therefore
154do not need to be edited manually.
155
156<DL><DL>
157<DT>expgui(archive)<DD>
158This defines the default state for the archive flag,
159where 0 is off and 1 is on. When archive is on, a copy of the .EXP file
160is saved before a new version of the file is saved and before EXPEDT is run.
161
162<DT>expgui(asorttype)<DD>
163This determines the atom sort mode.
164
165<DT>expgui(hsorttype)<DD>
166This determines the histogram sort mode.
167
168<DT>expgui(filesort)<DD>
169This determines the default file sorting mode for the expnam command.
170
171<DT>env(GSASBACKSPACE)<DD>
172Used only for UNIX: This determines if the default definition
173for the backspace key is overridden; some UNIX systems need this so that
174expedt and other terminal-oriented programs work correctly and
175other systems do not. You can toggle this option using the
176"Override Backspace" option on the file menu to see what works for you.
177
178</DL></DL>
179
180
181<HR><H3><A NAME="import">Coordinate import routines for EXPGUI</A>
182<IMG SRC="new.gif" HEIGHT=13 WIDTH=36>
183</H3>
184It is possible to define new formats for EXPGUI to use for importing
185phase/coordinate information. This is done by creating a file named
186<TT>import_</TT><I>xxx</I><TT>.tcl</TT> in the EXPGUI directory. See
187file <TT>import_cell.tcl</TT> as an example.
188
189The file must contain four items:
190<UL>
191<LI>
192A description for the type of file to be read.
193<DL><DL><PRE>
194set description "PowderCell .CEL file"
195</PRE></DL>
196The text should not be too long and use a return (\n) if needed:
197<DL><PRE>
198set description "My favorite coordinate\nfile from the GIGO pkg"
199</PRE></DL></DL>
200<LI>
201A list of acceptable file extensions. In UNIX upper and lower case
202versions will be generated automatically, so do not worry about
203the case of the extension.
204<DL><DL><PRE>
205set extensions .cel
206</PRE></DL>
207or
208<DL><PRE>
209set extensions {.jnk .junk}
210</PRE></DL></DL>
211<LI>
212The name of the routine that will read the data file
213<DL><DL><PRE>
214set procname ReadPowderCellFile
215</PRE></DL></DL>
216<LI>
217A routine that takes the file name as an argument
218<DL><DL><PRE>
219proc ReadPowderCellFile {filename} {
220</PRE></DL></DL>
221and returns a list containing the following three items
222<OL>
223<LI>Space Group
224<DL><DL>
225The space group should be named and spaced appropriately for GSAS,
226e.g. P 21/c or P 21 21 21, not P21/c or P212121.
227</DL></DL>
228<LI>Cell parameters
229<DL><DL>
230All six parameters should be specified in a list
231</DL></DL>
232<LI>Atom Coordinates
233<DL><DL>
234The atom coordinates should be specified as a list with a list element
235for each atom.
236The list contains the following items:
237<OL>
238<LI>Atom label
239<LI><I>x</I>
240<LI><I>y</I>
241<LI><I>z</I>
242<LI>Atom type
243<LI>Occupancy
244<LI>U<sub>iso</sub>
245</OL>
246If an item is not specified, it is left blank in the atom table, except for
247Occupancy and U<sub>iso</sub>, which default to 1.0 and 0.025, respectively.
248However, one must specify a null value, if an item will be skipped over.
249For example, use:
250<PRE>
251    "Li1 0 0 0 li 0.5"
252</PRE>
253or
254<PRE>
255    "{} 0 0 0 li 0.5"
256</PRE>
257but not
258<PRE>
259    "0 0 0 li 0.5"
260</PRE>
261
262</DL></DL>
263</OL>
264Note that GSAS requires that if a center of symmetry is present,
265this center defines the origin (Origin 2 settings, where more than one setting
266is given in the International Tables).
267
268</UL>
269<HR><H3>LSTVIEW</H3>
270The <TT>localconfig</TT> and <TT>.gsas_config</TT> files are read, if present.
271The following options are available for customization in these files:
272<DL><DL>
273<DT>txtvw(menulength)<DD>
274This limits the number of entries that can
275exist in a menu. For example, the default is 25, so when more than 25 cycles
276are found in a .LST file, only the last 25 are listed in the
277"Go To"/cycle submenu.
278<DT>txtvw(maxchars)<DD>
279This limits the maximum number of
280characters that will be read from an existing .LST file to speed
281the start of the program. The default is ~1Mb
282for UNIX systems and ~200K for Windows.
283</DL></DL>
284
285The following variables are written to <tt>.gsas_config</tt> when
286"Save Options" is used. These variables can be set from the GUI and therefore
287do not need to be edited manually.
288
289<DL><DL>
290<DT>txtvw(followcycle)<DD>
291This sets the initial value for the
292"Auto Advance" button in the "Go To" menu. When this is true,
293the program will show the last cycle in the file. As new cycles are
294added, the "view" is advanced.
295
296<DT>txtvw(font)<DD>
297This sets the font used for LSTVIEW. See documentation on the font command in
298Tk for details on font naming.
299</DL></DL>
300
301One additional variable is present that I don't suggest using at present:
302<UL>
303<LI>plotvars: I am in the process of developing code that tracks
304and plots shifts and R values as a function cycle number. Setting plotvars to 1
305allows this code to be tested.
306</LI></UL>
307
308<hr><H3>LIVEPLOT</H3><A NAME="liveplot"></A>
309The <TT>localconfig</TT> and <TT>.gsas_config</TT> files are read, if present.
310Note that some of these options are relevant only if the tcldump program is
311present.
312<P>
313The following options are available for customization in these files:
314<DL><DL>
315<DT>peakinfo(flag<i>n</i>)<DD>
316These variables define if peak positions will be shown
317for reflections in phase "<i>n</i>". Reflections will be shown if
318the value is non-zero.
319
320<DT>peakinfo(color<i>n</i>)<DD>
321These variables define the default colors for
322reflections in phase "<i>n</i>"
323
324<DT>peakinfo(dashes<i>n</i>)<DD>
325These variables define if peaks will be dashed for
326reflections in phase "<i>n</i>" (UNIX only). Lines will be dashed if
327the value is non-zero.
328
329<DT>peakinfo(min<i>n</i>) and peakinfo(max<i>n</i>)<DD>
330These variables dictate the placement vertical position for reflection
331markers, when manually placed (see expgui(autotick), below). To draw
332to the edge of the screen, use -Inf and Inf.
333</DL></DL>
334
335The following variables are written to <tt>.gsas_config</tt> when
336"Save Options" is used. These variables are all set from the GUI and therefore
337do not need to be edited manually.
338
339<DL><DL>
340<DT>graph(printout)<DD>
341This is set to 1 if PostScript files
342will be printed and 0 if they will be written to disk (for Windows all
343files should be written to disk).
344
345<DT>graph(outname)<DD>
346This is the default for the file name used
347when PostScript files will be written to disk.
348
349<DT>graph(outcmd)<DD>
350This is the default for the command used
351to print PostScript files (Unix only).
352
353<DT>graph(legend)<DD>
354Sets the default value for display of the legend in liveplot and widplt.
355
356<DT>peakinfo(obssym)<DD>
357Symbol for observed data points. Valid choices are square, circle, diamond,
358plus, cross, splus and scross.
359
360<DT>peakinfo(obssize)<DD>
361Size for the symbol for observed data points. A value of 1 corresponds to about 1/8 inch
362(about 3 mm).
363
364<DT>expgui(pixelregion)<DD>
365When hkl values are loaded (using tcldump) and reflections are labeled, reflections
366can be labeled using a Shift-Left-Mouse click. All labeled reflections within expgui(pixelregion)
367pixels of the mouse position are assumed to be overlapped and are labeled.
368
369<DT>expgui(fadetime)<DD>
370The time in seconds before reflection labels are removed. A value of zero means that reflections
371must be deleted manually (Shift-Right-Mouse).
372
373<DT>expgui(lblfontsize)<DD>
374A size for reflections labels in pixels.
375
376<DT>expgui(hklbox)<DD>
377If this variable is non-zero, reflection indices are shown in a box.
378
379<DT>expgui(autotick)<DD>
380If this variable is non-zero, reflection markers positions are
381set automatically.
382</DL></DL>
383
384<P>
385<B>Using TCLDUMP with LIVEPLOT.</B>
386LIVEPLOT works with the standard GSAS program HSTDMP, but it works faster and is more
387powerful when used with the TCLDUMP program. Instructions for downloading this file can
388be found in the installation notes for
389<A HREF="expgui_Win_readme.html">
390Windows</A> and
391<A HREF="expgui_Unix_readme.html">
392UNIX</A>. Note that as of the April 2000 releases, GSAS is now distributed
393with TCLDUMP.
394<P>
395<B>Combining CMPR and LIVEPLOT.</B>
396If you have <A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/cmpr.html">CMPR</A>
397installed on your computer, you can use superimpose on the GSAS results
398the peaks for an arbitrary unit cell. If desired, space group extinctions
399can even be shown.
400This is pretty neat! To enable this feature, you must have a version
401of CMPR downloaded after 4 May 1998
402<A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/cmpr.html">
403(see the CMPR installation instructions.)</A>
404For UNIX, create a link from in the expgui
405directory to file cellgen.tcl in the CMPR directory. For example:
406<PRE>
407         ln -s /usr/local/cmpr/cellgen.tcl /usr/local/gsas/expgui/cellgen.tcl
408</PRE>
409For Windows, copy all the CMPR .tcl and .exe files into the expgui directory.
410<P>
411<B>Combining LOGIC and LIVEPLOT</B>
412If you have <A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/logic.html">LOGIC</A>
413installed on your computer, you can superimpose peaks
414for a entry from the ICDD/JCPDS database on a pattern in LIVEPLOT.
415This is also pretty neat!
416To enable this feature, you must have
417a version of LOGIC downloaded after 4 May 1998
418<A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/logic.html">
419(see the LOGIC installation instructions.)</A>
420For UNIX, create a link from in the GSAS GUI
421directory to file icddcmd.tcl in the LOGIC directory. For example:
422<PRE>
423         ln -s /usr/local/powdersuite/icddcmd.tcl /usr/local/gsas/tcl/icddcmd.tcl
424</PRE>
425For Windows, copy all the LOGIC files into the expgui directory.
426<HR>
427<H3>WIDPLT</H3>
428The widplt script is used to display the FWHM for one or more histograms
429from a .EXP file.
430At this point it only works for CW data.
431It is often convenient to add for reference the expected
432instrumental curves as options to the menu. This can be done by creating a
433file called widplot_<i>name</i>. For example, renaming the
434<tt>example_widplt_BT1</tt> file supplied with the distribution to
435<tt>widplt_BT1</tt> will cause the FWHM curves for the NIST BT-1 instrument
436to be added to the menu of defined FWHM values.
437<P>
438Creating such a file is easy. To add a entry define the following
439five array elements using a single, unique element name and then append that
440element name to variable datalist.
441Define
442<PRE>
443    set UVWP(Ge15) {398.5 -343.2  163.0 0}
444    set XY(Ge15) {0 0}
445    set wave(Ge15) 2.0775
446    set lblarr(Ge15) "BT-1 Ge(311) 15'"
447    set ttrange(Ge15) "5 160"
448    lappend datalist Ge15
449</PRE>
450Array element UVWP(item) contains the (Gaussian) GU, GV, GW and GP values,
451while XY(item) contains the (Lorentzian) LX and LY terms. Array element
452wave(item) contains a wavelength, array element lblarr(item) contains
453the text to be shown on the "Plot Contents" menu and ttrange(item)
454defines the range the function is valid.
455<P>
456The following variables are written to <tt>.gsas_config</tt> when
457"Save Options" is used. These variables are all set from the GUI and therefore
458do not need to be edited manually.
459
460<DL><DL>
461<DT>graph(printout)<DD>
462This is set to 1 if PostScript files
463will be printed and 0 if they will be written to disk (for Windows all
464files should be written to disk).
465
466<DT>graph(outname)<DD>
467This is the default for the file name used
468when PostScript files will be written to disk.
469
470<DT>graph(outcmd)<DD>
471This is the default for the command used
472to print PostScript files (Unix only).
473
474<DT>graph(legend)<DD>
475Sets the default value for display of the legend in liveplot and widplt.
476
477<DT>graph(plotunits)<DD>
478Sets the units used for displaying the data. Values are "d", "q", "",
479for d-space, Q and 2-theta, respectively.
480<DT>graph(equivwave)<DD>
481Sets the wavelength used for displaying data, if blank, no conversion is
482done and data are shown in their original wavelength.
483</DL></DL>
484
485<hr>
486<a name="Customizing"><H2>
487Customizing Example 1: Adding a new button to the button bar
488</H2></A>
489When a LeBail extraction is used to refine lattice constants, profile
490terms, ... It is always a good idea to run GENLES a few times after running
491POWPREF. This is because GENLES sets the extracted intensities back to their
492crystallographic values, during the first GENLES cycle after POWPREF has been
493run. Refining anything until the extracted intensities return to reasonable
494values is a really bad idea. Forturnately, running GENLES with the number of
495cycles set to zero gives the Le Bail extraction a head start.
496<P>
497The code below can be used to define a new command, <tt>leBail</tt>. The first
498command adds a command to the button bar and the second one defines what will
499be done when it is invoked (the number of cycles is set to zero and
500GENLES is run three times). It also defines the help entry. Note that commands must start with a lower case letter even though Armel LeBail's last name
501does not.
502
503<PRE>
504    lappend expgui(buttonlist) leBail
505    set expgui_cmdlist(leBail) {
506        {set entryvar(cycles) 0; runGSASwEXP "genles genles genles"}
507        {Converges GENLES with LeBail extractions;
508          Sets the number of cycles to zero and runs GENLES 3 times.}
509    }
510
511</PRE>
512To make this customization, put the above in the <TT>localconfig</TT> 
513file or the
514<TT>~/.gsas_config</TT> or (or <TT>C:\GSAS\EXPGUI\.gsas_config</TT>)
515file.
516<hr>
517<H2>
518Customizing Example 2: Putting DISAGL Results in a Separate Box
519</H2>
520Barbara Reisner has been asking me to put the output from DISAGL in a separate
521window. Sounds like a pretty reasonable request. Here is an example with code
522to do that as a customization option. Please note that this has now been
523incorporated into EXPGUI, so do not use this example.
524<PRE>
525  set expgui(disaglSeparateBox) 1
526  set expgui_cmdlist(disagl) {rundisagl {Hacked Distance/angle calculations}}
527  proc rundisagl {} {
528    global expgui txtvw tcl_version tcl_platform
529    if {$expgui(disaglSeparateBox) && $tcl_platform(platform) != "windows"} {
530        set root [file root $expgui(expfile)]
531        catch {file rename $root.LST $root.OLS}
532        runGSASwEXP disagl
533        catch {file rename $root.LST $root.DIS}
534        catch {file rename $root.OLS $root.LST}
535
536        # open a new window
537        catch {toplevel .disagl}
538        catch {eval grid forget [grid slaves .disagl]}
539        text .disagl.txt -width 100 -wrap none \
540                -yscrollcommand ".disagl.yscroll set" \
541                -xscrollcommand ".disagl.xscroll set"
542        if {$tcl_version >= 8.0} {.disagl.txt config -font $txtvw(font)}
543        scrollbar .disagl.yscroll -command ".disagl.txt yview"
544        scrollbar .disagl.xscroll -command ".disagl.txt xview" -orient horizontal
545        grid .disagl.xscroll -column 0 -row 2 -sticky ew
546        grid .disagl.txt -column 0 -row 1 -sticky nsew
547        grid .disagl.yscroll -column 1 -row 1 -sticky ns
548        grid columnconfigure .disagl 0 -weight 1
549        grid rowconfigure .disagl 1 -weight 1
550        wm title .disagl "DISAGL results $expgui(expfile)"
551        wm iconname .disagl "DISAGL $root"
552        set in [open $root.DIS r]
553        .disagl.txt insert end [read $in]
554        close $in
555        bind all <Control-KeyPress-c> {destroy .disagl}
556        bind .disagl <KeyPress-Prior> ".disagl.txt yview scroll -1 page"
557        bind .disagl <KeyPress-Next> ".disagl.txt yview scroll 1 page"
558        bind .disagl <KeyPress-Right> ".disagl.txt xview scroll 1 unit"
559        bind .disagl <KeyPress-Left> ".disagl.txt xview scroll -1 unit"
560        bind .disagl <KeyPress-Up> ".disagl.txt yview scroll -1 unit"
561        bind .disagl <KeyPress-Down> ".disagl.txt yview scroll 1 unit"
562        bind .disagl <KeyPress-Home> ".disagl.txt yview 0"
563        bind .disagl <KeyPress-End> ".disagl.txt yview end"
564        # don't disable in Win as this prevents the highlighting of selected text
565        if {$tcl_platform(platform) != "windows"} {
566            .disagl.txt config -state disabled
567        }
568    } else {
569        runGSASwEXP disagl
570    }
571  }
572
573if {$tcl_platform(platform) != "windows"} {
574  append expgui(initstring) {
575      $expgui(fm).option.menu add checkbutton  -label "DISAGL window" \
576              -variable expgui(disaglSeparateBox) -underline 0;
577  }
578}
579
580</PRE>
581To make this customization, put the above in the <TT>localconfig</TT> 
582file or the
583<TT>~/.gsas_config</TT> or (or <TT>C:\GSAS\EXPGUI\.gsas_config</TT>)
584file.
585<P>
586Note that the <tt>expgui(initstring)</tt> option became available in EXPGUI
587version 1.21. (Previous versions will ignore this). This code must be executed
588after all the menus and other GUI code has been run. When executed, it
589creates a checkbutton on the Options menu to
590turn the "separate DISAGL window mode" mode on and off.
591
592<hr><H2>
593Customizing Example 3: Adding a new page to EXPGUI
594</H2>
595The steps for creating support for additional functionality, implementation
596of atom constraints, is outlined here. Routines described here can be found in
597file <tt>atomcons.tcl</tt> unless otherwise noted.
598<OL>
599<LI>Create a routine to read and write the appropriate records
600from the .EXP file. In this case, a new routine, constrinfo,
601was added to file <tt>readexp.tcl</tt>.
602This takes considerable care and manual testing.
603<LI>Create a routine that places the appropriate widgets into a frame
604(in this case MakeAtomsConstraintsPane). This routine will be called only once.
605Note that in this example expcons(atommaster) is defined to be the name of the
606frame.
607<LI>Create a routine to display and edit the information shown in the
608frame. In this case, DisplayAtomConstraints. This routine will be called each
609time the page is displayed. Note that this routine and the previous can be
610tested in a separate toplevel until they work well.
611<LI>In this particular example, the previous frame is located on a notebook
612widget that in turn placed on a notebook page, so MakeConstraintsPane is used
613to create this inner notebook when the "Constraints" notebook page is first
614shown. This in turn calls MakeAtomsConstraintsPane and DisplayAtomConstraints.
615To update this page each time it is displayed, DisplayConstraintsPane is
616called.
617<LI>Edit file <tt>expgui</tt> to make the following changes:
618<UL>
619<P><LI>load the <tt>atomcons.tcl</tt> file:
620<PRE>
621# commands for constraints
622source [file join $expgui(scriptdir) atomcons.tcl]
623</PRE>
624<P><LI>Define a notebook page for the option. The -createcmd option
625is used only once, but the -raisecmd option is used every time
626the page is exposed.
627<PRE>
628set expgui(consFrame) [\
629            .n insert end consPane -text Constraints \
630            -raisecmd "set expgui(pagenow) consFrame; DisplayConstraintsPane"\
631            -createcmd MakeConstraintsPane]
632lappend expgui(frameactionlist) "consFrame DisplayConstraintsPane"
633</PRE>
634Note that if we were displaying the atoms constraint page directly on
635the main notebook widget, the previous command would have been
636<tt>-raisecmd DisplayAtomConstraints -createcmd MakeAtomsConstraintsPane</tt>
637<P>
638Since the frame will need to be updated when information in the .EXP file
639changes, the name of the frame and a command to execute are added into list
640expgui(frameactionlist) using the <TT>lappend expgui(frameactionlist)</TT>
641command.
642</PRE>
643</UL>
644</OL>
645<hr>
646<TABLE BORDER BGCOLOR="#FFFF40" ALIGN=RIGHT>
647<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
648</TH></TR></TABLE><BR CLEAR=ALL>
649
650<A Href="http://www.ncnr.nist.gov/programs/crystallography/software/gsas.html">
651GSAS</A>
652is written by Allen C. Larson and <A HREF="http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://lansce.lanl.gov/lujan/staff12/vondreele.htm">
653Robert B. Von Dreele</A>, MS-H805,
654Los Alamos National Laboratory, Los Alamos, NM 87545. Problems, questions
655or kudos concerning GSAS should be sent to Robert B. Von Dreele at <A HREF="MAILTO:vondreele@lanl.gov">vondreele@lanl.gov</A>
656
657<P>This GUI is written by Brian H. Toby of the NIST Center for Neutron Research,
658<A HREF="MAILTO:Brian.Toby@NIST.GOV">Brian.Toby@NIST.GOV</A>.
659
660<P>GSAS is Copyright, 1984-1997, The Regents of the University of California.
661The GSAS software was produced under a U.S. Government contract (W-7405-ENG-36)
662by the Los Alamos National Laboratory, which is operated by the University
663of California for the U.S. Department of Energy. The U.S. Government is
664licensed to use, reproduce, and distribute this software. Permission is
665granted to the public to copy and use this software without charge, provided
666that this notice and any statement of authorship are reproduced on all
667copies. Neither the Government nor the University makes any warranty, express
668or implied, or assumes any liability or responsibility for the use of this
669software.
670
671<P>The GUI is not subject to copyright. Have fun.
672
673<P>Brian Toby (<A HREF="MAILTO:Brian.Toby@NIST.GOV">Brian.Toby@NIST.GOV)</A>
674<BR>
675$Revision: 270 $ $Date: 2009-12-04 23:03:15 +0000 (Fri, 04 Dec 2009) $
676</BODY>
677</HTML>
Note: See TracBrowser for help on using the repository browser.