version 1.1

Chemical2VMD is a small perl script (called chemical2vmd) that enables you to use VMD as a helper application for programs like Mosaic and Netscape which deal with MIME documents.

This program lets you use the Babel interface of VMD to load various molecular coordinate files via a web client. It is also used to start VMD with a downloaded VMD script. Since the script contains executable content, you will be asked to verify that you want to run the script.

The Chemical2VMD home page is at http://www.ks.uiuc.edu/Research/vmd/chemical2vmd/ .

WHAT TO DO

(only for Unix machines with browsers that use the .mailcap file):
  • Install VMD ( http://www.ks.uiuc.edu/Research/vmd/ ), Babel, and Perl http://www.perl.com/perl/
  • Uncompress and untar the latest copy of chemical2vmd-1.1.tar.gz, which is available via anonymous ftp to ftp.ks.uiuc.edu in /pub/mdscope/vmd/contrib. This will untar to its own directory.
  • Check that the first line of the perl script (chemical2vmd) script has the full path of the correct version of perl. Copy the script to wherever you want it (eg., /usr/local/bin).
  • add the following group of ten lines to the .mailcap (either $HOME/.mailcap or the local mailcap, eg, in /usr/local/etc or /usr/local/lib/netscape):
    # This makes VMD read the file as script input
    chemical/x-vmd; /usr/local/bin/chemical2vmd vmd %s
    # This starts VMD to view various types of molecular coordinate files
    chemical/x-pdb; /usr/local/bin/chemical2vmd pdb %s
    # these require Babel to be installed
    chemical/x-xyz; /usr/local/bin/chemical2vmd xyz %s
    chemical/x-mol; /usr/local/bin/chemical2vmd alchemy %s
    chemical/x-mdl-molfile; /usr/local/bin/chemical2vmd mdlmol %s
    chemical/x-macromodel;  /usr/local/bin/chemical2vmd macromodel %s
    chemical/x-gaussian-input; /usr/local/bin/chemical2vmd z-matrix %s
    
    (you may want to change the '/usr/local/bin/' to reflect your setup.)
If you want to add more types, you'll need to find the MIME type (the part like "chemical/*") and the name VMD uses for it. These names are in the chemical2vmd perl script. I would add them here, but I either don't know the MIME type or the mapping to the name VMD uses for Babel.

For some test sites:


The Details

When your web browser receives a document from a remote site, it also receives some header information which describes the type of the document. This is known as the "MIME type". Based on this type data, the correct program is launched to view it. Molecular information is sent via the "chemical" MIME type. Many browsers can be reconfigured to recognize these types and launch a molecular visualization program. On Unix machines, and for Mosaic or Netscape, this association is made in the .mailcap file. (For more information on this, see http://chem.leeds.ac.uk/Project/MIME.html .) In most cases, the helper programs can be called directly in the .mailcap file with the correct parameters to read the downloaded file as input. VMD does not work that way because:
  • the VMD command line options cannot handle non-PDB coordinate files, and
  • VMD creates its own text console in the background, and returns control to the browser, which then deletes the data file. However, VMD hasn't had the time to read the file yet, so nothing appears.
Instead, the .mailcap should call the program chemical2vmd. This creates a temporary file containing a VMD script. The script can do one of two things, depending on if the downloaded file was a structure or a VMD script.

If the downloaded file is a structure

The intermediate script contains the VMD command to load the structure file. The mailcap file started chemical2vmd with a parameter describing the file type, so the load command will automatically call Babel with the right options to convert the input file, if need be.

If the downloaded file is a VMD script

The intermediate script in this case is a bit more complicated. Since the downloaded file contains executable content, it could contain malicious information which may do things you don't want it to do. Instead of simply loading the file, the script asks the user if the the script should be read. This doesn't eliminate the problem of running untrusted code on the local machine, but it at least prevents the script from being run without the user's knowledge. Additional information is available about using the chemical/x-vmd MIME type.