Tuesday, 18 October 2011

Orbitals in Jmol

Actually automatic plotting of orbitals in Jmol is even easier than in VMD, considering that Jmol can directly read the output of many major quantum chemical programs, or alternatively Molden format files.

The only thing is that Jmol does not have all of its functionality easily available over a menu, so you should always have the scripting manual ready and use the console inside the program. But then it is rather easy to use. And the advantage of script based input is that you can naturally automatize repetitive tasks. For visualizing orbitals it can look something like this (you can just copy this directly into the Jmol console):

background white
mo fill
mo cutoff 0.03

mo homo

At this point you would probably play with the perspective a little bit. Then you continue by saving this picture and all other pictures of orbitals you are interested in, e.g.

write image png "homo.png"
mo homo-1
write image png "homo1.png"
mo homo-2
write image png "homo2.png"
mo lumo
write image png "lumo.png"
mo lumo+1
write image png "lumo1.png"

And you have what you wanted.








Actually the new Jmol lets you do even more and you can make linear combinations. For example if we combine the HOMO (14bg) with the HOMO-1 (13au), we get an orbital, which is localized on one half of the molecule.

mo [1 183 1 182]



It is even possible to put up interactive models with Jmol. I used to do that, but then I lost my account on the server where I had this, and I did not want to set it up again. So nothing of that now ...


Edit: The functionality described here is available through the jmol_MOs.py script within the TheoDORE wavefunction analysis package.

Wednesday, 12 October 2011

Orbitals, example

Here is an example for automatic plotting of orbitals with Turbomole and VMD, as I explained in the last post.

What I am showing are the frontier orbitals of an adenine-thymine stack inside of DNA. The calculations were QM/MM calculations where the eletrons of the two bases were treated quantum mechanically and the remaining DNA and waters were considered as point charges. The orbitals are shown in order of decreasing energy with a qualitative label below them.



Thymine - π*

Adenine - π* (LUMO)


Adenine - π (HOMO)

Thymine - π

Adenine - π

Adenine - π

Adenine - n

Thymine - π

Thymine - n


Thursday, 6 October 2011

Automatic plotting of orbitals

Back to computational chemsitry: I want to introduce a script that allows you to plot a number of molecular orbitals automatically in batch mode and yields nicely rendered image files without the need to sit there and wait for your program to compute every single orbital. All you need is VMD and a program that can make surface files (.plt, .cube, ...) for VMD to read. [1] In Turbomole, for example, you only have to add the line

$pointval mo 65-74


Then you would call the following script "vmd_get_plt.bash"

#!/bin/bash
# 1. call this script
# 2. open the molecular structure file in VMD
# 3. load the .plt files and some settings
# - "Load state" load_all_plt.vmd
# - click "Apply" in "Graphical Representations"
# 4. adjust perspective
# 5. "Load state" plot_all.vmd

out=load_all_plt.vmd
plot=plot_all.vmd
rm $out $plot

echo "axes location Off" >> $out
echo "display projection Orthographic" >> $out
echo "color Display Background white" >> $out
echo "menu graphics on" >> $out
echo "mol modstyle 0 0 Bonds 0.100000 10.000000" >> $out
echo "mol addrep 0" >> $out
echo "mol addrep 0" >> $out
echo "mol modmaterial 1 0 AOShiny" >> $out
echo "mol modmaterial 2 0 AOShiny" >> $out
echo "mol modstyle 1 0 Isosurface 0.035000 0 0 0 1 1" >> $out
echo "mol modstyle 2 0 Isosurface -0.035000 0 0 0 1 1" >> $out
echo "mol modcolor 1 0 ColorID 0" >> $out
echo "mol modcolor 2 0 ColorID 1" >> $out

N=0
for I in *plt
do
echo "mol addfile $I" >> $out
echo "mol modstyle 1 0 Isosurface 0.035000 $N 0 0 1 1" >> $plot
echo "mol modstyle 2 0 Isosurface -0.035000 $N 0 0 1 1" >> $plot
echo "render TachyonInternal $I.bmp" >> $plot
N=$(($N+1))
done



This script will create two TCl scripts, which can be accessed by VMD through "Load State". The first one "load_all_plt.vmd" will load the plot files into VMD and set some parameters in a way that I think looks good. You can of course modify the initial bash script to change some of those parameters.

axes location Off
display projection Orthographic
color Display Background white
menu graphics on
mol modstyle 0 0 Bonds 0.100000 10.000000
mol addrep 0
mol addrep 0
mol modmaterial 1 0 AOShiny
mol modmaterial 2 0 AOShiny
mol modstyle 1 0 Isosurface 0.050000 0 0 0 1 1
mol modstyle 2 0 Isosurface -0.050000 0 0 0 1 1
mol modcolor 1 0 ColorID 0
mol modcolor 2 0 ColorID 1
mol addfile 11ag.plt
mol addfile 11b1u.plt
mol addfile 12ag.plt
mol addfile 13ag.plt
mol addfile 7au.plt
mol addfile 7b1g.plt



The second one is used for the actual plotting. First arrange the settings in a way that you like. Then call "plot_all.vmd" through "Load State" and it will create the image files.

mol modstyle 1 0 Isosurface 0.035000 0 0 0 1 1
mol modstyle 2 0 Isosurface -0.035000 0 0 0 1 1
render TachyonInternal 11ag.plt.bmp
mol modstyle 1 0 Isosurface 0.035000 1 0 0 1 1
mol modstyle 2 0 Isosurface -0.035000 1 0 0 1 1
render TachyonInternal 11b1u.plt.bmp
mol modstyle 1 0 Isosurface 0.035000 2 0 0 1 1
mol modstyle 2 0 Isosurface -0.035000 2 0 0 1 1
render TachyonInternal 12ag.plt.bmp


With knowledge of TCl programming it could of course be done in a more integrated fashion but I think it is convenient as it is. I will show some of the pictures soon.

Actually I found out that Jmol might be able to do it even faster because it can directly read the output files of quantum chemical programs and it computes the orbitals itself. And scripting in Jmol appears to be very straight forward. Maybe I will use that as well.