Difference between revisions of "Spheres"

From PyMOLWiki
Jump to navigation Jump to search
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Image:Spheres_ex.png|thumb|Normal Sphere Representation Example|center]]
+
[[Image:Spheres_ex.png|thumb|right|Normal Sphere Representation Example|center]]
  
 
==Representation==
 
==Representation==
 
To enable the '''spheres''' representation do the following for any selection SEL,
 
To enable the '''spheres''' representation do the following for any selection SEL,
 
  show spheres, SEL
 
  show spheres, SEL
 +
 +
==Adjusting Sphere Size==
 +
 +
<source lang="python">
 +
alter selection, vdw=number
 +
</source>
 +
 +
===Examples===
 +
Shrink the size of all Iron atoms:
 +
<source lang="python">
 +
alter elem fe, vdw=1.0
 +
rebuild
 +
</source>
 +
 +
Dramatically enlarge all spheres in an object
 +
<source lang="python">
 +
alter object, vdw=4.0
 +
rebuild
 +
</source>
  
 
==OpenGL Shaders & Spheres==
 
==OpenGL Shaders & Spheres==
Newer OpenGL supported cards (like the NVidia 5950 Ultra, or the 6800 GT Ultra) support '''Shaders'''.  Shaders are best used for massive numbers of molecules that are to be represented as spheres.  Typical ranges will now include 500 000 to 3 000 000 atoms!  Take a look, the following example is of a viral nucleocapsid: 261 240 atoms!  Performance and visual quality -- without rendering -- are far improved.
+
Newer OpenGL supported cards (like the NVidia 5950 Ultra, or the 6800 GT Ultra) support '''Shaders'''.  Shaders are best used for massive numbers of molecules that are to be represented as spheres.  Typical ranges will now include 500 000 to 3 000 000 atoms!  Take a look, the following example is of a viral nucleocapsid: 261 240 atoms!  [[:Category:Performance|Performance]] and visual quality -- without rendering -- are far improved.
  
 
===Comparing Shaders and No-Shaders===
 
===Comparing Shaders and No-Shaders===
Line 13: Line 32:
  
 
To turn on Sphere Shaders use
 
To turn on Sphere Shaders use
set sphere_mode, 5
+
<source lang="python">
as spheres, SEL
+
set sphere_mode, 5
 +
as spheres, SEL
 +
</source>
 
where '''SEL''' is the name of your selection.  Getting normal sphere mode back is easy:
 
where '''SEL''' is the name of your selection.  Getting normal sphere mode back is easy:
set sphere_mode, 4
+
<source lang="python">
as spheres, SEL
+
set sphere_mode, 4
 +
as spheres, SEL
 +
</source>
 +
 
 +
===Enabling Shaders===
 +
If the above doesn't work, then you may need to rebuild PyMol so that it builds the shaders source code.  To do this, you simply need to edit the '''setup.py''' file before you build PyMol.
 +
 
 +
Find the appropriate line in your '''setup.py''' file depending on your system.  The relevant lines are, first for Windows,
 +
<source lang="python">
 +
if sys.platform=='win32':
 +
</source>
 +
and for Windows using Cygwin
 +
<source lang="python">
 +
elif sys.platform=='cygwin':
 +
</source>
 +
and finally for *nix or other systems as the following
 +
<source lang="python">
 +
else:
 +
</source>
 +
Under this code, find the
 +
<source lang="python">
 +
def_macros=[("_PYMOL_MODULE",None),
 +
            ("_PYMOL_INLINE",None),
 +
#          ("_PYMOL_NUMPY",None),
 +
            ("_HAVE_LIBPNG",None)]
 +
</source>
 +
and make it
 +
<source lang="python">
 +
  def_macros=[("_PYMOL_MODULE",None),
 +
              ("_PYMOL_INLINE",None),
 +
#            ("_PYMOL_NUMPY",None),
 +
              ("_HAVE_LIBPNG",None),
 +
              ("_PYMOL_OPENGL_SHADERS",None)]
 +
</source>
 +
I just added the
 +
<source lang="python">
 +
("_PYMOL_OPENGL_SHADERS",None)]
 +
</source>
 +
line.
  
 +
See the [[:Category:Installation|Installation Page]] to find out how to build PyMol.
  
 
[[Category:Representations|Spheres]]
 
[[Category:Representations|Spheres]]
 +
[[Category:Performance]]

Revision as of 16:27, 23 September 2008

Normal Sphere Representation Example

Representation

To enable the spheres representation do the following for any selection SEL,

show spheres, SEL

Adjusting Sphere Size

alter selection, vdw=number

Examples

Shrink the size of all Iron atoms:

alter elem fe, vdw=1.0
rebuild

Dramatically enlarge all spheres in an object

alter object, vdw=4.0
rebuild

OpenGL Shaders & Spheres

Newer OpenGL supported cards (like the NVidia 5950 Ultra, or the 6800 GT Ultra) support Shaders. Shaders are best used for massive numbers of molecules that are to be represented as spheres. Typical ranges will now include 500 000 to 3 000 000 atoms! Take a look, the following example is of a viral nucleocapsid: 261 240 atoms! Performance and visual quality -- without rendering -- are far improved.

Comparing Shaders and No-Shaders

Normal spheres: no shaders
(sphere_mode=5) Shader Spheres

To turn on Sphere Shaders use

set sphere_mode, 5
as spheres, SEL

where SEL is the name of your selection. Getting normal sphere mode back is easy:

set sphere_mode, 4
as spheres, SEL

Enabling Shaders

If the above doesn't work, then you may need to rebuild PyMol so that it builds the shaders source code. To do this, you simply need to edit the setup.py file before you build PyMol.

Find the appropriate line in your setup.py file depending on your system. The relevant lines are, first for Windows,

if sys.platform=='win32':

and for Windows using Cygwin

elif sys.platform=='cygwin':

and finally for *nix or other systems as the following

else:

Under this code, find the

def_macros=[("_PYMOL_MODULE",None),
            ("_PYMOL_INLINE",None),
#           ("_PYMOL_NUMPY",None),
            ("_HAVE_LIBPNG",None)]

and make it

  def_macros=[("_PYMOL_MODULE",None),
              ("_PYMOL_INLINE",None),
#             ("_PYMOL_NUMPY",None),
              ("_HAVE_LIBPNG",None),
              ("_PYMOL_OPENGL_SHADERS",None)]

I just added the

("_PYMOL_OPENGL_SHADERS",None)]

line.

See the Installation Page to find out how to build PyMol.