-
Notifications
You must be signed in to change notification settings - Fork 0
/
graph2vmd.py
63 lines (53 loc) · 1.38 KB
/
graph2vmd.py
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
53
54
55
56
57
58
59
60
61
62
63
import math, os, sys
part = sys.argv[1]
pdb_file = sys.argv[2]
vmd_input = open(part + '.vmd', 'w')
part = open(part, 'r')
vmd_input.write( '''#!/usr/local/bin/vmd
# VMD script written by graph2py by M. Wolter
# VMD version: 1.9.2
set viewplist {}
set fixedlist {}
mol new %s type pdb first 0 last -1 step 1 filebonds 1 autobonds 1 waitfor all
mol delrep 0 top
''' % pdb_file)
res = 1
for line in part:
frag_num = int(line)
vmd_input.write( '''mol representation NewRibbons 0.350000 12.000000 5.500000 0
mol color ColorID %d
mol selection {resid %d to %d}
mol material Opaque
mol addrep top
''' % (frag_num, res, res))
res = res+1
#works only for dp
#for line in part:
# frag_num = int(line)
# if frag_num < frag_num_last and frag_num_last >= 0:
# frag_end = res-1
# vmd_input.write( '''mol representation NewRibbons 0.350000 12.000000 5.500000 0
#mol color ColorID %d
#mol selection {resid %d to %d}
#mol material Opaque
#mol addrep top
#''' % (colorid, frag_start, frag_end))
# colorid = colorid + 1
# frag_start = res
# res = res+1
# frag_num_last = frag_num
vmd_input.write( '''unset viewplist
unset fixedlist
proc vmdrestoremycolors {} {
color scale method RWB
set colorcmds {
{color Display {Background} white}
}
foreach colcmd $colorcmds {
set val [catch {eval $colcmd}]
}
}
vmdrestoremycolors
''')
vmd_input.close
part.close