Home About Description Documentation Download News Register  
XCrySDen --
(X-Window)
                          CRYstalline Structures and DENsities

[Figure]
XCrySDen's scripting HOWTO

Table of Contents

What is scripting
   The "scripting::" scripts
   The XCrySDen generated scripts

What is scripting

In some circumstances it would be desirable to perform particular tasks in some automatic way without any user interactivity. In such a case the executive operations are encapsulated inside a script. Typical use of scripting is when several similar jobs have to be performed, such as, for example, plotting all the valence molecular orbitals (MO) of a give molecule. Typically in all MO plots one would like to keep the same display parameters. It would really be cumbersome and a pure waste of time to perform, for example, 15 alike jobs interactively. In such cases scripts would be much more convenient as all operations would then be performed in automatic way. XCrySDen have specially designed programming scripting interface for achieving above mentioned goal. XCrySDen scripts use the Tcl syntax. Technically speaking XCrySDen scripts are Tcl scripts. The specially designed scripting functions use the scripting:: namespace. However one can use any XCrySDen Tcl function in such scripts. XCrySDen scripts can be either loaded from command line as xcrysden -s scriptFile or xcrysden --script scriptFile, or alternatively from menu File-->Open Structure ...-->Open XCrySDen Scripting File .

The "scripting::" scripts

In scripts that were manually written the scripting:: functions most likely represent the majority of the commands. Here you can found documentation about the scripting:: interface, together with hypertext examples. The documentation was automatically generated from the source code. The easiest way to learn "how to write" such scripts is to start with examples. The basic knowledge of Tcl-syntax is welcome here. The examples are well documented, and since they are written in hypertext manner, they have hypertext references to all used functions. XCrySDen distribution contains several scripting examples. See the $XCRYSDEN_TOPDIR/examples/Scripting/ directory. They can be also accessed using the File-->XCrySDen Examples ...-->Scripting Files menu. Here is a list and short description of several scripting examples:
animation.tcl
-- a simple example for animating a molecular structure
atomic_labels.tcl
-- shows how to edit atomic labels
build_crystal.tcl
-- animates and builds a crystal structure
colorplane_animation.tcl
-- a simple example for animating a contour plots
contours.tcl
-- plots contours+colorplane from XSF file
g98cube.tcl
-- a simple example for display of MO from Gaussian cube file
isosurface+colorplane+print.tcl
-- plots and prints isosurface and contours
movie.tcl
-- a simple example for making a MPEG movie
multiScript.tcl
-- a simple example of multi-job script

The XCrySDen generated scripts

There exists another type of XCrySDen scripts. This type of files is automatically created by XCrySDen when saving the current state and structure using the File-->Save Current State and Structure menu. The default file-extension of these files is *.xcrysden. Such a script contains the structure and the majority of the display parameters. When the script will be loaded (i.e. as xcrysden -s script) the structure will be displayed in the same way as it was saved, i.e., having the same orientation, zoom, colors, and other display parameters. These scripts do not use the scripting:: interface, and are messy although somewhat documented. It is possible to use part of these scripts together with the manually created scripts. A typical use would be: display a structure and set proper display parameters. Save with File-->Save Current State and Structure . Then use this saved parameters (this means extracting the right part of the *.xcrysden file) inside the manually created scripting:: script. Here is an example of *.xcrysden script.
 

Home | About | Description | Documentation | Download | News | Register
Webmaster: Tone Kokalj
This document was last modified on Tue May 31 10:23:33 CEST 2005