File: cgo02.py

package info (click to toggle)
pymol 1.7.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 42,668 kB
  • ctags: 25,775
  • sloc: ansic: 494,779; python: 75,446; cpp: 20,088; makefile: 351; sh: 172; csh: 21
file content (50 lines) | stat: -rw-r--r-- 855 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from pymol.cgo import *
from pymol import cmd
import math

# this is an example of creating a cgo object consisting of multiple
# states which form a movie

for a in range(1,62):

   # create a state with some unique geometry

   obj = [
      BEGIN, LINES,
      COLOR, 1.0, 1.0, 1.0,

      VERTEX, 0.0, 0.0, 0.0,
      VERTEX, 1.0, 0.0, 0.0,

      VERTEX, 0.0, 0.0, 0.0,
      VERTEX, 0.0, 2.0, 0.0,

      VERTEX, 0.0, 0.0, 0.0,
      VERTEX, 00, 0.0, 3.0,

      END,

      BEGIN, TRIANGLES,

      COLOR, 1.0, 0.2, 0.2,
      
      VERTEX, 0.0, 0.0, 0.0,
      VERTEX, math.cos((a-1)/10.0), math.sin((a-1)/10.0), 2.0,
      VERTEX, 0.0, 0.0, 2.0,
      
      END
      ]

   # load state into PyMOL

   cmd.load_cgo(obj,'cgo02',a)

# this moves the rear clipping plane back a bit

cmd.clip('far',-5)

# now, start the movie

cmd.mplay()