Mod:basic jmol instructions
Adding Jmol files of your molecule to your wiki
Creating the molecule coordinates file for Jmol
To include a Jmol image of your molecule in your wiki page you need to create a file containing the coordinates of the molecule. The two simplest options to create the file are, one, to use gaussview to save a copy of your molecule as a .mol file or, two, to make a .xyz file. One benefit using the .xyz format is that the files tend to be smaller however they are less convenient to create than .mol files.
- Using Gaussview
- Open your molecule in gaussview
- Navigate to File>>Save
- In the options choose Save As a .mdl file which will default save as a .mol file
- Here is what Gaussview saved for my Mo(CO)(H2)(PH3)4 file:
Title Card Required
Created by GaussView 5.0.8
21 18 0 0 0 0 0 0 0 0 0 0
0.0000 0.0001 -0.2759 Mo 0 0 0 0 0 0 0 0 0 0 0 0
-1.0114 -2.2089 -0.2905 P 0 0 0 0 0 0 0 0 0 0 0 0
-0.3724 -3.3206 0.3305 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.3233 -2.9082 -1.4928 H 0 0 0 0 0 0 0 0 0 0 0 0
2.2110 -1.0100 -0.1928 P 0 0 0 0 0 0 0 0 0 0 0 0
2.4180 -2.2493 0.4785 H 0 0 0 0 0 0 0 0 0 0 0 0
2.9665 -1.3716 -1.3435 H 0 0 0 0 0 0 0 0 0 0 0 0
1.0119 2.2095 -0.2895 P 0 0 0 0 0 0 0 0 0 0 0 0
0.3724 3.3212 0.3310 H 0 0 0 0 0 0 0 0 0 0 0 0
1.3254 2.9092 -1.4910 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.2110 1.0100 -0.1928 P 0 0 0 0 0 0 0 0 0 0 0 0
-2.4189 2.2495 0.4779 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.9666 1.3708 -1.3438 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.0004 -0.0005 1.6924 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.0008 -0.0015 2.8595 O 0 0 0 0 0 0 0 0 0 0 0 0
0.3612 -0.1679 -2.2213 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.3616 0.1688 -2.2210 H 0 0 0 0 0 0 0 0 0 0 0 0
3.2908 -0.3410 0.4520 H 0 0 0 0 0 0 0 0 0 0 0 0
2.2782 2.4471 0.3189 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.2786 -2.4473 0.3161 H 0 0 0 0 0 0 0 0 0 0 0 0
-3.2906 0.3408 0.4522 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
1 5 1 0 0 0 0
1 8 1 0 0 0 0
1 11 1 0 0 0 0
1 14 1 0 0 0 0
2 3 1 0 0 0 0
2 4 1 0 0 0 0
2 20 1 0 0 0 0
5 6 1 0 0 0 0
5 7 1 0 0 0 0
5 18 1 0 0 0 0
8 9 1 0 0 0 0
8 10 1 0 0 0 0
8 19 1 0 0 0 0
11 12 1 0 0 0 0
11 13 1 0 0 0 0
11 21 1 0 0 0 0
14 15 2 0 0 0 0
- Making a .xyz file manually
- You need to make this file yourself in a text editor
- A .xyz file has 3 sections
- First line: number of atoms in the molecule
- Second line: comments or title
- Following lines: atomic symbol followed by xyz coordiantes
- here is my Mo(CO)(H2)(PH3)4 file:
21 Mo(CO)(H2)(PH3)4 molecule Mo 0.000045 0.000102 -0.275893 27.797760 P -1.011401 -2.208947 -0.290536 -0.223504 H -0.372372 -3.320581 0.330463 0.085105 H -1.323285 -2.908209 -1.492765 0.082766 P 2.211020 -1.009990 -0.192847 -0.228591 H 2.418011 -2.249283 0.478494 0.087153 H 2.966565 -1.371591 -1.343488 0.086278 P 1.011822 2.209531 -0.289514 -0.223545 H 0.372347 3.321200 0.330959 0.085111 H 1.325404 2.909252 -1.491038 0.082797 P -2.211044 1.010021 -0.192849 -0.228575 H -2.418954 2.249487 0.477851 0.087149 H -2.966577 1.370804 -1.343808 0.086292 C -0.000389 -0.000536 1.692395 0.257683 O -0.000758 -0.001484 2.859470 -0.335269 H 0.361190 -0.167921 -2.221343 0.079092 H -0.361610 0.168783 -2.220950 0.079020 H 3.290813 -0.341001 0.452049 0.086821 H 2.278178 2.447165 0.318854 0.084820 H -2.278543 -2.447297 0.316108 0.084741 H -3.290613 0.340775 0.452167 0.086826
- Making a .xyz file using Molden
- Alternatively you can create a .xyz file using a program called Molden (providing you have access to, and are familiar with, Molden)
- Open your molecule in Molden (this will require typing molden file_name.log)
- Navigate to the Molden Control window and select Write
- Select XYZ from the drop down menu - this will prompt the Molden Query Box to open
- Enter the file name you wish to use in the grey panel (ensuring there are no spaces - use underscores) and end with .xyz then select apply
- Click the Skull button to quit Molden
- Note: You should only use this method if you are familiar with Molden or have consulted the Molden Basics wiki page (coming soon).
- Alternatively you can create a .xyz file using a program called Molden (providing you have access to, and are familiar with, Molden)
Load your file
Load your file containing the molecule coordinates onto the wiki (as you would an image!)
- Load your molecule to the wiki, eg choose "upload file" from the menu to the left and follow the instructions
How to add a Jmol to your wiki
- There are two options to add a Jmol of your molecule.
- One method would be to add a button that will open a separate window with a Jmol molecule in it. This is the preferred option.
- Alternatively you can have the Jmol embedded directly into your wiki page. Use this option SPARINGLY!! Too many Jmol images will slow down the loading of your wiki page
Adding a button for your Jmol
- Add the following text to your wiki page replacing "MoCOH2PH3_4.xyz" with your file name as a .mol or .xyz file
- for a button that will open a new window
<jmol> <jmolAppletButton> <uploadedFileContents>MoCOH2PH3_4.xyz</uploadedFileContents> <text>Mo(CO)(H2)(PH3)4</text> </jmolAppletButton> </jmol>
- this will produce the following:
- Embedding an image on your wiki page
<jmol><jmolApplet> <title>Mo(CO)(H2)(PH3)4</title> <color>white</color> <size>200</size> <uploadedFileContents>MoCOH2PH3_4.xyz</uploadedFileContents> </jmolApplet></jmol>
- This will produce the following:
test molecule |
- The title tag is self explanatory
- The colour tag sets the background colour to white
- The size tag sets the size of the Jmol image to display
- The uploadfile tag determines the file to load
Beware! You can corrupt your wiki if you type the Jmol XML incorrectly. Recovering from such an error is difficult! You should save your wiki before inserting any Jmol molecules and be careful that you put in the text exactly as it is here. It is advisable to copy then paste the text directly into your wiki then manually edit the appropriate file name and title, as well as any other changes you may wish to make such as background colour or window size.
More information on backing up and fixing your report after a crash can be found here: fixing wiki problems
Visualising MOs using Jmol
It is possible to superimpose MOs over the skeletal framework of your molecule. To do this you must first generate a cube (.cub) file for each MO of interest using Gaussview.
How to generate .cub files
This procedure assumes two things:
- The geometry of your molecule has been properly optimised
- You have performed a single point energy calculation with the key words pop=(full,nbo)
Using Gaussview, double click the .fchk file corresponding to your molecule and navigate to Edit>>MOs
Visualise however many MOs you require. Take note of the index numbers corresponding to the MOs of interest.
In Gaussview navigate to Results>>Surfaces/Contours. In the Cubes Available box select the first MO of interest and then from the drop down box Cube Actions select Save Cube. Repeat as necessary until you have saved all of the cube files corresponding to the MOs of interest.
Alternatively, instead of using Gaussview, the cubegen utility can be used (this is, of course, dependent on whether you have accessto computer with cubegen installed on it). If you do have access, then proceed by typing the following command in the command line:
./cubegen 0 MO=41 filename.fchk filename_mo41.cub 0 ./cubegen 0 MO=35 filename.fchk filename_mo35.cub 0
where filename.fchk is the original name of the .fchk file. The cube files generated (i.e. filename_mo41.cub) are likely to be quite large (a few megabytes in size). These files can be used to visualise the MOs over the molecular framework however owing to their size this will cause impossible webpage loading times. It is therefore advisable to reduce the size of the .cub file by processing it using Jmol, creating a .jvxl file.
Creating .jvxl files from .cub files
The .jvxl file is around 100 to 150 times smaller than the original .cub therefore it is strongly advisable to follow this procedure!!
There are a couple of ways to convert a .cub file to a .jvxl file
- One method is as follows:
- Open Jmol (Jmol.jar). If you do not have Jmol, it can be obtained from here
- Navigate to File>>Open and select your .xyz or .mol file for your molecule framework
- Once your molecule has loaded, navigate to File>>Open and select your first .cub file corresponding to an MO. This will load the MO on to the framework.
- Right click on the Jmol display window prompting a floating menu bar to appear. Navigate to File>>Save JVXL isosurface in the floating menu. This will allow you to save a jvxl file.
- You can then open another .cub file by selecting File>>Open in the menu at the top of the display window which will overwrite the first MO.
- Repeat the saving procedure as necessary
- Note: I know this is time consuming - I will try and identify an alternative method
- Alternative method (number 1) for creating a .jvxl file
- Navigate to this page where you will be able press a button prompting you to select your cube file.
- This will be followed by three file save dialogs, one for the coordinates (.xyz), one for the MO surface (.jvxl) and a shrink-wrapped bundle (.pngj).
It is possible to reduce the size of the .jvxl file further by compressing it using gzip (Jmol will automatically detect and decompress this). You will end up with something that looks like name.jvxl.gz and you can safely rename this file to the original name.jvxl
Incorporating Jmol with MOs into your wiki
This method is very similar to the instructions outlined above for loading your Jmol molecule into your wiki page however, the Jmol XML script has been modified slightly to include the molecular orbital.
First, you will need to insert the following code into your Wiki, replacing the file name in between the <uploadedFileContents></uploadedFileContents> tags with the .xyz or .mol file, corresponding to your molecule from earlier.
<jmol>
<jmolApplet>
<title>Orbital</title><color>white</color><size>300</size>
<script>isosurface color orange purple "images/f/f3/MoCOH2PH3_4_mo23.jvxl" translucent;</script>
<uploadedFileContents>MoCOH2PH3_4.xyz</uploadedFileContents>
</jmolApplet>
</jmol>
In a new window, upload the .jvxl files on to the wiki using the Upload multiple files link. Once uploaded, keep this window open and select the link to the first MO.
The browser window should now look like the image below. Click on the link as indicated by the red arrow.
The browser window should now display the contents of the .jvxl file (in XML format). You will need to find the absolute path for the .jvxl file. Luckily this is displayed in the address bar at the top of the browser. This will appear as something like:
https://wiki.ch.ic.ac.uk/wiki/images/f/f3/MoCOH2PH3_4_mo23.jvxl
You will need to copy the equivalent text to:
images/f/f3/MoCOH2PH3_4_mo23.jvxl
This should be pasted into the Jmol code on your wiki page. This text should be pasted in between the <script></script> tags
Hopefully if all goes well you should get something similar to this:
Orbital |
An alternative way of loading surfaces
This method avoids the need to specify paths to files as seen above. Instead uses the .pngj bundle which contains all necessary information and can be invoked by
<jmolFile text="link to MO23">MoCOH2PH3_test_mo23.cub.pngj</jmolFile>
which produces a link to MO23. This method is not as flexible as the above.
Making your Jmol more awesome
Section coming soon