next up previous contents
Visit our: CCMS Home Page
Send us your comments on this user guide: CCMS Comment Form
Next: Chapter 4 Programming XtalView Up: Table of Contents Previous: Chapter 2 Getting Started


Chapter 3

Using XtalView


Software Overview


XtalView Crystal Database

XtalView is organized around the concept of a crystal. A crystal is all data that have a common unit cell and space group. The information for this crystal is kept together in a database file. You can access this information from any XtalView program by entering the name of this file into the Crystal field or by setting the environment variable CRYSTAL. The file format is ASCII text and you may edit its contents. It consists of lines with a keyword followed by data. xtalmgr provides a facility for editing new crystal files or copying an existing one. xtalmgr knows about all 230 space groups.

History Files

XtalView is an entire system for organizing and tracking crystallographic data. All data files created by XtalView also have an associated history file that contains the name(s) of the input file(s), the date created, and all the values of variable parameters. The history file is the key to tracking data and keeping records. You can use it to track all data backwards and forwards, where the data has been, and how it was created. Previous errors can be found by searching through the history files. Intermediate data files can be deleted and later recreated by using the information in the history files. This can save a tremendous amount of disk space. A history file has the same name as its parent file, with the extension .hist.

File Formats

All XtalView data are stored in files. Almost all such files are ASCII text. Map files are in FORTRAN binary form for backwards compatibility. Records are separated by end-of-lines and data fields are separated by white space (a comma is not considered white space). Columns are not necessary, except in PDB files, the standard to which XtalView faithfully adheres for better or worse. The files are easily readable by FORTRAN or C programs. The ASCII format allows you to import and export data to and from XtalView easily and allows you to browse the data. It also forms the major bottleneck in running programs, since every line of an ASCII file must be scanned and converted as it is read in or written out. Given the trade-offs, it seems like a price worth paying.

As few file formats as possible are used. Standard extensions are used. Strict typing of these extensions is not enforced: although it would make the system much more robust, it would also make XtalView less backward-compatible. The most common file types are described below.

Other File Formats Supported

Many other formats are supported by various programs, such as .mu and .rfl files from XPLOR .fobs files; and TNT .hkl files. xprepfin can be used to import/export .fin files to/from a variety of formats. All of your format woes can be solved by learning to use awk. For example, to read in a file with h k l fp sigma(fp) (fp(-)-fp(+)) into .fin format with awk, enter the command line:

awk '{print $1, $2, $3, $4, $5, $4+$6, $5}' import_file > imported.fin

Plotting

Plotting is done using PostScript. You can view PostScript with a previewer such as pageview, ghostview, xpsview, or dxpsview. Services are available for preparing slides from PostScript files commercially.


Using XView


XtalView was written using the XView toolkit because it can be ported at no expense to any system capable of running MIT's X11 system. XView provides an amazing amount of functionality. For instance, the textpane windows can be edited and stored into a file, and data can be cut and pasted into other windows without any new code being written. XView is not specific to any window manager and MOTIF and XView can live side-by-side in harmony. It will run under any XWindows manager, although there will be differences in regard to headers and footers, which are never essential in any case. You may occasionally encounter difficulties with fonts because not every system has the necessary fonts pre-installed. If related problems arise, see "Setting Up Your Environment" in Chapter 2.

X11 Features

X11 has the nifty feature of being networkable. An application can run on one machine but display on another machine. The other machine can be in the same building or at another institution as long as they have a TCP/IP connection. The window managers can be different and the graphics (usually) can be displayed regardless. To do this, type xhost + hostname on the machine you want to display on (where hostname is the name of the machine on which you want the program to run). Then set the environment variable DISPLAY with: setenv DISPLAY display-hostname:0 on the machine the program will run on. Alternatively, you can add the flag -display display-hostname:0 to the command line. There are many command line options available to X applications and this applies to all XtalView programs. For instance, the default font can be changed, etc. A complete list of flags can be found in Volume 0 of the X11 user's guide.

Textpanes

Every XtalView application has a textpane where various messages are sent. This effectively forms a log of each session. It can be saved if the user wishes by selecting the file option on the menu that appears when the <Menu> button (right mouse button) is pressed anywhere within the textpane.

Backgrounding

If you start applications at the command line instead of using xtalmgr, then you can run them either in the foreground or background. It is best to start them with the & sign at the end of the command line to put the application in the background so that the cursor is returned and you can continue using that window for input. If you forget to do this, use ^Z to stop the application and then type bg to background it. If you ^Z and then do not background, do not use the application in any way or your computer will hang! The only way to recover from such a hangup is to rlogin from another computer and kill the process. This is not a bug in XtalView, but is a problem with the window manager and beyond us users to fix.

The bottom line is that you should not let stopped windows sit around: they are ticking time bombs.

Input and Output Files

All files in XtalView are opened with a common routine so that I/O is consistent throughout the system. The filename can be substituted with a dash (-), in which case input is taken from stdin and output is taken from stdout. This feature allows piping between applications. However, the chain of history files will be broken since the application has no way of knowing where the stdin originated or where the stdout goes to. Pipes are faster than using an intermediate file, and in some cases may be beneficial. Stdin cannot be used if the input needs to be rewound. If so, you will get an error message telling you this. The remedy is to use an intermediate file. If you try to overwrite an output file you will be notified with a box that will ask if it is OK to overwrite the file. You can accept or cancel. These notices can be confusing if you are running many jobs at once, since the notice may appear after a delay in some applications where extensive computing is required and the notice box may appear out of context. It is not always obvious which application is doing the asking.

Too Many Windows?

If your computer is sluggish and appears to be swapping all the time, you are probably out of memory. In this case, terminate all unneeded windows, whether opened or closed and things should improve. It is easy with XtalView to open many windows. The other alternative is to obtain more memory for your machine (highly recommended). A modern graphics workstation should have an absolute minimum of 16M and preferably 32M. Memory is inexpensive and is getting more so all the time.


Using XtalView Windows


XtalView uses standard XView widgets, including the following.

  • Command buttons

  • Window buttons
  • Menu buttons
  • Text fields
  • Numerical fields
  • Setting fields
  • Check boxes
Each of these widgets is discussed here.

Command and Menu Buttons

XtalView uses 3types of buttons: command buttons, window buttons, and menu buttons. Examples are shown in Figures 1 and 2.

Command and window buttons

On the left is a command button. By clicking on this button with the <Select> (left) mouse button, you can execute a command. The button on the right is a window button, as indicated by the ellipses (three dots). When you click on this button, a new window will pop up.

A menu button contains a down-pointing triangle. When this button is activated, a pull-down menu appears with more options, as shown in Figure 2.

Menu button and its pull-down menu

To activate a pull-down menu, position the mouse pointer on the button and hold down the mouse's <Menu> button (usually the right button), and then drag the pointer down to highlight the menu item you desire. Release the <Menu> button to activate the item. The box around the first menu item indicates that it is the default. Click on the button with the <Select> (left) mouse button to activate the default item. The last menu item in Figure 2 has three dots following it, indicating that a pop-up window is associated with it. Another possibility is a right-facing triangle, which indicates a pull-right menu associated with a menu item.

The thumbtack indicates that this window is pinnable: By clicking on the tip of the pin, you can keep this menu open on your screen after you release the mouse button. You can then move the window to another area and activate its items at any time.

Text field

A text field enables you to assign a character string to a particular item. In Figure 3, for example, the text field Label allows you to create or edit a label for a particular item.

Text field

After you enter text, be sure to press the <Return> key to ensure that the program registers your changes.

Numerical field

A numerical field is similar to a text field. It is used for entering integers, as shown in Figure 4.

Numerical field

You can type in and edit the integer in the field. Furthermore, arrow buttons to the right of the field allow you to increase or decrease a value by 1 unit each time you click on them with the mouse.

Slider field

A slider field (Figure 5) is another way to enter an integer. This field graphically displays the range of integers you can select.

Slider field

In a slider field you can either type in and edit the integer or drag the slider bar to the desired value using the <Select> mouse button. Sometimes a value is hidden from view if it is not important for your use of the program.

Setting field

A setting field (Figure 6) allows you to choose between a small number of options. The option currently selected is highlighted.

Setting field

In this example, Air is the selected option. To choose a different option, point the mouse to your desired selection and press the <Select> mouse button.

Check box

A check box (Figure 6) allows you to turn an option on and off.

Check box

In this example, Option 2 is selected. To turn off an option that is selected, position the mouse pointer over the box and press the <Select> mouse button.

Triangle button

When space is tight, a menu may be indicated by a small button that has only a triangle on it. Use the menu button on this triangle to pull down a menu of choices. This is commonly used to list all of the choices possible for a text field. For example, in xtalmgr a menu button allows you to pull down a menu of all of your crystals.


Closing Pop-up Windows


Closing pop-up windows is dependent on the X11 window manager you are using. With most window managers, a pull-down menu appears when you press the <Menu> mouse button in the pop-up window's title bar.

Select Close or Quit from this menu to close the pop-up.



next up previous contents
Visit our: CCMS Home Page
Send us your comments on this user guide: CCMS Comment Form
Next: Chapter 4 Programming XtalView Up: Table of Contents Previous: Chapter 2 Getting Started