Making a movie from a group in PDB file

Hi, I am trying to create a simple animation of a demo molecular dynamics program https://github.com/stochasticHydroTools/DemoMD using either chimerax or chimera. The code creates a .pdb file that has multiple time frames in it, which show up in chimerax as a "group". How do I make chimera show the frames one by one and then make a movie out of that or save each frame as an image? I used to be able to do that in chimera but either the interface has changed or I have forgotten. I found lots of instructions about how to make movies by manipulating one data set (say rotating a molecule) but could not find anything about animation in time. Thanks, Aleks -- Aleksandar Donev, Professor of Mathematics Courant Institute of Mathematical Sciences Office: 1016 Warren Weaver Hall, New York University E-mail: donev@courant.nyu.edu Phone: (212) 992-7315; Fax: (212) 995-4121 Mailing address: 251 Mercer St, New York, NY 10012 Web: http://cims.nyu.edu/~donev

Hi Aleks, You can specify that a multi-model PDB file is a trajectory (time series) when you open it. In ChimeraX you can use the command "open" with the option "coordset true", e.g. open ~/Desktop/1plx.pdb coordset true Then there will be playback slider GUI, and/or you can use the separate command "coordset" to play it back (e.g. within a movie command script). See ChimeraX trajectories help, and links therein: <https://rbvi.ucsf.edu/chimerax/docs/user/trajectories.html> In Chimera, instead of just using the command open or menu File...Open, you would open the file using the MD Movie tool. menu: Tools... MD/Ensemble Analysis... MD Movie, specify format PDB, frames in single file, the file name/location, etc. See Chimera MD Movie help: <https://www.rbvi.ucsf.edu/chimera/docs/ContributedSoftware/movie/framemovie....> I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Feb 19, 2023, at 3:19 PM, Aleksandar Donev via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi, I am trying to create a simple animation of a demo molecular dynamics program
https://github.com/stochasticHydroTools/DemoMD
using either chimerax or chimera. The code creates a .pdb file that has multiple time frames in it, which show up in chimerax as a "group". How do I make chimera show the frames one by one and then make a movie out of that or save each frame as an image? I used to be able to do that in chimera but either the interface has changed or I have forgotten. I found lots of instructions about how to make movies by manipulating one data set (say rotating a molecule) but could not find anything about animation in time. Thanks, Aleks

On 2/20/23 11:35 AM, Elaine Meng wrote:
Then there will be playback slider GUI, and/or you can use the separate command "coordset" to play it back (e.g. within a movie command script). See ChimeraX trajectories help, and links therein: <https://rbvi.ucsf.edu/chimerax/docs/user/trajectories.html>
Thanks for the help. I was able to play a movie and save it, but there is still a problem. What I did was: open animnew.pdb coordset true graphics rate maxFrameRate 2 movie record format png movie record directory Movies # Doesn't seem to do anything since no frame files (.png) saved there but then if I try movie encode framerate 2 quality higher output Movies/DemoMD.mp4 chimerax gives me an error that no frames have been recorded. If I do coordset #1 a movie gets recorded but with the default options. The only way I got my options in movie encode to apply was to execute the movie command in the middle of the animation playback before it ended, but that excluded a few frames at the end and is clearly inconvenient. How do I record and set the encode options at the same time? Also, is there a way to save the frames as .png files in a directory? Thanks, Aleks -- Aleksandar Donev, Professor of Mathematics Courant Institute of Mathematical Sciences Office: 1016 Warren Weaver Hall, New York University E-mail: donev@courant.nyu.edu Phone: (212) 992-7315; Fax: (212) 995-4121 Mailing address: 251 Mercer St, New York, NY 10012 Web: http://cims.nyu.edu/~donev

Hi Aleks, (1) opening the file as a trajectory does not play it. You still have to use "coordset" to play it, as you said. <https://rbvi.ucsf.edu/chimerax/docs/user/commands/coordset.html> (2) "graphics rate" sets interactive frame rate, has nothing to do with movie recording. Movie framerate is set with an option of "movie encode" <https://rbvi.ucsf.edu/chimerax/docs/user/commands/graphics.html#rate> (3) probably you didn't get any PNG files in the specified directory since no frames were recorded in your attempt. Hard to tell exactly what happened without seeing your whole script. You would use the "movie record" directory option, as you said. <https://rbvi.ucsf.edu/chimerax/docs/user/commands/movie.html#record> (4) there is no reason I know of that your recording options would be ignored. In general, the script would be organized thus: movie record [various options] [commands for what happens in the movie: coordset etc.] movie encode [various options] You may also need appropriate wait commands, e.g. if your trajectory pdb opened as #1 has 50 frames, there should be a wait so that any subsequent commands such as the encoding won't start until after the movie actually plays. coordset #1; wait 50 There are several examples of movie content scripts that may help to give you a better understanding of the process. See movie-making commands and examples linked therein <https://rbvi.ucsf.edu/chimerax/docs/user/movies.html> e.g. morphing trajectory playback movie with command scripts linked <https://www.rbvi.ucsf.edu/chimerax/features.html#morphing> making movies tutorial 2019 <https://www.rbvi.ucsf.edu/chimerax/data/movies-may2019/moviemaking.html> I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Feb 20, 2023, at 6:20 PM, Aleksandar Donev via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
On 2/20/23 11:35 AM, Elaine Meng wrote:
Then there will be playback slider GUI, and/or you can use the separate command "coordset" to play it back (e.g. within a movie command script). See ChimeraX trajectories help, and links therein: <https://rbvi.ucsf.edu/chimerax/docs/user/trajectories.html>
Thanks for the help. I was able to play a movie and save it, but there is still a problem.
What I did was:
open animnew.pdb coordset true
graphics rate maxFrameRate 2
movie record format png
movie record directory Movies # Doesn't seem to do anything since no frame files (.png) saved there
but then if I try
movie encode framerate 2 quality higher output Movies/DemoMD.mp4
chimerax gives me an error that no frames have been recorded.
If I do
coordset #1
a movie gets recorded but with the default options. The only way I got my options in movie encode to apply was to execute the movie command in the middle of the animation playback before it ended, but that excluded a few frames at the end and is clearly inconvenient.
How do I record and set the encode options at the same time?
Also, is there a way to save the frames as .png files in a directory?
Thanks,
Aleks

On 2/21/23 11:31 AM, Elaine Meng wrote:
You may also need appropriate wait commands, e.g. if your trajectory pdb opened as #1 has 50 frames, there should be a wait so that any subsequent commands such as the encoding won't start until after the movie actually plays.
coordset #1; wait 50
Yes, this is what I was missing, thanks, works great now. Aleks -- Aleksandar Donev, Professor of Mathematics Courant Institute of Mathematical Sciences Office: 1016 Warren Weaver Hall, New York University E-mail: donev@courant.nyu.edu Phone: (212) 992-7315; Fax: (212) 995-4121 Mailing address: 251 Mercer St, New York, NY 10012 Web: http://cims.nyu.edu/~donev
participants (2)
-
Aleksandar Donev
-
Elaine Meng