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