Fine, it's that simple! (First I didn't realize that it is sufficient to transform the atom coordinates of the pdb file).
It's not that hard. The clipping planes are defined by the z coordinate (in the viewing matrix). So you can get the atoms for a selection, transform to get the new z coordinate only, and check whether it's in between the planes:
m = cmd.get_model(selection).atom
v = cmd.get_view()
m = [ i for i in m if clipped(i,v) ]
That would be nice, but isn't absolutely necessary. At present, it is sufficient to have the indices of the clipped atoms.
So clipped should do the transform and check whether the atom is clipped. The trick then is to turn m back into a selection.
Hope it helps,
TsjerkOn Feb 25, 2011 5:18 PM, "Johannes Wollbold" <firstname.lastname@example.org> wrote:
Jason Vertrees wrote: > Having said this, you can however, can get the clipping information > from P...Hi Jason,
thank you again for the hint. First I looked if I can select atoms
according to their coordinates, or store new coordinates after a
rotation / shift. But implicitly you already said that such
functionalities are not yet implemented. If clipping is performed with
the original camera view, the task is simple. get_view gives the output
(see above link to the help page):
1.000000000, 0.000000000, 0.000000000,\
0.000000000, 1.000000000, 0.000000000,\
0.000000000, 0.000000000, 1.000000000,\
0.000000000, 0.000000000, -320.337890625,\
74.147140503, 74.174217224, 74.123344421,\
317.145324707, 323.530487061, -20.000000000 )
According to (4,3), the camera is shifted by -320 A in z direction only.
Since (6,1) and (6,2) indicate the camera distances of the slab planes,
I can select, in the pdb file, the atoms with (74 - 320 + 317 ) <= z <=
(74 - 320 + 323).
For different views, coordinate transformations with the rotation matrix
of the first 3 lines are needed. This should not be very difficult, but
perhaps somebody has already a solution?
> On Thu, Feb 24, 2011 at 3:50 AM, Johannes Wollbold <email@example.com> wrote: > >> Hello, >> >>...