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