Sherrill Group Logo
Search the Sherrill Group

menu line

Plotting Ray-Traced Images of Molecules and Orbitals Using PovMol and MegaPovPlus

What is povmol?

povmol creates .pov povray files for programs like megapovplus to render ray-traced images of molecules.

How does the program work?

Location:     /usr/local/bin 
Usage: povmol [OPTION]... infile
Description: converts .xyz, Q-Chem .in, and Q-Chem .out into .pov

Options:
-o output to specified outfile, defoult is prefix .pov -p specify name of text file with orbital/density data -r rotation specified as "< x,y,z >" in degrees -z zoom specified as a double, default is 0 -q turn on quality flag -t turn on transparency

The syntax for producing a povray input file for water from an xyz file is:

 
povmol H2O.xyz  -o H2O.pov 
Alternatively, I could have specified a Q-Chem output file as input:
 
povmol H2O.out 
Leaving out the +o flag defaults the output to 'output.pov'. To create an image of water, you may use either the program, x-povray or the extended version megapovplus:
 
megapovplus +FN "res[800]" +i H2O.pov +o H2O.png +A -geometry 
The flag +FN tells the program to output a png file (viewable from either gimp or electric eyes, ee). "res[800]" is the resolution (which will affect the overall size) of the image; allowed values are 160, 320, 640, 800, and 1024. The +A and -geometry flags sharpen the image quality (leaving them out will cause povray to render faster but produce a less desirable image).

Obtaining Orbitals/Densities using Q-Chem

Follow the instructions in the Q-Chem manual (pages 226-229) to obtain the orbital/density data for each point on a rectangular grid. The $rem section in the input file must contain the following keyword:
IANLTY 200
For relaxed attachment/detachment densities, an additional keyword must be given:
CIS_RELAXED_DENSITY True
A $plots section is also required which contains a comment line, followed by three lines (x, y, z) which give the number of grid points in that dimension (Nx, Ny, Nz), and the minimum and maximum values of that coordinate (xmin, xmax, etx). The next line specifies the number of molecular orbitals (Nmo), one-electron densities (Nrho), transition densities (Ntrans), and/or attach/detach densities (Nad). There are then 3 optional lines for the labels of the MOs (if Nmo > 0), one-electron densities (if Nrho > 0), transition densities (if Ntrans > 0), and attach/detach states (if Nad > 0) to be plotted.
$plots
place comment here
Nx xmin xmax
Ny ymin ymax
Nz zmin zmax
Nmo Nrho Ntrans Nad
mo(1) mo(2) ... mo(Nmo)
rho(1) rho(2) ... rho(Nrho)
trans(1) trans(2) ... trans(Ntrans)
ad(1) ad(2) ... ad(Nad)
$end

MO data is written to a text file, 'plot.mo'; One-electron densities are written to 'plots.hf'; restricted unrelaxed attachment density data is written to 'plot.attach.alpha' while restricted unrelaxed detachment density data is written to 'plot.detach.alpha'.

An example input deck that will produce the HOMO and LUMO orbitals of water is as follows:

$molecule
0 1
H           0.754085    0.000000    0.505395
O           0.000000    0.000000   -0.067976
H          -0.754085    0.000000    0.505395
$end

$rem
EXCHANGE    hf
BASIS       6-31G*
IANLTY      200
$end

$plots
plot the HOMO and LUMO of water
10 -2.0 2.0
10 -2.0 2.0
10 -2.0 2.0
2 0 0 0
5 6
$end
The output file produced is plot.mo which should be renamed to H2O.mo (or some other similar descriptive name). Next, invoke povmol to produce a povray file that can read the orbital data.
 povmol H2O.out -o H2O.pov -p H2O.mo
The +p flag specifies the name of the text file with the orbital/density data. Povmol outputs both a .pov file and individual .mo files for each of the orbitals. The numbering of the MO files is based on the labels of the orbitals in the $plots section. In this case, povmol produces text files 'H2O.5.mo' and 'H2O.6.mo'. The extended version of povray, megapovplus is capable of producing the orbital plots. The MO files are now in the required format for megapovplus.

Next, you must change two lines in the .pov file to tell megapovplus which orbital to plot. In the following declarations for the orbitals, change both instances of "plots" to the name of the MO file to be plotted.
#declare wfun1 = function{"data_3D_3",
                 < -LEVSCALE >, library "i_dat3d",
                 "plots", < Nx+1, Ny+1, Nz+1, 0 >}
#declare wfun2 = function{"data_3D_3",
                 < LEVSCALE >, library "i_dat3d",
                 "plots", < Nx+1, Ny+1, Nz+1, 0 >}  
In the case of plotting the LUMO for water, "plots" is changed to "H2O.6.mo".
#declare wfun1 = function{"data_3D_3",
                 < -LEVSCALE >, library "i_dat3d",
                 "H2O.6.mo", < Nx+1, Ny+1, Nz+1, 0 >}
#declare wfun2 = function{"data_3D_3",
                 < LEVSCALE >, library "i_dat3d",
                 "H2O.6.mo", < Nx+1, Ny+1, Nz+1, 0 >}  

Finally, run megapovplus just as you did before:
 megapovplus +FN "res[800]" +i H2O.pov +o H2O.png +A -geometry
To rotate the camera 90 degrees about the x-axis, invoke povmol again, but with the additional flag, +r "<90,0,0>"
 povmol H2O.out -o H2O.pov -p H2O.mo -r "<90,0,0>"
If some of the orbital is missing, open the .pov file and uncomment the line, "max_gradient 1.0" and comment out, "eval <1.1, 2.0, 0.8>". Next, increase the value after max_gradient to what is printed in the end of the megapovplus rendering data (usually, a value much greater than 1.0). The rendering time is now substantially increased.

The shape of the orbital can still be sharpened by doubling the grid points in the $plots section of the Q-Chem input deck. Change the $plots section to the following:
$plots
plot the HOMO and LUMO of water
20 -2.0 2.0
20 -2.0 2.0
20 -2.0 2.0
2 0 0 0
5 6
$end

Further Information

POV-RAY Users Manual (.pdf format)
Official POV-RAY website: www.povray.org


The povmol software is available by request from the authors. This material is based upon work supported by the National Science Foundation under grant no. CHE-0091380. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.


© 1999-2001 The Sherrill Group
Georgia Institute of Technology
Last Modified: November 21, 2001