-
Notifications
You must be signed in to change notification settings - Fork 0
/
libs.tcl
82 lines (76 loc) · 2.82 KB
/
libs.tcl
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Farhad Ramezanghorbani
# Measure the PEG/W bulk ratio
# at the vicinity (R = 0.7 nm)
# of each amino acid
proc vicinRatio {R start end fout} {
set outfile [open $fout w]
set sel [atomselect top "all not (resname PEG4 or resname W or resname ION)"]
set reslist [lsort -unique [$sel get resname]]
set W [atomselect top "resname W"]
set P [atomselect top "resname PEG4"]
set Wtot [$W num]
set Ptot [$P num]
set bulk [expr {double($Ptot)/(4*double($Wtot))}]
set nframe [molinfo top get numframes]
set nframe [expr $end - $start + 1]
foreach res $reslist {
set WL [atomselect top "resname W and pbwithin $R of resname $res"]
set PL [atomselect top "resname PEG4 and pbwithin $R of resname $res"]
set Wcount 0
set Pcount 0
set wval 0
set pval 0
for {set frame $start} {$frame <= $end} {incr frame} {
$WL frame $frame
$WL update
$PL frame $frame
$PL update
set wval [$WL num]
set pval [$PL num]
set Wcount [expr {$Wcount + 4*($wval)}]
set Pcount [expr {$Pcount + $pval}]
}
puts "$res : [expr {double($Pcount)/double($Wcount)/double($bulk)}]"
puts $outfile "$res : [expr {double($Pcount)/double($Wcount)/double($bulk)}]"
}
puts "Bulk ratio : $bulk"
puts $outfile "Bulk ratio : $bulk"
close $outfile
}
# return dictionary of data: ratio(beadtype)
proc vicinRatioBeads {R start end List} {
global rateArray
set sel [atomselect top "all not (resname PEG or resname W or resname ION)"]
set namelist [lsort -unique [$sel get name]]
set W [atomselect top "resname W"]
set P [atomselect top "resname PEG"]
set Wtot [$W num]
set Ptot [$P num]
set bulk [expr {double($Ptot)/(4*double($Wtot))}]
set nframe [molinfo top get numframes]
set nframe [expr $end - $start + 1]
# changed namelist to List and name to index after here
foreach index $List {
set WL [atomselect top "resname W and pbwithin $R of index $index"]
set PL [atomselect top "resname PEG and pbwithin $R of index $index"]
set Wcount 0
set Pcount 0
set wval 0
set pval 0
for {set frame $start} {$frame <= $end} {incr frame} {
$WL frame $frame
$WL update
$PL frame $frame
$PL update
set wval [$WL num]
set pval [$PL num]
set Wcount [expr {$Wcount + 4*($wval)}]
set Pcount [expr {$Pcount + $pval}]
}
puts "done with $index"
#puts "$name : [expr {double($Pcount)/double($Wcount)/double($bulk)}]"
set rateArray($index) [expr {double($Pcount)/double($Wcount)/double($bulk)}]
}
#puts "Bulk ratio : $bulk"
set rateArray(bulk) $bulk
}