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:
- 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.
- How to install Jmol and Perl to create web pages containing vibration modes animations.
- Preliminary steps concerning CRYSTAL and JMOLEDIT will be illustrated.
- A simple web page will be generated by using the WEBVIB Perl script.
- The main options of the WEBVIB script will be described.
- 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)
- Microsoft Internet explorer (all versions)
- Firefox (version 1.0 or higher)
- Mozilla (all versions)
- Netscape (version 7 or higher)
- Opera (since version 7.5.4)
b) Linux
- Firefox (version 1.0 or higher)
- Mozilla (version 1.6 or higher)
- Konqueror (version 3.3 or higher)
c) Mac OS X
On Mac OS X (10.3 or higher)
- Firefox (version 1.5 or higher)
- Mozilla (version 1.7.3 or higher)
- Netscape (version 7.2 or higher)
- Opera (since version 7.5.4)
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
|
|
If the test fails,
- for security reasons, Java is disabled on your browser.
click here to solve this problem
- or Java is not installed on your machine.
click here to install Java.
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:
.../vibs/
.../vibs/beryl
.../vibs/beryl/Jmol.js
.../vibs/beryl/JmolApplet.jar
.................
.../vibs/beryl/index.html
.../vibs/beryl/XYZfiles/beryl_1.xyz
.../vibs/beryl/XYZfiles/beryl_2.xyz
.../vibs/forsterite
.../vibs/forsterite/Jmol.js
.../vibs/forsterite/JmolApplet.jar
.................
.../vibs/forsterite/index.html
.../vibs/forsterite/XYZfiles/forsterite_1.xyz
.../vibs/forsterite/XYZfiles/forsterite_2.xyz
.................
.
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
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.
- Go to the Jmoledit page
- 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.
- Click on Open CRYSTAL file and select a CRYSTAL output file on your harddrive. Click OK.
- 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).
- 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.
- 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.
- 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.
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:
It generates the folowing files:
|
Files |
Description |
XYZfiles/system_1.xyz XYZfiles/system_2.xyz . .
|
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 beryl_4.xyz)
|
|
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.
- 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 file.xyz |
- 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 file.xyz |
In the following section we will present all
the possible options of the webvib script.
The options are gathered in 7 parts:
- Title
- Vibration
- View
- Alternative view
- Cell
- Polyhedra
- Bonds & atoms
- Advanced controls
I) Title
| Question | Default | Variable |
| | - 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).
| Question | Default | Variable |
| | - 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:
- Perspective
sets/unset the persective view.
- View along the axes
These 3 buttons reorient the system along x,y and z, respectively.
| Question | Default | Variable |
| | + 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).
| Question | Default | Variable |
| | + 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.
| Question | Default | Variable |
| | + 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
| Question | Default | Variable |
| | + 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 | | $poly[XX] |
See the example of the beryl.
VII) Atoms & bonds
| Question | Default | Variable |
| | + 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
| Question | Default | Variable |
| | + 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:
- Title
- Multiple systems
- Polyhedra
- Atoms
- Cell
I) Title
Same as before.
II) Multiple systems
| Question | Default | Variable |
| | + How many systems? | 2 | $nsystem; |
| | + name of system number XX | 2 | $sysname[XX]; |
The last question is repeated for each system.
III) Polyhedra (simplified version))
| Question | Default | Variable |
| | + Display polyhedra? | No | $lpoly; |
| | - How many polyhedra? | 0 | $nbpoly |
| - Polyhedra numder X :
- Atomic number of the central atom. | | $poly[X] |
IV) Atoms (simplified version))
| Question | Default | Variable |
| | + Change the default color of atoms? | No | $lcolor |
Same as the end of the "ATOMS & BBONDS" part previously described.
V) Cell (multiple version))
| Question | Default | Variable |
| | + 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
- Create a webpage presenting the calcite modes from CRYSTAL output
- Create a webpage containing the 3 carbonates
(calcite,
dolomite and
magnesite).
Change the default color of calcium atoms (very close to magnesium)
- 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