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