#!/usr/bin/perl #This script outputs .html code that produces a web page using Jmol to display up to 4 isosurfaces simultaneously. #This script is distributed under the GNU Public License. You are free to distribute this script to others. #You may modify the script and add your name to the contributors list at the end of the script. #DO NOT REMOVE THE CONTRIBUTORS LIST. #WARNING the output will be directed to STDOUT. Thus #if you wish it to go to a file it must be redirected. #declare some variables: #the name of the file containing the atom coordinates my $moleculefile = ""; #a list of filenames for the cube files containing the orbitals my @orbitalfiles = (); #Look at the argument list and decide whether to provide help, interactive mode or read the file list from a file. my $numarg = @ARGV; #print "Number of arguments = $numarg\n"; #print "The arguments are: @ARGV\n"; #exit; my $mode = ""; if ($numarg == 0) {#user needs help $mode = "-h"; } elsif ($numarg > 0) { $mode = $ARGV[0]; } #print "The mode is: $mode\n"; #exit; #Now check the mode if ($mode =~ /-i/) { #interactive mode print "This will be interactive mode...\n"; exit; } elsif ($mode =~ /-h/) { #display help print "This script outputs .html code that produces a web page using Jmol to display up to 4 isosurfaces simultaneously.\n\n"; print "Syntax: orbtohtml.pl [mode] [filelist]\n"; print "Mode: -i or -h.\n"; print " -i (Not yet working) Starts interactive mode. Do not include filelist.\n"; print " -h Displays this help message.\n"; print "filelist: either one file name or a list of file names. Do not precede with -i or -h.\n"; print " If only one file name is given this script assumes the file contains a list of files\n"; print " to be used to construct the html code.\n"; print " The first filename should be the file containing the atom coordinates. Gzipped\n"; print " files in any format Jmol can read are recommended.\n"; print " Each following line should contain the name of one gaussian cube file (gzipped)\n"; print " for each orbital you want to be able to display. The script will use the\n"; print " basename from each file as the orbital name in the menus.\n"; print " The same list can be contained on the command line. The script assumes this is the\n"; print " case when more than one entry is found on the command line.\n"; print "\n"; print "WARNINGS:\n"; print "1) This script directs all output to the terminal. To create a file on a *NIX system\n"; print qq{ you must redirect the output to a file. This is usually done by typing ">newfilename"\n}; print " at the end of the command line. Where the newfilename is replaced with your file name.\n"; print "2) You must change the path to the Jmol applet in the generated .html to be correct for your\n"; print " server.\n"; exit; } elsif ($numarg == 1) {# assume name of file containing list of input files is given. open (INFILE, $mode) or die "Can't open $mode: $!"; #slurp in the file my @filelist = ; close (INFILE); $moleculefile = $filelist[0]; chomp $moleculefile; # print "$moleculefile\n"; my $numfiles = @filelist; my $counter = 1; while ($counter < $numfiles) { chomp $filelist[$counter]; @orbitalfiles =(@orbitalfiles,"$filelist[$counter]"); # print "@orbitalfiles\n"; $counter = $counter + 1; } # exit; } elsif ($numarg > 1) {# assume first argument is atom coordinate file, second is 1rst orbtal file, third is 2nd orbital file, etc... $moleculefile = @ARGV[0]; my $numfiles = $numarg; my $counter = 1; while ($counter < $numfiles) { @orbitalfiles= (@orbitalfiles, $ARGV[$counter]); $counter = $counter + 1; } } #now remove the path and extensions from the file names to use as the names of the orbitals. use File::Basename; my ($name, $path, $suffix) = ("","",""); #declare as null initially. my $count = 0; my @orbnames = @orbitalfiles; #sets up array of same size. my $numorb = @orbitalfiles; while ($count < $numorb){ ($name, $path, $suffix)= fileparse($orbitalfiles[$count], qr{\..*}); #remove any terminator characters. chomp $name; chomp $path; chomp $suffix; $orbnames[$count] = $name; $count = $count +1; } print qq{\n}; print qq{\n}; print qq{\n}; print qq{ \n}; print qq{ Sufaces using jmol\n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{\n}; print qq{\n}; print qq{
<Replace this text with your title>
\n}; print qq{
\n}; print qq{
<Describe your\n}; print qq{molecule and orbitals here. Don't forget to mention that there is a\n}; print qq{live display below.  The user's browser window may be too small to\n}; print qq{display your text and the table containing the Jmol applet without\n}; print qq{scrolling.>
\n}; print qq{
\n}; print qq{\n}; print qq{\n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{
\n}; print qq{
\n}; print qq{
\n}; print qq{
\n}; print qq{
\n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ Surface\n}; print qq{Type:
\n}; print qq{ \n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{ Surface\n}; print qq{Color:
\n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ Surface\n}; print qq{Type:
\n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{ Surface\n}; print qq{Color:
\n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ Surface\n}; print qq{Type:
\n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{ Surface\n}; print qq{Color:
\n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{ Surface\n}; print qq{Type:
\n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{ Surface\n}; print qq{Color:
\n}; print qq{ \n}; print qq{ \n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{
\n}; print qq{ \n}; print qq{
Orbital\n}; print qq{1:
\n}; print qq{
\n}; print qq{ \n}; print qq{
\n}; print qq{
Orbital\n}; print qq{2: \n}; print qq{
\n}; print qq{
Orbital\n}; print qq{3:
\n}; print qq{
\n}; print qq{ \n}; print qq{
\n}; print qq{
Orbital\n}; print qq{4:
\n}; print qq{
\n}; print qq{ \n}; print qq{
\n}; print qq{
\n}; print qq{
\n}; print qq{ Javascript\n}; $now_time = localtime; print qq{generated by a perl script (orbtohtml.pl) on $now_time.
\n}; print qq{Original\n}; print qq{page composed by J.\n}; print qq{Gutow 4/2006.
\n}; print qq{
Instructions\n}; print qq{for using Jmol to display\n}; print qq{orbitals:
\n}; print qq{
\n}; print qq{
    \n}; print qq{
  1. Choose which orbitals to display by selecting them using the\n}; print qq{orbital popup menus.  You can control orbital color and fill mode\n}; print qq{by selecting the appropriate options following each orbital menu. \n}; print qq{
  2. \n}; print qq{
  3. ROTATE the image by\n}; print qq{holding\n}; print qq{down the mouse button while moving the cursor over the image. 
  4. \n}; print qq{
  5. ZOOM by holding down the shift key while moving the cursor\n}; print qq{up\n}; print qq{(decrease magnification) or down (increase magnification) on top of the\n}; print qq{image. 
  6. \n}; print qq{
  7. Other options are available in the control menu accessible by\n}; print qq{holding\n}; print qq{the mouse button down while the cursor is over "Jmol" in the lower\n}; print qq{right corner (right click also works on a multibutton mouse). 
  8. \n}; print qq{
  9. For more info about Jmol go to www.jmol.org.
  10. \n}; print qq{
\n}; print qq{
\n}; print qq{
\n}; print qq{
\n}; print qq{\n}; print qq{\n}; #Contributors list: Jonathan Gutow (original author),