SelectClipped

From PyMOLWiki
Revision as of 10:26, 19 April 2011 by Inchoate (talk | contribs) (Created page with "This script selects those atoms that are == The Code == <source lang="python"> from pymol import cmd def clipped_by(at,v): x,y,z = at.coord nz = v[2]*(x-v[12])+v[5]*(y-v[1...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This script selects those atoms that are

The Code

from pymol import cmd

def clipped_by(at,v):
   x,y,z = at.coord
   nz = v[2]*(x-v[12])+v[5]*(y-v[13])+v[8]*(z-v[14])-v[11]
   return nz > v[15] and nz < v[16]

def clipped(selection="all",state=1):
   v = cmd.get_view()
   return [ i.id for i in cmd.get_model(selection,state).atom if clipped_by(i,v) ]

To use this script save it to "clipped.py". Then load the script from PyMOL ("run clipped.py").

Selecting those atoms that are not clipped is as easy as,

cmd.select_list("sele", "objName", clipped("objName"))

# for example, fetch 1cll

fetch 1cll, async=0

# orient it to clip out some data

set_view (\
    -0.555155039,    0.671998382,    0.490123481,\
     0.050991829,    0.615659416,   -0.786360741,\
    -0.830182374,   -0.411559790,   -0.376052886,\
     0.000000000,    0.000000000, -188.930786133,\
    13.649702072,   25.646595001,   12.279129982,\
   172.813293457,  205.048278809,  -20.000000000 )

# run the script

cmd.select_list("1cllClipped", "1cll", clipped("1cll"))

# setup the view

orient

# remove the surface flag on these atoms

flag exfoliate, 1cllClipped

# show everything as sticks

show sticks

# show those atoms not exfoliated as surface

show surface