Sherrill Group Logo
Search the Sherrill Group

menu line

Making MPEG Movies of Vibrational Modes

What is needed?

vibs is a small Perl script that reads the optimized Cartesian coordinates and normal mode displacements from a Q.Chem or ACES output and generates a series of displaced Cartesian coordinates spanning one period/cycle of that normal mode. It is located at /usr/local/vibs.

Molekel is a molecular visualization program just like JMOL. It is used here because it can easily generate/export sharp images. It is located at /usr/local/molekel.

Makempeg is a simple shell script (that someone wrote) to take a series of JPEG files and turn them into an MPEG movie. It calls mpeg and ppmtoyuvsplit, which we have at /usr/local/bin.

Procedure
1. Use the script vibs to generate Cartesian displacement that get written to an XYZ file.

Example: To generate Cartesan displacements of the 12th mode from file freq.out, the commandline input would be
vibs freq.out 12
This generates a file called mode12.xyz

2. Open the newly generated Cartesian displacements file by running molekel. This is done by right-clicking and selecting the file through 'LOAD>MULTIPLE STRUCTURE XYZ'.
Molekel snapshot
Once you orient the molecule into a certain position, right-click and select 'RENDER'. Set the parameters you want and make sure you select 'structure animation' in the 'action' section and click 'ok'.
Molekel snapshot
In the next window, you would give a base name for the images that you would ultimately stitch into a movie.

3. Now comes the real movie-making part and we will use the makempeg script for that. You can type makempeg --help to view the usage information. Typically, if one generated 20 cartesian displacement using vibs and gave the basename basename in Molekel your commandline prompt would be

makempeg -fs 1 -fe 20 -fi 1 -base basename

This will generate a movie named basename.mpg. If something fails, you must be missing one of many executables (ppmtoyuvsplit, mpeg) that makempeg script uses.

Now you can see your movie using any movie player. A simple tool for Linux users would be plaympeg. To play a movie named basename.mpg in looping mode, your commandlike input would look like
plaympeg -l basename.mpg

Making GIF Animations of Vibrational Modes

What is needed?

vibs is a small Perl script that reads the optimized Cartesian coordinates and normal mode displacements from a Q.Chem or ACES output and generates a series of displaced Cartesian coordinates spanning one period/cycle of that normal mode. It is located at /usr/local/vibs.

Molekel is a molecular visualization program just like JMOL. It is used here because it can easily generate/export sharp images. It is located at /usr/local/molekel.

Gifsicle is a UNIX command-line tool for creating, editing, and getting information about GIF images and animations. We have it locally at /usr/local/bin.

Convert is a fairly standard part of the ImageMagick package that is used to convert between different image formats, JPEG to GIF in our case.

Procedure
1 - 2. The first two parts are the same as the above section.

3. Once you have your JPEG images, you would want to convert them into the GIF frames and then a GIF animation.

To convert the JPEGs into GIFs, you run
convert [options] *.jpg *.gif

Once you have all your GIF frames, you can use Gifsicle to stitch them together into an animation.
gifsicle --loop *.gif > animation.gif

You can automate the process using a simple Perl script like this one.

#!/usr/bin/perl -w
#######################################################
# Makes GIF animations
# 'convert' converts the JPEGs to GIFs
# 'gifsicle' joins the GIFs into an animation
#

chomp(@files=`ls *.jpg`);
foreach (@files){
$i=1;
if (/.jpg/){
$filename=$`;
} else{
print "No JPEG files found. \n";
exit;
}
system("convert -resize 600x600 $_ $filename.gif");
$build[$i]="$filename.gif ";
$i++;
}
print @build;
#system("gifsicle -b --transparent '#000000' *.gif");
#system("gifsicle @build --delay=100 --loop > animation.gif");
system("gifsicle --loop *.gif > animation.gif");



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