File: brick01.py

package info (click to toggle)
pymol 2.5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 42,288 kB
  • sloc: cpp: 476,472; python: 76,538; ansic: 29,510; javascript: 6,792; sh: 47; makefile: 24
file content (52 lines) | stat: -rw-r--r-- 879 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
51
52



# ===============================
# brick creation

from chempy.brick import Brick

brik = Brick()

brik.setup_from_min_max(
   [0.0,0.0,0.0],
   [2.0,2.0,2.0],
   [0.2,0.2,0.2])

# ===============================
# brick data

import math

for x in range(11):
   for y in range(11):   
      for z in range(11):
          mx=1.5*(x-5)
          my=2*(y-5)
          mz=3*(z-5)
          brik.lvl[x,y,z]=1/math.exp(math.sqrt(mx*mx+my*my+mz*mz)/10.0)

# ===============================
# easy pickling code

#from chempy import io

#io.pkl.toFile(brik,"brick.pkb")

#brik = io.pkl.fromFile("brick.pkb")

# ===============================
# for display

#from pymol import cmd

cmd.load_brick(brik,"brick")

for a in range(6):
	lvl = a/10.0+0.3
	cmd.do("isomesh lvl%1.0f=brick,%0.1f" %(lvl*10,lvl))

cmd.disable()
cmd.enable("brick")
cmd.enable("lvl6")
cmd.color("red","brick")