Monday, 23 June 2008

Molecular dynamics movie

A short instruction: how to make a movie out of a molecular dynamics trajectory with pymol. First you have to import the trajectory. The tricky thing is that pymol will not read multiple xyz's. But at Lightnir's I found that multiple sdf's work. So you start out converting your trajectory into sdf format (for example with openbabel). Then you open that in pymol, adjust the representation and save the movie frames. Either by something like:

set ray_trace_frames=1
set cache_frames=0
mpng mov/mov

or by doing that in the "Movie" menu.

Now you need a program that makes a movie out of the frames, for example videomach. And that's it.

Here's an example: the ground state zero point vibrations of ethene. Actually a classical simulation of this quantum phenomenon is neither physical nor exciting. But I don't have anything else to show right now.



Lightnir said...

SDF are multi-record files and Pymol handles them by loading every molecule record into a separate state. You can also make yourself a trajectory file without using open babel. PDB also can have multiple records. Assuming you have some single-record files (let's say XYZ) like this:

that are located in /some/path/to/a/directory
Now you simply go from the Pymol console to that directory
cd /some/path/to/a/directory
and then load every file into the same object but specifying different states. This can be done by hand, but for many files it's better to use a loop like this (single line):
for idx in range(1,100):cmd.load(""%idx,"molecule")
Now you have a multi-record object to make a movie. If you wish you can save it also on the disk, by overriding de default settings:
save multirecord.pdb, (all), state=-1

PS. Nice movie, but it's a bit hypnotic - I watched it about 3-4 times and still can't get enough ]:) You really got here the right frames per second settings.

Felix said...

hi, actually what I start out with is a multi-record xyz. molden for example will read that but pymol only reads the first entry. but it's very convenient to just make a multiple sdf with babel

I think the frames are correct, something like 30 frames per second. one frame is 0.5 fs in the simulation. so you have it slowed down by about 10^14. google changed the resolution I think, but I don't know if that should be a problem