## Re: [PyMOL] select clipped atoms

 Re: [PyMOL] select clipped atoms From: Johannes Wollbold - 2011-03-02 16:27:14 Attachments: Message as HTML ```Hi, I implemented the coordinate transformation and the selection of atoms outside PyMol, in R. In principle it works, but there seems to be some error, since too many atoms are selected, corresponding roughly, but not completely to an enlarged clipping corridor between the planes defined by get_view, matrix elements (6,1) and (6,2). Or could it be that not the complete slab is visualized in PyMol? However, the missing atoms are completely shadowed. Do I understand the rows of the view matrix well (see http://www.pymolwiki.org/index.php/Get_View), by computing the following coordinate transformation?: 1) Translation of the original pdb coordinates by subtracting row 5 of the view matrix (translation of the coordinate origin to the rotation center). 2) Rotation of the coordinates by rows 1-3 of the view matrix. 3) Test: view[4,3] + view[6,1]) <= z <= view[4,3] + view[6,2]. Sorry for this simple question of affine geometry, but I hope I did not make a logical mistake in this domain... Regards Johannes Tsjerk Wassenaar wrote: > > Hi Johannes, > > 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) ] > > 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, > > Tsjerk > >> On Feb 25, 2011 5:18 PM, "Johannes Wollbold" > > 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): >> >> set_view (\ >> 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? >> >> Best regards >> Johannes >> >> > On Thu, Feb 24, 2011 at 3:50 AM, Johannes Wollbold >> > wrote: > >> Hello, >> >>... >> ```

 [PyMOL] select clipped atoms From: Johannes Wollbold - 2011-02-24 08:50:33 ```Hello, I clipped a part of a protein by a slab, by manual, graphical inspection. Now I want to select the slab and store the clipped atoms as new molecule (pdb file), in order to sum up the accessible surface area previously computed by an external program. Unfortunately I didn't find hints, e.g. in the selection algebra (http://www.pymolwiki.org/index.php/Selection_Algebra). Thanks for your advice. Johannes ```
 Re: [PyMOL] select clipped atoms From: Jason Vertrees - 2011-02-24 19:12:06 ```Hi Johannes, PyMOL's awareness of and capabilities surrounding clipping planes does not allow this functionality. Improving clipping planes is a higher priority, so I hope to have this updated in the near future. Having said this, you can however, can get the clipping information from PyMOL and write scripts against that yourself to determine atom inclusion. See get_view (http://www.pymolwiki.org/index.php/Get_View) for more help. Cheers, -- Jason On Thu, Feb 24, 2011 at 3:50 AM, Johannes Wollbold wrote: > Hello, > > I clipped a part of a protein by a slab, by manual, graphical > inspection. Now I want to select the slab and store the clipped atoms as > new molecule (pdb file), in order to sum up the accessible surface area > previously computed by an external program. Unfortunately I didn't find > hints, e.g. in the selection algebra > (http://www.pymolwiki.org/index.php/Selection_Algebra). > > Thanks for your advice. > Johannes > > ------------------------------------------------------------------------------ > Free Software Download: Index, Search & Analyze Logs and other IT data in > Real-Time with Splunk. Collect, index and harness all the fast moving IT data > generated by your applications, servers and devices whether physical, virtual > or in the cloud. Deliver compliance at lower cost and gain new business > insights. http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > PyMOL-users mailing list (PyMOL-users@...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pymol-users@... > -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) Jason.Vertrees@... (o) +1 (603) 374-7120 ```
 Re: [PyMOL] select clipped atoms From: Johannes Wollbold - 2011-02-25 16:16:40 ```Jason Vertrees wrote: > Having said this, you can however, can get the clipping information > from PyMOL and write scripts against that yourself to determine atom > inclusion. See get_view (http://www.pymolwiki.org/index.php/Get_View) > for more help. > 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): set_view (\ 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? Best regards Johannes > On Thu, Feb 24, 2011 at 3:50 AM, Johannes Wollbold wrote: > >> Hello, >> >> I clipped a part of a protein by a slab, by manual, graphical >> inspection. Now I want to select the slab and store the clipped atoms as >> new molecule (pdb file), in order to sum up the accessible surface area >> previously computed by an external program. Unfortunately I didn't find >> hints, e.g. in the selection algebra >> (http://www.pymolwiki.org/index.php/Selection_Algebra). >> >> Thanks for your advice. >> Johannes >> >> ```
 Re: [PyMOL] select clipped atoms From: Tsjerk Wassenaar - 2011-02-25 16:43:28 Attachments: Message as HTML ```Hi Johannes, 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) ] 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, Tsjerk On Feb 25, 2011 5:18 PM, "Johannes Wollbold" 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): set_view (\ 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? Best regards Johannes > On Thu, Feb 24, 2011 at 3:50 AM, Johannes Wollbold wrote: > >> Hello, >> >>... ```
 Re: [PyMOL] select clipped atoms From: Johannes Wollbold - 2011-02-25 18:17:34 Attachments: Message as HTML ```Tsjerk Wassenaar wrote: > > Hi Johannes, > > 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) ] > Fine, it's that simple! (First I didn't realize that it is sufficient to transform the atom coordinates of the pdb file). > > So clipped should do the transform and check whether the atom is > clipped. The trick then is to turn m back into a selection. > That would be nice, but isn't absolutely necessary. At present, it is sufficient to have the indices of the clipped atoms. Thanks Johannes > Hope it helps, > > Tsjerk > >> On Feb 25, 2011 5:18 PM, "Johannes Wollbold" > > 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): >> >> set_view (\ >> 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? >> >> Best regards >> Johannes >> >> > On Thu, Feb 24, 2011 at 3:50 AM, Johannes Wollbold >> > wrote: > >> Hello, >> >>... >> ```
 Re: [PyMOL] select clipped atoms From: Johannes Wollbold - 2011-03-02 16:27:14 Attachments: Message as HTML ```Hi, I implemented the coordinate transformation and the selection of atoms outside PyMol, in R. In principle it works, but there seems to be some error, since too many atoms are selected, corresponding roughly, but not completely to an enlarged clipping corridor between the planes defined by get_view, matrix elements (6,1) and (6,2). Or could it be that not the complete slab is visualized in PyMol? However, the missing atoms are completely shadowed. Do I understand the rows of the view matrix well (see http://www.pymolwiki.org/index.php/Get_View), by computing the following coordinate transformation?: 1) Translation of the original pdb coordinates by subtracting row 5 of the view matrix (translation of the coordinate origin to the rotation center). 2) Rotation of the coordinates by rows 1-3 of the view matrix. 3) Test: view[4,3] + view[6,1]) <= z <= view[4,3] + view[6,2]. Sorry for this simple question of affine geometry, but I hope I did not make a logical mistake in this domain... Regards Johannes Tsjerk Wassenaar wrote: > > Hi Johannes, > > 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) ] > > 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, > > Tsjerk > >> On Feb 25, 2011 5:18 PM, "Johannes Wollbold" > > 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): >> >> set_view (\ >> 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? >> >> Best regards >> Johannes >> >> > On Thu, Feb 24, 2011 at 3:50 AM, Johannes Wollbold >> > wrote: > >> Hello, >> >>... >> ```
 Re: [PyMOL] select clipped atoms From: Tsjerk Wassenaar - 2011-03-03 07:06:15 ```Hi Johannes, Coincidentally, I found myself in need of the same functionality the other day. I came up with this: #### 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) ] #### The function 'clipped' returns a list of IDs for atoms from a given selection that are outside the clipping planes. You can use it like: run clipped.py fetch 3lzt,async=0 clip near,-30 cmd.select_list("clipsed","3lzt",clipped("3lzt")) orient hide show spheres, not clipsed Hope it helps, Tsjerk On Wed, Mar 2, 2011 at 5:27 PM, Johannes Wollbold wrote: > Hi, > > I implemented the coordinate transformation and the selection of atoms > outside PyMol, in R. In principle it works, but there seems to be some > error, since too many atoms are selected, corresponding roughly, but not > completely to an enlarged clipping corridor between the planes defined by > get_view, matrix elements (6,1) and (6,2).  Or could it be that not the > complete slab is visualized in PyMol? However, the missing atoms are > completely shadowed. > > Do I understand the rows of the view matrix well (see > http://www.pymolwiki.org/index.php/Get_View), by computing the following > coordinate transformation?: > 1) Translation of the original pdb coordinates by subtracting row 5 of the > view matrix (translation of the coordinate origin to the rotation center). > 2) Rotation of the coordinates by rows 1-3 of the view matrix. > 3) Test: view[4,3] + view[6,1]) <= z <= view[4,3] + view[6,2]. > > Sorry for this simple question of affine geometry, but I hope I did not make > a logical mistake in this domain... > > Regards > Johannes > > > Tsjerk Wassenaar wrote: > > Hi Johannes, > > 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) ] > > 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, > > Tsjerk > > On Feb 25, 2011 5:18 PM, "Johannes Wollbold" 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): > > set_view (\ >     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? > > Best regards > Johannes > >> On Thu, Feb 24, 2011 at 3:50 AM, Johannes Wollbold >> wrote: > >> Hello, >> >>... > > > ------------------------------------------------------------------------------ > Free Software Download: Index, Search & Analyze Logs and other IT data in > Real-Time with Splunk. Collect, index and harness all the fast moving IT > data > generated by your applications, servers and devices whether physical, > virtual > or in the cloud. Deliver compliance at lower cost and gain new business > insights. http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > PyMOL-users mailing list (PyMOL-users@...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pymol-users@... > -- Tsjerk A. Wassenaar, Ph.D. post-doctoral researcher Molecular Dynamics Group * Groningen Institute for Biomolecular Research and Biotechnology * Zernike Institute for Advanced Materials University of Groningen The Netherlands ```
 Re: [PyMOL] select clipped atoms From: Jason Vertrees - 2011-03-03 07:06:57 ```Hi Johannes, My guess is that you missed that get_view[0:8] is a _column-major_ rotation matrix. Transpose it before using it. I decided to take a look at this problem for preparation of better clipping planes in PyMOL. I got it to work in PyMOL using Python, after much fussing about. Here's what I did: * center the molecule in the model space * rotate by the transpose of the rotation matrix. * add the model-based origin of rotation back to the coordinates * compare the z-values to the z-values of the clipping planes. I'll clean up the code and post it tomorrow on the wiki if I remember. I made a few other convenience functions for placing pseudoatoms at the origin or rotation, camera center, etc. Last, atom labels have an offset, so will disappear at a different time than their corresponding atoms; also, if you cannot see the atom, it could still be shown--it could be very slightly inside the slab, but hinted away for a better viewing experience. Cheers, -- Jason On Wed, Mar 2, 2011 at 11:27 AM, Johannes Wollbold wrote: > Hi, > > I implemented the coordinate transformation and the selection of atoms > outside PyMol, in R. In principle it works, but there seems to be some > error, since too many atoms are selected, corresponding roughly, but not > completely to an enlarged clipping corridor between the planes defined by > get_view, matrix elements (6,1) and (6,2).  Or could it be that not the > complete slab is visualized in PyMol? However, the missing atoms are > completely shadowed. > > Do I understand the rows of the view matrix well (see > http://www.pymolwiki.org/index.php/Get_View), by computing the following > coordinate transformation?: > 1) Translation of the original pdb coordinates by subtracting row 5 of the > view matrix (translation of the coordinate origin to the rotation center). > 2) Rotation of the coordinates by rows 1-3 of the view matrix. > 3) Test: view[4,3] + view[6,1]) <= z <= view[4,3] + view[6,2]. > > Sorry for this simple question of affine geometry, but I hope I did not make > a logical mistake in this domain... > > Regards > Johannes > > > Tsjerk Wassenaar wrote: > > Hi Johannes, > > 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) ] > > 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, > > Tsjerk > > On Feb 25, 2011 5:18 PM, "Johannes Wollbold" 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): > > set_view (\ >     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? > > Best regards > Johannes > >> On Thu, Feb 24, 2011 at 3:50 AM, Johannes Wollbold >> wrote: > >> Hello, >> >>... > > > ------------------------------------------------------------------------------ > Free Software Download: Index, Search & Analyze Logs and other IT data in > Real-Time with Splunk. Collect, index and harness all the fast moving IT > data > generated by your applications, servers and devices whether physical, > virtual > or in the cloud. Deliver compliance at lower cost and gain new business > insights. http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > PyMOL-users mailing list (PyMOL-users@...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pymol-users@... > -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) Jason.Vertrees@... (o) +1 (603) 374-7120 ```
 Re: [PyMOL] select clipped atoms From: Johannes Wollbold - 2011-03-03 14:43:34 Attachments: Message as HTML ```Hello Tsjerk, I can use the function and commands. print clipped("clipsed") - but not print clipped("3lzt") - shows the indices of the atoms between the clipping planes Tsjerk Wassenaar wrote: > Hi Johannes, > > Coincidentally, I found myself in need of the same functionality the > other day. I came up with this: > > #### > > 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] > > ATTENTION: The rotation matrix is in column-major order ; - that's understandable. Hence by multiplying with v[2], v[5] and v[8], you multiply the third column - not row! - with the coordinate vector, in order to get the rotated z-component. The matrix seems to be transposed. For me that is very unusual. In my R script, I made ordinary matrix multiplication and got erroneous results. > 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) ] > > #### > > The function 'clipped' returns a list of IDs for atoms from a given > selection that are outside the clipping planes. You can use it like: > The function returns the atoms inside the planes. > run clipped.py > fetch 3lzt,async=0 > clip near,-30 > cmd.select_list("clipsed","3lzt",clipped("3lzt")) > orient > hide > show spheres, not clipsed > Hence show spheres, clipsed reproduces the selection by a previous slab. Thank you very much. Johannes > On Wed, Mar 2, 2011 at 5:27 PM, Johannes Wollbold wrote: > >> Hi, >> >> I implemented the coordinate transformation and the selection of atoms >> outside PyMol, in R. In principle it works, but there seems to be some >> error, since too many atoms are selected, corresponding roughly, but not >> completely to an enlarged clipping corridor between the planes defined by >> get_view, matrix elements (6,1) and (6,2). Or could it be that not the >> complete slab is visualized in PyMol? However, the missing atoms are >> completely shadowed. >> >> Do I understand the rows of the view matrix well (see >> http://www.pymolwiki.org/index.php/Get_View), by computing the following >> coordinate transformation?: >> 1) Translation of the original pdb coordinates by subtracting row 5 of the >> view matrix (translation of the coordinate origin to the rotation center). >> 2) Rotation of the coordinates by rows 1-3 of the view matrix. >> 3) Test: view[4,3] + view[6,1]) <= z <= view[4,3] + view[6,2]. >> >> Sorry for this simple question of affine geometry, but I hope I did not make >> a logical mistake in this domain... >> >> Regards >> Johannes >> >> >> Tsjerk Wassenaar wrote: >> >> Hi Johannes, >> >> 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) ] >> >> 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, >> >> Tsjerk >> >> On Feb 25, 2011 5:18 PM, "Johannes Wollbold" 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): >> >> set_view (\ >> 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? >> >> Best regards >> Johannes >> >> >>> On Thu, Feb 24, 2011 at 3:50 AM, Johannes Wollbold >>> wrote: > >> Hello, >> >>... >>> >> ------------------------------------------------------------------------------ >> Free Software Download: Index, Search & Analyze Logs and other IT data in >> Real-Time with Splunk. Collect, index and harness all the fast moving IT >> data >> generated by your applications, servers and devices whether physical, >> virtual >> or in the cloud. Deliver compliance at lower cost and gain new business >> insights. http://p.sf.net/sfu/splunk-dev2dev >> _______________________________________________ >> PyMOL-users mailing list (PyMOL-users@...) >> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >> Archives: http://www.mail-archive.com/pymol-users@... >> >> > > > > ```
 Re: [PyMOL] select clipped atoms From: Tsjerk Wassenaar - 2011-03-03 14:58:24 ```Hi Johannes, > I can use the function and commands. print clipped("clipsed") - but not > print clipped("3lzt") - shows the indices of the atoms between the clipping > planes print clipped("3lzt") should print the indices of atoms that are clipped off by the clipping planes. That works for me, but in terms of the lines I sent, you may want to first save the clipping selection to a variable. > ATTENTION: The rotation matrix is in column-major order - that's > understandable. Hence by multiplying with v[2], v[5] and v[8], you multiply > the third column - not row! - with the coordinate vector, in order to get > the rotated z-component. The matrix seems to be transposed. For me that is > very unusual. In my R script, I made ordinary matrix multiplication and got > erroneous results. Well, the transpose is just the reverse rotation. It's merely a matter of what the programmer had in mind when writing it :) In your R script, you could just have tried t(R) %*% x in stead of R %*% x ;) Cheers, Tsjerk -- Tsjerk A. Wassenaar, Ph.D. post-doctoral researcher Molecular Dynamics Group * Groningen Institute for Biomolecular Research and Biotechnology * Zernike Institute for Advanced Materials University of Groningen The Netherlands ```