I would like to display MOPAC geometry trajectories for structure minimization and transition state searching.

Is there a simple way to achieve that ? Avogadro can display only final geometry from MOPAC output file.

Avogadro has the "animate" feature, but it needs all the xyz geometry files. How to get them from MOPAC ? I see no keyword for that here.

  • 3
    $\begingroup$ You can always ask a feature request for geometry trajectories from MOPAC on the Avogadro forum. ;-) To be honest, I thought we already grabbed them, but if you can share example files, it's an easy fix. $\endgroup$ Feb 20 at 0:13

1 Answer 1


I created a Python script to manipulate the MOPAC output, saving a XYZ file with all the structures from the optimization step. Then, the XYZ can be loaded into Jmol software and do the animation. The steps are:

  • Add the following keywords to the MOP file: AUX(6,COMP, XP, XS, XW)
  • Run as "mopac fname_root.mop > fname_root.log"
  • Edit the Jupiter notebook variable "fname_root" accordingly OR add the "fname_root" as an argument to the script.
  • Running the script/notebook will create an XYZ file with the structure of each optimization step. This file can be visualized using Jmol (an animation can be done)
  • A file "fname_root.dat" is created with two columns: optimization_step energy, useful to analyze the energy of the system at each optimization step.

Note: If using AUX(5,COMP, XP, XS, XW) keyword, a file with the optimization steps will be created automatically with the name: fname_opt.aux (this file has the same structure as "fname_root.log"

You can download the scripts from here.

Also, I share below a bash script to create the movie after exporting each frame as an image file. This script is intended to be run in a folder where the XYZ files are located (as it is, it will do a batch job creating a movie from each of the XYZ files). Don't forget to change the metadata for the movie!

# Script to create MP4 movies from XYZ trajectory files.

rm trajectorymovie.jmol 2> /dev/null
cat > trajectorymovie.jmol <<!
frank off
background white
set ambient 10; set diffuse 60; set specular 70
frame 1
 num_frames = getProperty("modelInfo.modelCount")
 for (var i = 1; i <= num_frames; i = i+1)
   var filename = "movie-"+("0000"+i)[-3][0]+".jpg"
   write IMAGE 732 616 JPG @filename
   frame next
 end for

for filename in *.xyz; do

   filenamem1=$(basename "$filename")
   filenamem2=$(basename "$filenamem")

   mkdir out_${filenamem}
   cd out_${filenamem}
   ln -s ../${filename} .

   jmol ${filename} -b -L -n -s ../trajectorymovie.jmol
   ffmpeg -framerate 100 -i movie-%04d.jpg -c:v libx264 -map_metadata -1 -metadata title="${filenamem}" -metadata author="I. Camps" -metadata year="2024" -pix_fmt yuv420p ${filenamem}.mp4
   zip -9 -m Frames_${filenamem}.zip *.jpg
   cd ..    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .