Make Movies from ATK Trajectory Files

ATK: gif animations

Prerequisites: Know how to create NEB or MD structures in ATK/VNL


In this tutorial you will learn how to make nice movies
from Trajectory, NudgedElasticBand (NEB) or MDTrajectory objects.


You must already have an existing trajectory file.

Here we report the steps to follow to make a movie from an existing trajectory file. The example is a NEB calculation for a buckled graphene nanoribbon (GNR), but it works exactly the same way for optimization and MD trajectories. There are other tutorials describing how to create and calculate NEB trajectories. Also note that you can also make movies for trajectories computed with other software packages, like VASP, as long as they can be imported.

Creating Animated GIF

You can import your NEB object (here we use the NEB object in by simply dragging and dropping the file on the viewer_icon Viewer. There you can decorate your structure as you prefer by clicking on the Properties button in the right-hand panel. Left-clicking on the structure you have the following four extraction options:

  • Export to clipboard
  • Export image
  • Export animated GIF
  • Export frames

Use the following workflow for exporting an animated GIF:


The possibilites at this point are endless. If you analyze your NEB or MD simulation with the Movie Tool, for example, you can view an animated plot of the relevant quantity:



Rotation Animator

In VNL you can also create a rotation animation (in .gif format) of a structure around a specific axis (GIF animation from a static configuration). Just got to Viewer ‣ Rotation Animator. The functionality of the Rotation Animator is quite obvious and easy to understand:



Movie from Trajectory Files

Combining VNL with other (external programs) it is possible to create your animation from a sequence of pictures (in various formats like MP4, FLV, etc.).


Export Frames

In VNL you can extract the set of pictures that correspond to an animated structure. Just right click on the animation/structure in the viewer_icon Viewer and choose Export frames.


It may be wise to change the prefix name in case you will export another set of frames later; then you will not overwrite or intermix the image files. When you click OK, the movie will start to play in the 3D Viewer. While playing, each frame is actually exported as an image into a directory called Frames in your current project. Those images can be stapled together in a movie using some external software! See below for a brief description of making the movie using MPlayer on Linux.

Example: Create a movie with MPlayer

Prerequisites: Linux terminal and MPlayer
Links: MPlayer

Here we give an example of how to build a movie/animation file
using the MPlayer software from the Linux command-line.
  • Open a terminal and navigate to the directory with the frames. Here you will find the PNG files corresponding to your frames, and a file containing the command needed to create the movie (encode).
  • An example of the encode file is shown below.
  • You may run the encode file directly (./encode), or choose to modify some option first.
$ mencoder mf://GNR_buckle*.png -o atkFrames.avi -ovc lavc -lavcopts \
$ vcodec=msmpeg4v2:autoaspect:vbitrate=2160000:mbd=2:keyint=132:vqblur=1.0:cmp=2:subcmp=2:dia=2:mv0:last_pred=3 \
$ -mf w=800:h=600:fps=5:type=png

Some options to consider changing are the aspect ratio (use “-mf” to set the width (w) and height (h) matching the size of the 3D Viewer window) and the frame rate (“fps”), and of course the filename of the final movie.

  • Now you will have the file atkFrames.avi in the “Frames” directory. The movie should play in most players, but if in doubt, always look to VLC or MPlayer.
  • To make an FLV file (smaller file size, suitable for online stuff), try:
$ mencoder mf://atkFram*.png -o atkFrame.flv -of lavf -oac mp3lame \
$ -lameopts abr:br=56 -srate 22050 -ovc lavc \
$ -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:last_pred=3 \
$ -mf w=512:h=512:fps=10:type=png

Have fun creating cool videos with VNL/ATK!

Note: MPlayer is a cross-platform program and you can use it in Windows and Mac as well.