-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtc_v1.3.0.tcl
139 lines (110 loc) · 3.27 KB
/
tc_v1.3.0.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#----------------------------------------------------------------------
#>@brief Display the VMD "dynamic" Field (beta, charge, occupancy, ...)"
#> Laboratory of Theoretical Chemistry - LQT
#>@e-mail bug report to: [email protected]
#>@note Revision history
# 07.11.2018
# 14.11.2018 Release v_1.1.0
# 22.11.2018 Release v_1.2.0
# 31.08.2020 Release v_1.3.0
# 15.09.2021 Release V_1.3.1
# Note: A Render is obtained with TachyonInternal
#---------------------------------------------------------------------
#!/usr/bin/tclsh
set PROG_NAME tc.tcl
set VERSION v1.3.0
proc display_usage {name argc} {
if { $argc < 0 } {
puts ""
puts "Not enough arguments in command line."
puts "Usage: vmd -(xyz|gro) <file>.(xyz|gro) -e $name -args -f <field-file> "
puts ""
puts "Options:"
puts "-h Display this help."
puts "-v Display the version of script."
puts "-f <field> Name field data file."
puts "-r (0|1) Enable render"
puts ""
exit
}
}
proc display_version {name version} {
puts "$name $version"
puts "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/license/gpl.html>."
puts "This a free software: you are free to change and redistributibe it."
puts "There is NO WARRANTY, to the extent permited by law."
puts ""
puts "Laboratory of Theoretical Chemistry, LQT -- UFSCar"
puts "e-mail: Report bug to: e-mail: [email protected]"
puts ""
exit
}
proc draw_field {data} {
set data_exists [file exist $data]
if { $data_exists == 0 } {
puts "No such file: $data. Check the name file."
exit
}
set data_name [open $data r]
set numframes [molinfo top get numframes]
set numatoms [molinfo top get numatoms]
set min 9999.9
set max -9999.9
for {set k 0} {$k<($numatoms)} {incr k} {
set min_tmp [gets $data_name]
if { $min_tmp < $min } {
set min $min_tmp
}
}
seek $data_name 0
for {set k 0} {$k<($numatoms)} {incr k} {
set max_tmp [gets $data_name]
if { $max_tmp > $max } {
set max $max_tmp
}
}
seek $data_name 0
axes location LowerLeft
mol modcolor 0 top User
mol colupdate 0 top 1
mol scaleminmax top 0 $min $max
# mol modstyle 0 0 CPK 0.5 0.0 10 0
mol modstyle 0 0 VDW 0.2 25.0
animate goto 0
for {set i 0} {$i<$numframes} {incr i} {
for {set j 0} {$j<($numatoms)} {incr j} {
set field [gets $data_name]
set atomsel [atomselect top "index $j" frame $i]
$atomsel set user $field
$atomsel delete
}
}
}
set num 1
foreach args $argv {
switch $args {
-h {
display_usage $PROG_NAME $argv
}
-v {
display_version $PROG_NAME $VERSION
}
-f {
if { $argc < 2 } {
puts "Not enough arguments in command line."
puts ""
exit
}
set data [lindex $argv 1]
draw_field $data
set show [lindex $argv 3]
if { $show == 0 } {
render TachyonInternal output.ppm
}
}
}
incr num
}
if { $show == 0 } {
exit
}