File: cam2crd.pym

package info (click to toggle)
pymol 2.4.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 43,312 kB
  • sloc: cpp: 480,106; python: 79,860; ansic: 28,343; javascript: 6,792; sh: 47; makefile: 30; csh: 8
file content (22 lines) | stat: -rw-r--r-- 568 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

# applies the current camera view to the atomic coordinates
# and resets the camera

def cam2crd(sele="all"):
    view=cmd.get_view()
    ttt = [ view[0], view[3], view[6], 0.0, 
     view[1], view[4], view[7], 0.0, 
     view[2], view[5], view[8], 0.0, 
     -view[12], -view[13], -view[14], 1.0]
    cmd.transform_selection(sele,ttt)
    new_view = [ 1.0, 0.0, 0.0,
    	     0.0, 1.0, 0.0, 
             0.0, 0.0, 1.0, 
             0.0, 0.0, view[11],
             0.0, 0.0, 0.0,
             view[15], view[16], view[17]]
    cmd.set_view(new_view)

cam2crd()