Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help
Special pages
SBGrid Resources
SBGrid Consortium
SBGrid Data Bank
Software Webinars
PyMOL Webinar
PyMOL Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Slerpy
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Manual for Slerpy.py = An extension to pymol that creates a moderately easy to use environment for doing keyframe animation. ==General Use== At the pymol command line type: import slerpy This will load the extended commands. All commands in slerpy begin with the letter s. Pymol's tab autocomplete feature will work on the additional commands. ==Important concepts== The main function of slerpy is to record a series of pymol views. A movie can then be created by interpolating between these views. A pymol view consists mostly of the camera orientation (that is, the orientation of the viewers eye with respect to the molecule). It also includes information about the clipping planes. It is important to realize that most slerpy commands act on the "current" view. You can navigate among views by using the sn, sp, and sgo commands. If you've changed the view around with the mouse or you just want to know the number of the current view you can get back to the current view with the sc command. Pymol views do not contain information about how pymol objects and selections are displayed. If you just want to create a movie which moves around a single representation of a molecule then all you need to do is record the set of views that define the tour of the molecule. If, on the other hand, you want to change the representation or change which items are displayed you will need to add actions to some of your views. An action is any set of pymol commands. Actions can be associated with any view in the series recorded by slerpy. The ''sscene'' command inserts a new view and simultaneously creates a pymol scene and the action to display it. The scene will include all of the objects and representations visible at the time the command was issued. In order to control the rate of motion between the defined views in a slerpy movie, you can control the number of frames used in each interpolation. When a view is saved in slerpy it is associated by default with a transition of 50 frames to the next view. The number of frames in the transition can be altered with the ''ssetf'' command in slerpy. The views and actions stored by slerpy can (and should) be saved to a key file with the ''swrite'' command. They can then be retrieved with the sread command. Note that swrite saves the current pymol state in a .pse file but sread does not read in the .pse file. If you're starting a new pymol session to continue work on an existing movie you should load the pse file before doing an sread. ==Quick Start Tutorial== If you haven't installed slerpy yet see [[#Installation|Installation]] ;Step 1: You probably want to start off in a nice clean working directory that just has the coordinate files you want to work with. ;Step 2: Read in your molecule(s) and create the various selections and representations that you want to include in the movie. ;Step 3: At the pymol prompt, type: import slerpy ;Step 4: Get your molecule in exactly the orientation and representation that you want to use for the beginning of your movie. ;Step 5: Type: sinsert ;Step 6: Using the mouse, move your molecule to the next orientation that you want to use. When you record the movie, the camera orientation will be interpolated between each consecutive pair of views. This can include changes in rotation, zooming, clipping etc. :Loop back to Step 5. Continue this until you've got all your orientations stored. :You can check how any set of transitions will look at any time by using the ''sshow'' command (see [[#Command Reference|Command Reference]] for details). :You can adjust the rate of any transition using the ''ssetf'' command ;Step 7A: Add any actions to your views using the saction command. Any number of pymol commands can be strung together separated by semicolons. If, for example, you want to change your protein from a cartoon to a surface and add a ligand when you get to view 5 you would do the following (assuming you've defined the pymol selections prot and lig): sgo 5 saction "hide cartoon, prot; show surface, prot; show sticks, lig" ;Step 7B (Alternative using scenes): sgo 5 :Now use the gui to create the representation you want and then: sscene ;Step 8: Save everything. Save your slerpy views and actions as well as a pse file of your current pymol session: swrite mymovie This will create mymovie.key, which has all of the views, frame counts, actions etc. and mymovie.pse, the associated pymol session file. ;Step 9: Record the movie! Type: srecord :You can then play the movie by typing the standard pymol command ''mplay'' or by clicking the play button in pymol. ;Step 10: If you save the pymol session again, the pse file will contain the movie which can then be shown immediately after startup without running slerpy.py. Note that pymol will warn you when you load a pse file that contains a movie. ;Step 11: If you want to, the movie can be exported using the mpng command (see the pymol [http://pymol.sourceforge.net/newman/ref/S1000comref.html#2_105 documentation]). Also, see the useful article [[Making_Movies|Making Movies]]. ==Tips and Tricks== ===Converting scenes to movies=== You can just step through the scenes and type sscene for each one. This will create a duplicate slerpy scene for each of the scenes you'd already saved but that's not such a disaster. Be sure to swrite when you're done. Note that there is some overhead associated with recalling scenes. To avoid pauses at view transitions, I prefer to actually issue the set of show and hide commands that will generate the scene rather than using the above method. ===Starting off right=== It's a bit of a pain, but I like to associate with the first frame of the movie an action list that hides everything and then turns on all the objects that I want to have visible at the beginning. This ensures that when your movie loops back to the beginning it will look the same as it did the first time through. For example: sgo 0 saction "hide everything; show lines, prot; show surface, activesite; show sticks, ligand" Alternatively, start your slerpy work with an ''sscene''. ===Live pymol presentations during a talk=== Be sure to run your movie once it's been opened and before your presentation if you're presenting in pymol. This will ensure that any objects that don't appear until the middle of the movie are available in memory and won't need to be rebuilt while your audience waits. Of course showing your movie from within pymol allows you to show movies in stereo if you've got a presentation system that allows this. If you pass out stereo glasses first it's guaranteed that everyone will remember your talk... ===Pausing on a view=== Just sgo to the view you want to stay on for a while and do an sinsert. This will insert a new view with the same orientation etc as the one you were just on. You can adjust the length of the pause by changing the number of frames for the transistion between these two identical views using the ssetf command. ===Morphing and multi-state models=== Morphs and multi-conformation models are represented in pymol as single objects with multiple states. Cycling through the states as an animation is very straightforward in pymol. Slerpy allows you to include this animation over the states of an object as a transition between slerpy views within the context of larger movie. This is done using the ''smorph'' command (see [[#Command Reference|Command Reference]]). ''smorph'' allows you to specify the starting and ending pymol state numbers to use during the transition from the current to the next view. It will often be appropriate to have the movie continue after the morph using the final state of the morphing model, that is, the conformation to which you morphed. Since the default for a typical slerpy view is to show the first state of an object, you'll probably need to have available, in addition to your multi-state model, a single-state object containing the final conformation. You can then hide the multistate object and show the single-state final conformation as an action associated with the final view of your morphing sequence. To generate morphs you can use the [http://www.delanoscientific.com/rigimol.html rigimol] program provided by Warren as part of the incentive pymol package for subscribers or use [http://alpha2.bmc.uu.se/usf/mol_morph.html lsqman] from Gerard Kleywegt. ==Command Reference== Note that it is essential to understand that slerpy uses the concept of a current or active view. This is the element in the list to which most commands are applied. It is not necessarily the view that is currently visible on the screen. It is advisable to use the sc command frequently to make sure you really know which view your command is being applied to. '''saction ''string'':''' Assoiciates the pymol commands in ''string'' with the current view. ''string'' must be enclosed in quotes and must contain only valid pymol commands separated by semicolons. '''sappend''': Add the currently displayed view at the end of the list of views in slerpy '''sappendaction ''string'':''' Adds the action(s) in ''string'' to the list of actions associated with the current view '''sc''': Go to the slerpy active view '''scrossfade ''startobject, endobject'':''' During the transition from the current view to the next view ''startobject'' will fade out and'' endobject'' will fade in. The two objects must be shown as sticks. They must be objects, not merely selections, as of pymol 0.99. '''sdelaction''': Deletes the action associated with the current view. Be sure you're sure which view you're on before you use this. This will also delete any actions etc. associated with the view so be careful. '''sdelete''': Remove the slerpy active view from the list of views to be interpolated. '''sdeletesetting: '''Remove the setting interpolation for the current view. '''sdumpactions: '''List all actions by frame. '''sgo ''n'':''' Change the slerpy active view to view ''n''. '''sinsert''': Add the currently displayed view after the slerpy active view. '''sinterpsetting ''setting, selection, startval, endval'' :''' The pymol setting ''setting'' will be interpolated linearly from ''startval'' to ''endval'' during the transition from the current view to the next view. You can only interpolate one setting per transition. This is the hard way to, for example, fade out an object: sinterpsetting stick_transparency, lig, 0.0, 1.0 '''slist''': List all views stored for interpolation. Also lists the number of frames in each transition. '''smorph ''startmodel,endmodel'':''' The transition from the current frame to the next frame will consist of one frame per pymol state starting with state ''startmodel'' and ending with state ''endmodel''. Subsequent frames (i.e. from subsequent views) will revert to state 1. The state numbers apply to currently visible objects so you will most likely want to have an object with your starting conformation, an object with your multi-state morphing model, and an object with your final conformation. You would then sgo to the frame where you want the morph to start and add an action to hide the starting conformation object and show the multi-model morphing object, do an smorph 1,30 or whatever the number of states in your morph is, append another frame and give it an action where the multi-state model is hidden and the final conformation is shown. '''sn''': Go to the next view '''sp''': Go to the previous view. '''sread ''filename'':''' Restore all the information written with swrite. Does not read in the pse file (to avoid inadvertantly writing over some new selections, scenes or whatever). '''srecord''': Records the movie '''sreplace''': Replace the slerpy current view with the currently displayed view. '''sscene''': Add a the currently displayed view after the slerpy active view and create a scene to go with it. The current pymol state, including which objects are displayed and how they are shown will be captured. '''ssetf''': Set the number of frames to use in the transition from the slerpy active view to the next view '''ssetupview ''n'':''' This attempts to make sure that all objects are displayed (or not) as they would be when view ''n'' is arrived at in the movie. It goes through and executes all of the sactions from all preceeding views. For some reason this doesn't always work in complex cases. '''sshow ''n,m'':''' This command records and shows a segment of the movie showing the transitions starting with view n and ending with view m. If the arguments m and n are omitted the transition from the current view to the next view will be shown. '''swrite ''filename'':''' Writes all the information used by slerpy to a file ''filename''.key. It also writes a pymol session file ''filename''.pse containing all of your current objects, selections etc. The format of the .key file is supposed to be human readable and it can be convenient to edit this file rather than using saction over and over. After editing it by hand be sure to do an sread. ==Why is it called slerpy?== slerp is an acronym of sorts for spherical linear interpolation. The transition between two views approximates spherical linear interpolation of the their camera positions using quaternions. See the Wikipedia [http://en.wikipedia.org/wiki/Slerp article] on slerps.
Summary:
Please note that all contributions to PyMOL Wiki are considered to be released under the GNU Free Documentation License 1.2 (see
PyMOL Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Slerpy
(section)
Add topic