File: test_surf.py

package info (click to toggle)
openstructure 2.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 206,240 kB
  • sloc: cpp: 188,571; python: 36,686; ansic: 34,298; fortran: 3,275; sh: 312; xml: 146; makefile: 29
file content (26 lines) | stat: -rw-r--r-- 785 bytes parent folder | download | duplicates (4)
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
struct=io.LoadEntity("sdh.pdb")
surf=io.LoadSurface("sdh","msms")
surf.Attach(struct,5.0)
go=gfx.Surface("surf",surf)
scene.Add(go)
scene.SetCenter(go.GetCenter())
scene.Autoslab()

# color surface by atomic properties

# slow version, via positional search
#gradient=gfx.Gradient()
#gradient.SetColorAt(0.0, gfx.Color(0.0, 0.0, 1.0, 1.0))  # blue
#gradient.SetColorAt(0.5, gfx.Color(1.0, 1.0, 1.0, 1.0))  # white
#gradient.SetColorAt(1.0, gfx.Color(1.0, 0.0, 0.0, 1.0))  # red
#ev=struct.Select("")
#go.ColorBy(ev,"abfac",gradient,30,80)

# fast version, via attached atoms
go.ColorBy("abfac",gfx.Color(0,0,1),gfx.Color(1,0,0),30,80)

# clear
go.SetColor(gfx.Color(1,1,1))

# color by selection, again based on the attached structure
go.SetColor(gfx.Color(1,1,0),"rname=PHE,TYR,TRP")