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
Practical Pymol for Beginners
(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!
==What else can this thing do?== So, now what? Good question. PyMOL is a powerful program, and everyone uses it for something different. The remainder of this guide is devoted to common tasks that come in handy. ===Saving an image=== You've found the perfect view, and you'd like to [[Save]] it? # Change the size of the viewer and zoom in/out to make the image the right size. Images are saved exactly as they appear in the viewer, and the size of the viewer determines the size of the image. #* For example, images for printing and presenting should be larger than images for a posting on a website. # Because PyMOL was designed to run on older computers, the maximum quality is not enabled by default. To change this, select '''Display''', '''Quality''', '''Maximum Quality'''. Notice that round things are rounder, curves are curvier, and color shading is smoother. # Once you've found the appropriate view, save an image using '''File''', '''Save Image...''' An picture of the current view will be saved in PNG format. '''Tip:''' Using the ''[[ray]]'' command before saving an image will create a higher quality version with shadows, etc. This can take time, depending on the size of the image and speed of the computer, but the images created after ray tracing are usually spectacular. However, the ray tracing disappears if the view is changed in any way. ===Selecting parts of an object=== Sometimes it might be useful to select part of an object and modify it directly; for example, selecting active-site residues in a protein to highlight them in another color. In the lower-right corner of the Viewer, next to the animation controls, is an '''S''' button (not to be confused with the '''S'''how button in the object control panel) that activates the selection tool. The selection tool can be changed to select atoms or residues by clicking ''Selecting Residues(or whatever)'' until the right mode appears. Once selecting is activated, a list of parts to select appears at the top of the Viewer. Select things clicking or dragging across a range. Selections can be controlled individually in the object control panel, just like any other object. To save a selection, select '''rename''' from the '''A''' menu. ===Whoops: Getting unstuck=== PyMOL is a program meant to be explored and played with, and sometimes funny things happen in the process. A few common problems: * ''The model disappeared:'' Sometimes while rotating and moving a model, it can get lost. Right-click the background of the viewer, and select '''reset''' from the ''Main Pop-Up''. The model should return to view; if it doesn't, make sure the object is being drawn using the '''S''' menu. * ''The model has funny colors, labels, etc and they won't go away:'' The '''H''' menu in the object control panel will remove unwanted details; however, sometimes it's difficult to know exactly what to remove. Select '''H''', then '''everything''' to hide all details and start fresh. * ''Things are really messed up:'' Use '''File''', '''Reinitalize''' to reset PyMOL to its initial state, but all work will be lost. === Related Commands === [[Save]], [[Viewport]], [[Zoom]], [[Save]], [[Ray]], [[Select]] ===Saving work=== PyMOL supports saving your work in various formats. You can save, images, molecules, sessions, movies, etc. ====Sessions==== A PyMOL sessions retains the state of your PyMOL instance. You can save the session to disk and reload it later. You can setup a complicated scene, with transitions and more, and simply save it as a PyMOL Session (.pse) file. Use, '''File'''=>'''Save Session''' or '''Save Session As...'''. Loading sessions is just as easy: '''File'''=>'''Load''' and choose your session file. ====Molecules==== You can save a molecule by selecting '''File'''=>'''Save Molecule'''. A dialog box will appear from which you can select your molecule to save. You can also save an object or selection using the [[Save]] command. It's very easy: <source lang="python"> save fileName, objSel </source> where fileName is something like "1abc.pdb", and objSel can be any object or selection. For example, to save just the waters to disk do: <source lang="python"> save wat.pdb, resn HOH </source> ==== Images ==== You can save images that you've rendered (with [[Ray]]) or drawn (with [[Draw]]) again using the [[Save]] command or by '''File'''=>'''Save Image'''. You can save in [[Png]], VRML-2 and the POVRay formats. You can save images to disk, through the command line, by using the [[Png]] command. ==== Movies ==== PyMOL allows you to save movies you've created, too. You can automatically save the MPEG or save a series of PNG files--for stitching together later. This is a new command, and I don't know too much about it. Use '''File'''=>'''Save Movie'''. ===Scripting=== ====Introduction and Very Simple Scripting==== Scripting in PyMOL ranges from very simple to very intricate. You can make a simple loop (say rotating a molecule one-degree at a time) or execute full featured scripts. Once you've got the basics of PyMOL down, learning scripting will greatly enhance your productivity and capabilities. Because of the way PyMOL is built on top of the Python interpreter, any command that PyMOL doesn't recognize it passes on to Python to execute. This is a '''very''' handy feature--you essentially have a live Python interpreter you can interact with, which makes your life much easier. Take the following for example: <source lang="python"> f = 10. for x in range(0,100,10): cmd.set("spec_direct_power", float(float(x) / f)) cmd.png("spec_dir_power" + str(x) + ".png", ray=1) </source> This simple script of 4 lines will create 10 images each one with the [[Spec_direct_power]] changed (see the [[Spec_direct_power]] for the output of this script; the animated GIF). Did you notice that '''f''' on line 1 and '''for''' and '''x''' on line 2 are not PyMOL commands or symbols? You can simply write Python code that interacts with PyMOL. Brilliant! ====The Python MiniShell ==== Taking this one level higher, you can write little code snippets, like 10-20+ lines of code that perform some specific task and wrap these in the <code>python</code> and <code>python end</code> commands. (If your script ever makes a mistake, you can abort the endeavor with <code>end</code> instead of <code>python end</code>. The power here is that none of your command are executed until you type <code>python end</code>. Confused? Here's the above example in using the wrapper: <source lang="python"> python f = 10. for x in range(0,100,10): cmd.set("spec_direct_power", float(float(x) / f)) cmd.png("spec_dir_power" + str(x) + ".png", ray=1) python end </source> The <code>[[python]]</code> command gives you complete access to the Python shell and <code>python end</code> brings you back into PyMOL's shell. Also, note that PyMOL saves information across instantiations of the <code>python</code> command. For example, <source lang="python"> # enter mini python shell python ff = 10. python end # now we're back in the normal PyMOL shell, where PyMOL knows about the value print(ff) # in the mini shell, Python still knows about ff. python print(ff) python end </source> ==== Learning More... ==== To learn more about scripting check out: *[[Biochemistry_student_intro]] Basic use of GUI and script *[[Simple_Scripting]] introduction *[[Advanced_Scripting]] pages *[[:Category:Script_Library|Popular Script Library]].
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
Practical Pymol for Beginners
(section)
Add topic