Turning MD Trajectories into Movies using PyMOL

Putting movies into your presentations is the perfect way to cover up a terrible underlying presentation help the audience visualise the systems you are discussing. Static protein movies can enhance an introduction or help users understand important interactions between proteins and ligands. PyMOL plugins, such as emovie.py, help you move beyond the ‘rock’ and ‘roll’ scenes in PyMOL’s movie tab. But there ends the scope for your static structures.

If you want to take your PyMOL movie making skills to the next level, you should start adding some dynamics data. This allows your audience to visualise how your protein dynamics evolve over time and a much easier way to explain your results (because, who likes 10,000 graphs in a presentation!? Even if your R plots look super swish.). For example: understanding binding events, PPIs over time or even loop motion.

The following tutorial shows you how to turn a static PDB structure into a dynamic one, by adding a GROMACS trajectory. Most of the commands you will encounter while making a static structure movie, so should not be too alien.

Firstly, you need to load in your structure. A word of warning, the .pdb, .gro and .xtc files all need to have the same atoms. That is to say, all the protein, solvent and ions named in all three. The easiest way to ensure this happens is to use the trjconv command in GROMACS to produce a .pdb that matches the .gro file. You will also need to ensure that your  .pdb, .gro and .xtc files all share the same name. An annoying feature that you often forget until half way through.

load protein.pdb

Next up, you need to add the co-ordinate .gro file:

load protein.gro

Now is the time to customise your PyMOL session. I find it easier to use a .pml script to ensure I have the same colouring and viewing parameters set for each movie. You can also so this by hand.

Once you have set everything up, it is time to load the trajectory. You shouldn’t need more than 200 frames, anything larger will start to cause problems for your workstation:

load_traj protein.xtc

Once this has been loaded in, you should smooth over several frames to make the image smooth and less jittery:

smooth protein, 30, 3

You are now ready to produce the movie. First, you need to ensure the frames are ray traced:

Movie > Ray Trace all frames

Now you need to produce the movie. This will take time, depending on the length and resolution. Luckily, the verbose output will give you an estimated time until completion. There are two ways to do this with PyMOL:

1) File > Save Movie As > MPEG

However, if that doesn’t work (you find out the hard way sadly) you will need to save each frame individually and then stitch it together yourself afterwards:

2) File > Save Movie As > PNG

Then use your favourite software to stitch it up. Some people praise the convert package, or imagej, but I prefer the ffmpeg package as I find it gives smoother images:

ffmpeg -i frame%04d.png -c:v libx264 movie.mp4

Author