CRYSTAL home page CRYSTAL home page

Polyhedral view of beryl

Vibration modes on a web page using Jmol
Y. Noel


In this tutorial, we will describe how to generate html pages where the system of interest is represented in 3D and vibration modes are animated. This will permit to classify the modes and to produce documents for publications. This is performed by using the Jmol applet.

The tutorial is organized as follows:

  1. How to install the software required (Java, Javascript) in order to see an existing web page containing a vibration animation; and how to test the configuration of your computer.
  2. How to install Jmol and Perl to create web pages containing vibration modes animations.
  3. Preliminary steps concerning CRYSTAL and JMOLEDIT will be illustrated.
  4. A simple web page will be generated by using the WEBVIB Perl script.
  5. The main options of the WEBVIB script will be described.
  6. Various examples will illustrate how to use WEBVIB

Checking and installing Javascript and Java software
Web pages that contains Jmol applets require Java installed and recognized by your browser

I) Browser compatibility with Jmol
Verify if your browser is in the following list ;
if not, update your system in order to have compatibility with Jmol. (From the Jmol web site)
a) Windows
On Win32 (All versions since 98)
b) Linux
c) Mac OS X
On Mac OS X (10.3 or higher) If you cannot find which browser you are using, click here to get the required information (if a green square appears, everything is OK).
II) Verify if Javascript is enabled on your machine
The following box informs you if Javascript is enabled
(If the box is empty, Javascript is disabled; click here to enable javascript)
III) Verify if Java is installed/enabled on your machine
The following box informs you if Java is enabled
Java is NOT enabled on this machine!

If the test fails,

IV) Test Jmol on your machine
Click here to see your first Jmol applet (a window containing a diamond unit cell should appear).

Installing Jmol and Perl for creating the web page

I) Downloading and installing Jmol on your machine
Click here to download the Jmol last version. Uncompress the archive. All the Jmol files must be copied in each work directory that will contain the html page.

For example suppose that we will create two html pages, the first containing the animation of the modes of beryl and a second with those of forsterite. The organisation of the directories will be:


II) Installing Perl on your machine
Click here to download Perl (Perl is already installed on most Linux machines).

Generating data from CRYSTAL and JMOLEDIT

I) CRYSTAL keyword to be used
To obtain the eigenvectors of normal modes, the "MODES" keyword in the FREQCALC part of the input file must be inserted.
II) Jmoledit
The Jmoledit interface Jmoledit is an html page that contains a Jmol applet, in which crystalline structures can be manipulated. Jmoledit can be used under Windows, Linux and Mac OS X but must be used with the Firefox browser.
  1. Go to the Jmoledit page
  2. A message appears asking you to accept a certificate. This certificate has to be accepted in order read and write output files on your local harddrive.
  3. Click on Open CRYSTAL file and select a CRYSTAL output file on your harddrive. Click OK.
  4. After few seconds (depending on the system size) the sytem appears in the Jmol frame. The box on the right of the "open" button allows you to increase the size of your system. For example if you want to consider atoms that have a fractional coordinate along a between -0.2 and 0.2 change "0" and "1" on the first line to these values ("-" and "+" buttons change the value by 0.1).
  5. Once you are almost satisfied with your set, you may select atoms and delete them. To select an atom click on it (it becomes translucent). To unselect an atom click again on it. To remove selected atoms click the Remove unwanted atoms buttons. To make this step easier 2 tools are available. The select unwanted atoms with a plane button allows you to select atoms on one side of a plane. The select uncomplete polyhedra button allows you to select atoms that form an uncomplete polyhedra.
  6. Atoms that have been removed can be restored through the Undo remove button.
    These options permit you to select a fraction of the infinite crystal that will be used for the web page.
  7. Once satisfied with the view of your system, click the Use this set of atomsto generate the corresponding xyz file needed by WEBVIB to create an animation. Save it on localy with the Save xyz file button.
A simple web page

The beryl example obtained with the command line : webvib quick Webvib is a perl script; it is called from the command line and takes as input a .xyz file (saved from JmolEdit). It splits this file to create one .xyz file by mode (stored in the XYZfiles directory) that can be read by Jmol. It generates of course also an html page that contains the Jmol applet and several controls that affect the system representation. In this simple case we will use the "quick" command line option to run the script with defaults and generate very simple page. On the left part of the html page, is the list of the modes; You can choose with radio buttons to focus only on modes of a given activity or symmetry. Under this list a key-color is automaticaly created. The right part contains the Jmol applet.

This command line is:
webvib quick

It generates the folowing files:

Files Description
Each file refers to one mode only. It contains frequency, activity, symetry of the mode, atoms position and eigenvectors.
Click here to see an example refering to the fourth mode of beryl (file
index.html The web page

The webvib script options

Webvib lets the user set several variables/options that control the layout of the produced web page. Two ways are available to set these variables.

  1. Edit by the hand a configuration file and set the variables as you wish (using the perl syntax; click here to see an example). If the configuration file is called var.dat, the command line is for example: This command line is:
    webvib with var.dat
  2. The user has only to answer to questions prompted by the script which create (or update) the configuration file containing the perl variables. The command is then simply :
    To modify an existing configuration file you can edit directly the file and run the command as above; or go through the questions typing the following command:
    webvib modify var.dat

In the following section we will present all the possible options of the webvib script. The options are gathered in 7 parts:

I) Title
| - Title.  $title
| - Authors.  $author
| - Reference  $status
Thanks to these informations a header is added on the top the page.

See the example of the beryl.

II) Vibration
The vibration controls consist in two checkboxes (animation on/off and vectors on/off) and two groups of radio buttons controling the amplitude of the movement and the size of the vectors.
NB : If the scale control is not adapted, remember that you can rescale globaly the eigenvectors in the "File" bloc of the script (ie when the mol files are converted in xyz).
| - Animation initially active? Yes$defanim
| - Vectors initially active? No$defvect

See the example of the beryl.

III) View
The View controls are separated in 3 parts:
| + Display the Perspective checkbox? Yes$lpersp
| - Perspective initially checked ? No$defpersp
| + Display the "View along" buttons? Yes$lalong

See the example of the beryl.

IV) Alternative view
Sometime the structure contains a lot of atoms and is not necessarly clear to understand easyly of subgroups. thus an alternative view few atoms can be usefull. To insert such a "subsystem", you will need a mol file. The script will convert it in xyz files (as for the main structure; see).
| + Display an alternative view of the system? No$lsub
| - Enter filename  $filenamalt

See the example of the beryl.

V) Cell
The script can extract the cell information from the CRYSTAL output. Sometime the CRYSTAL origin is not the same as in the mol file and can be translated with the shift option. A checkbox controls its display.
| + Display the "Cell" checkbox? No$lcell
| - Extract the cell from the CRYSTAL output? No$lcrycell
| - CRYSTAL output filename .out$cryname

See the example of the beryl.

VI) Polyhedra
| + Display polyhedra? No$lpoly;
| - How many polyhedra? 0$nbpoly
| - Polyhedra numder X :
- Atomic number of the central atom.
| - Initial type of polyhedra?
none:0 transparent:1 or solid:2

See the example of the beryl.

VII) Atoms & bonds
| + Display the "Atom size" control? Yes$latsize
| - Initial atom size?
| Tiny:0, Small:1 or Big:2 1$defatsize
| + Display the "Bond width" control? Yes$lbond
|Initial width?
| Thin:0 or Thick:1 1$defbond
| + Display the "show hydrogen" checkbox? No$lHydro
| + Display the "H bonds" checkbox? No$lHbonds
| + Change the default color of atoms? No$lcolor
| - How many atoms to change? 0$nbcolor
| - Enter atomic number of the atom.
new RGB color of XX:
| - Enter Red component (0-255)  Rcolor[XX]
| - Enter Green component (0-255)  Gcolor[XX]
| - Enter Blue component (0-255)  Bcolor[XX]

See the example of the beryl.

VIII) Advanced controls
| + Add a jmol script command to your system? No$lcom
| - Enter the command.  $command

Multiple systems on a single web page
Once again this kind of page is generated trough configuration file/questions. To configure the layout of your page use the previous commands with multiple as filename. For example:
webvib multiple
webvib with var.dat multiple
webvib modify var.dat multiple
The options of these kind of pages are reduced due to the limited space available. The options are grouped in 5 categories:

I) Title
Same as before.
II) Multiple systems
| + How many systems? 2$nsystem;
| + name of system number XX2$sysname[XX];
The last question is repeated for each system.
III) Polyhedra (simplified version))
| + Display polyhedra? No$lpoly;
| - How many polyhedra? 0$nbpoly
| - Polyhedra numder X :
- Atomic number of the central atom.
IV) Atoms (simplified version))
| + Change the default color of atoms? No$lcolor
Same as the end of the "ATOMS & BBONDS" part previously described.
V) Cell (multiple version))
| + Display the "Cell" checkbox? No$lcell
| - Extract the cell from the CRYSTAL output? No$lcrycell
| - CRYSTAL output filename .out$cryname[$i]
The last question is repeated for each system.

To create webpages you need Jmol.js, JmolApplet.jar and WEBVIB script

  1. Create a webpage presenting the calcite modes from CRYSTAL output
  2. Create a webpage containing the 3 carbonates (calcite, dolomite and magnesite). Change the default color of calcium atoms (very close to magnesium)
  3. Create a web page presenting the beryl vibrations. Select the atoms in order to emphasize the ring of SiO4 tetrahedra in this silicate.(output )
Solutions to exercises can be found here: The complete JMolEdit package (jmoledit + webvib) can be downloaded here

CRYSTAL home page CRYSTAL home page