Changeset 1030 for branches/sandbox
- Timestamp:
- Oct 18, 2010 10:22:17 PM (10 years ago)
- Location:
- branches/sandbox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/sandbox/disagledit.tcl
r1023 r1030 1 1 proc DA_Initialize {} { 2 catch {unset ::da_ddrad}3 catch {unset ::da_darad}4 catch {unset ::da_drad}5 catch {unset ::da_arad}6 catch {unset ::da_acon}7 catch {unset ::da_dcon}2 catch {unset ::da_ddrad} 3 catch {unset ::da_darad} 4 catch {unset ::da_drad} 5 catch {unset ::da_arad} 6 catch {unset ::da_acon} 7 catch {unset ::da_dcon} 8 8 set ::da_quit 1 9 set ::da_phase $::expmap(phaselist)10 foreach j $::da_phase {9 set ::da_phase $::expmap(phaselist) 10 foreach j $::da_phase { 11 11 set ::da_dcon($j) [phaseinfo $j DistCalc] 12 12 set b [regexp -all {[0-9]} $::da_dcon($j)] 13 13 if {$b > 0} { 14 set ::da_dval($j) $::da_dcon($j)] 15 } else { 16 set ::da_dval$j "" 14 set ::da_dval($j) $::da_dcon($j)] 15 } else { 16 set ::da_dval$j "" 17 } 18 19 set ::da_acon($j) [phaseinfo $j AngCalc] 20 set c [regexp -all {[0-9]} $::da_acon($j)] 21 if {$c > 0} {set ::da_aval$j $::da_acon($j) 22 } else { 23 set ::da_aval$j ""} 24 25 } 26 27 } 28 29 proc DA_Read {} { 30 31 set ::da_list [AtmTypList] 32 set da_angrad [DefAtmTypInfo angrad] 33 set da_distrad [DefAtmTypInfo distrad] 34 35 #Build search arrays 36 #::da_darad array contains default angle search radii 37 #::da_ddrad array contains default distance search radii 38 #::da_arad array contains current angle search radii 39 #::da_drad array contains current distance search radii 40 41 foreach j $da_angrad { 42 set ::da_darad([lindex $j 0]) [lindex $j 1] 43 } 44 foreach k $da_distrad { 45 set ::da_ddrad([lindex $k 0]) [lindex $k 1] 46 } 47 foreach i $::da_list { 48 set ::da_drad($i) [AtmTypInfo distrad $i] 49 set ::da_arad($i) [AtmTypInfo angrad $i] 50 } 51 } 52 53 #**************** Build Disagl Control Panel **************************** 54 55 proc DA_Control_Panel {"launchdisagl 0"} { 56 DA_Initialize 57 DA_Read 58 destroy .disaglcon 59 set dcb .disaglcon 60 catch {toplevel $dcb} 61 eval destroy [winfo children $dcb] 62 63 #construct phase control box in phasecon frame 64 set phasecon $dcb.phasecon 65 frame $phasecon -bd 2 -relief groove 66 grid $phasecon -column 0 -row 0 67 68 label $phasecon.lbl1 -text "Bond Search \n Method" 69 label $phasecon.lbl2 -text "Angle Search \n Method" 70 grid $phasecon.lbl1 -column 1 -row 0 71 grid $phasecon.lbl2 -column 2 -row 0 72 73 74 foreach i $::da_phase { 75 label $phasecon.phase$i -text "Phase $i" -width 8 76 set tacon [regexp {[0-9]+.[0-9]+} $::da_acon($i)] 77 set tdcon [regexp {[0-9]+.[0-9]+} $::da_dcon($i)] 78 if {$tacon} {set alist {none radii $::da_acon($i)} 79 } else {set alist {none radii {fixed search range}}} 80 if {$tdcon} {set dlist {none radii $::da_dcon($i)} 81 } else {set dlist {none radii {fixed search range}}} 82 83 # set list {none radii {fixed search range}} 84 #if {[set ::da_dval$i] != ""} {lappend list [set ::da_dval$i]} 85 eval tk_optionMenu $phasecon.dist$i ::da_dcon($i) $dlist 86 $phasecon.dist$i config -width 10 87 eval tk_optionMenu $phasecon.ang$i ::da_acon($i) $alist 88 $phasecon.ang$i config -width 10 89 grid $phasecon.phase$i -row $i -column 0 -padx 10 90 grid $phasecon.dist$i -row $i -column 1 -padx 10 91 grid $phasecon.ang$i -row $i -column 2 -padx 10 92 } 93 94 trace var ::da_dcon w DA_Controls 95 trace var ::da_acon w DA_Controls 96 97 98 #save box 99 set dasave $dcb.dasave 100 frame $dasave -bd 2 -relief groove 101 grid $dasave -column 0 -row 2 102 103 if {$launchdisagl} { 104 wm title $dcb "DISAGL Control Panel" 105 grab release $dcb 106 checkbutton $dasave.option -text "DISAGL output in separate window" \ 107 -variable ::expgui(disaglSeparateBox) 108 grid $dasave.option -row 0 -column 0 109 button $dasave.sexit -text "Save and run DISAGL" -command DA_Save -bg LightGreen 110 grid $dasave.sexit -row 1 -column 0 111 } else { 112 wm title $dcb "Distance Search Parameters" 113 grab release $dcb 114 button $dasave.sexit -text "Save and Exit" -command DA_Save -bg LightGreen 115 grid $dasave.sexit -row 0 -column 0 116 } 117 button $dasave.quit -text "Cancel" -command "destroy $dcb" 118 grid $dasave.quit -row 2 -column 0 119 120 121 #construct control box 122 123 124 set dacon $dcb.dacon 125 frame $dacon -bd 2 -relief groove 126 grid $dacon -column 1 -row 2 127 128 button $dacon.default -text "Restore to Default Radii" -command { 129 foreach i $::da_list { 130 set ::da_drad($i) $::da_ddrad([lindex [split $i {+-}] 0]) 131 set ::da_arad($i) $::da_darad([lindex [split $i {+-}] 0]) 132 } 133 } 134 grid $dacon.default -row 3 -column 0 -columnspan 3 135 136 label $dacon.dradcon -text "Increment All Bond Search Radii (0.10 A)" 137 label $dacon.aradcon -text "Increment All Angle Search Radii (0.10 A)" 138 button $dacon.dradup -text "\u2191" -command DA_Inc_Drad 139 button $dacon.draddn -text "\u2193" -command DA_Dec_Drad 140 button $dacon.aradup -text "\u2191" -command DA_Inc_Arad 141 button $dacon.araddn -text "\u2193" -command DA_Dec_Arad 142 grid $dacon.dradcon -column 0 -row 0 -pady 5 143 grid $dacon.dradup -column 1 -row 0 -padx 5 144 grid $dacon.draddn -column 2 -row 0 -padx 5 145 grid $dacon.aradcon -column 0 -row 1 -pady 5 146 grid $dacon.aradup -column 1 -row 1 -padx 5 147 grid $dacon.araddn -column 2 -row 1 -padx 5 148 149 # button $dacon.radcon -text "Radii Editor" -command {DA_Radii_Box .disaglcon} 150 # grid $dacon.radcon -row 1 -column 0 151 152 DA_Radii_Box .disaglcon 153 putontop .disaglcon 154 tkwait window .disaglcon 155 afterputontop 156 return $::da_quit 157 158 } 159 160 proc DA_Controls {var phase junk } { 161 if {[set ${var}($phase)] == "none"} { 162 if {$var == "::da_acon"} { 163 set ::da_dcon($phase) "none" 164 #puts 1 165 } else { 166 set ::da_acon($phase) "none" 167 #puts 2 17 168 } 18 19 set ::da_acon($j) [phaseinfo $j AngCalc]20 set c [regexp -all {[0-9]} $::da_acon($j)]21 if {$c > 0} {set ::da_aval$j $::da_acon($j) 169 } 170 if {[set ${var}($phase)] != "none" && ($::da_dcon($phase) == "none" || $::da_acon($phase) == "none")} { 171 if {$var == "::da_acon"} { 172 set ::da_dcon($phase) "radii" 22 173 } else { 23 set ::da_aval$j ""} 24 25 } 26 27 } 28 29 proc DA_Read {} { 30 31 set ::da_list [AtmTypList] 32 set da_angrad [DefAtmTypInfo angrad] 33 set da_distrad [DefAtmTypInfo distrad] 34 35 #Build search arrays 36 #::da_darad array contains default angle search radii 37 #::da_ddrad array contains default distance search radii 38 #::da_arad array contains current angle search radii 39 #::da_drad array contains current distance search radii 40 41 foreach j $da_angrad { 42 set ::da_darad([lindex $j 0]) [lindex $j 1] 43 } 44 foreach k $da_distrad { 45 set ::da_ddrad([lindex $k 0]) [lindex $k 1] 46 } 47 foreach i $::da_list { 48 set ::da_drad($i) [AtmTypInfo distrad $i] 49 set ::da_arad($i) [AtmTypInfo angrad $i] 50 } 51 } 52 53 #**************** Build Disagl Control Panel **************************** 54 55 proc DA_Control_Panel {"launchdisagl 0"} { 56 DA_Initialize 57 DA_Read 58 destroy .disaglcon 59 set dcb .disaglcon 60 catch {toplevel $dcb} 61 eval destroy [winfo children $dcb] 62 63 #construct phase control box in phasecon frame 64 set phasecon $dcb.phasecon 65 frame $phasecon -bd 2 -relief groove 66 grid $phasecon -column 0 -row 0 67 68 label $phasecon.lbl1 -text "Bond Search \n Method" 69 label $phasecon.lbl2 -text "Angle Search \n Method" 70 grid $phasecon.lbl1 -column 1 -row 0 71 grid $phasecon.lbl2 -column 2 -row 0 72 73 74 foreach i $::da_phase { 75 label $phasecon.phase$i -text "Phase $i" -width 8 76 set tacon [regexp {[0-9]+.[0-9]+} $::da_acon($i)] 77 set tdcon [regexp {[0-9]+.[0-9]+} $::da_dcon($i)] 78 if {$tacon} {set alist {none radii $::da_acon($i)} 79 } else {set alist {none radii {fixed search range}}} 80 if {$tdcon} {set dlist {none radii $::da_dcon($i)} 81 } else {set dlist {none radii {fixed search range}}} 82 83 # set list {none radii {fixed search range}} 84 #if {[set ::da_dval$i] != ""} {lappend list [set ::da_dval$i]} 85 eval tk_optionMenu $phasecon.dist$i ::da_dcon($i) $dlist 86 $phasecon.dist$i config -width 10 87 eval tk_optionMenu $phasecon.ang$i ::da_acon($i) $alist 88 $phasecon.ang$i config -width 10 89 grid $phasecon.phase$i -row $i -column 0 -padx 10 90 grid $phasecon.dist$i -row $i -column 1 -padx 10 91 grid $phasecon.ang$i -row $i -column 2 -padx 10 92 } 93 94 trace var ::da_dcon w DA_Controls 95 trace var ::da_acon w DA_Controls 96 97 98 #save box 99 set dasave $dcb.dasave 100 frame $dasave -bd 2 -relief groove 101 grid $dasave -column 0 -row 2 102 103 if {$launchdisagl} { 104 wm title $dcb "DISAGL Control Panel" 105 grab release $dcb 106 checkbutton $dasave.option -text "DISAGL output in separate window" \ 107 -variable ::expgui(disaglSeparateBox) 108 grid $dasave.option -row 0 -column 0 109 button $dasave.sexit -text "Save and run DISAGL" -command DA_Save -bg LightGreen 110 grid $dasave.sexit -row 1 -column 0 111 } else { 112 wm title $dcb "Distance Search Parameters" 113 grab release $dcb 114 button $dasave.sexit -text "Save and Exit" -command DA_Save -bg LightGreen 115 grid $dasave.sexit -row 0 -column 0 116 } 117 button $dasave.quit -text "Cancel" -command "destroy $dcb" 118 grid $dasave.quit -row 2 -column 0 119 120 121 #construct control box 122 123 124 set dacon $dcb.dacon 125 frame $dacon -bd 2 -relief groove 126 grid $dacon -column 1 -row 2 127 128 button $dacon.default -text "Restore to Default Radii" -command { 129 foreach i $::da_list { 130 set ::da_drad($i) $::da_ddrad([lindex [split $i {+-}] 0]) 131 set ::da_arad($i) $::da_darad([lindex [split $i {+-}] 0]) 132 } 133 } 134 grid $dacon.default -row 3 -column 0 -columnspan 3 135 136 label $dacon.dradcon -text "Increment All Bond Search Radii (0.10 A)" 137 label $dacon.aradcon -text "Increment All Angle Search Radii (0.10 A)" 138 button $dacon.dradup -text "\u2191" -command DA_Inc_Drad 139 button $dacon.draddn -text "\u2193" -command DA_Dec_Drad 140 button $dacon.aradup -text "\u2191" -command DA_Inc_Arad 141 button $dacon.araddn -text "\u2193" -command DA_Dec_Arad 142 grid $dacon.dradcon -column 0 -row 0 -pady 5 143 grid $dacon.dradup -column 1 -row 0 -padx 5 144 grid $dacon.draddn -column 2 -row 0 -padx 5 145 grid $dacon.aradcon -column 0 -row 1 -pady 5 146 grid $dacon.aradup -column 1 -row 1 -padx 5 147 grid $dacon.araddn -column 2 -row 1 -padx 5 148 149 # button $dacon.radcon -text "Radii Editor" -command {DA_Radii_Box .disaglcon} 150 # grid $dacon.radcon -row 1 -column 0 151 152 DA_Radii_Box .disaglcon 153 putontop .disaglcon 154 tkwait window .disaglcon 155 afterputontop 156 return $::da_quit 157 158 } 159 160 proc DA_Controls {var phase junk } { 161 if {[set ${var}($phase)] == "none"} { 162 if {$var == "::da_acon"} { 163 set ::da_dcon($phase) "none" 164 puts 1 165 } else { 166 set ::da_acon($phase) "none" 167 puts 2 174 set ::da_acon($phase) "radii" 168 175 } 169 } 170 if {[set ${var}($phase)] != "none" && ($::da_dcon($phase) == "none" || $::da_acon($phase) == "none")} { 171 if {$var == "::da_acon"} { 172 set ::da_dcon($phase) "radii" 173 } else { 174 set ::da_acon($phase) "radii" 175 } 176 } 177 178 179 # if {[set ${var}($phase)] == "fixed search range"} {} 180 if {[set ${var}($phase)] != "none" && [set ${var}($phase)] != "radii" } { 181 catch {destroy .disaglcon.top} 182 set dedit .disaglcon.top 183 toplevel $dedit 184 bind $dedit <Return> "destroy $dedit" 185 # frame $dedit -bd 2 -relief groove 186 # pack $dedit -side top 187 set temp [regexp {[0-9]+.[0-9]+} [set ${var}($phase)]] 188 if {$temp == 0} {set ${var}($phase) 0.00} 189 if {$var == "::da_acon"} { 190 label $dedit.lbl1 -text "set angle fixed search range \n for phase $phase in angstroms" 191 # set ::da_acon($phase) 0 192 entry $dedit.entry1 -textvariable ::da_acon($phase) -takefocus 1 193 $dedit.entry1 selection range 0 end 194 grid $dedit.lbl1 -column 0 -row 0 195 grid $dedit.entry1 -column 0 -row 1 196 focus $dedit.entry1 197 } 198 if {$var == "::da_dcon"} { 199 # set ::da_dcon($phase) 0 200 label $dedit.lbl1 -text "set bond fixed search range \n for phase $phase in angstroms" 201 entry $dedit.entry1 -textvariable ::da_dcon($phase) -takefocus 1 202 $dedit.entry1 selection range 0 end 203 grid $dedit.lbl1 -column 0 -row 0 204 grid $dedit.entry1 -column 0 -row 1 205 focus $dedit.entry1 206 } 207 button $dedit.quit -text "Set" -command "destroy $dedit" 208 grid $dedit.quit -column 0 -row 2 209 putontop $dedit 210 tkwait window $dedit 211 afterputontop 212 } 213 214 215 216 217 # puts "phase = $phase" 218 # puts "var = $var" 219 # puts "new value = [set ${var}($phase)]" 176 } 177 178 179 # if {[set ${var}($phase)] == "fixed search range"} {} 180 if {[set ${var}($phase)] != "none" && [set ${var}($phase)] != "radii" } { 181 catch {destroy .disaglcon.top} 182 set dedit .disaglcon.top 183 toplevel $dedit 184 bind $dedit <Return> "destroy $dedit" 185 # frame $dedit -bd 2 -relief groove 186 # pack $dedit -side top 187 set temp [regexp {[0-9]+.[0-9]+} [set ${var}($phase)]] 188 if {$temp == 0} {set ${var}($phase) 0.00} 189 if {$var == "::da_acon"} { 190 label $dedit.lbl1 -text "set angle fixed search range \n for phase $phase in angstroms" 191 # set ::da_acon($phase) 0 192 entry $dedit.entry1 -textvariable ::da_acon($phase) -takefocus 1 193 $dedit.entry1 selection range 0 end 194 grid $dedit.lbl1 -column 0 -row 0 195 grid $dedit.entry1 -column 0 -row 1 196 focus $dedit.entry1 197 } 198 if {$var == "::da_dcon"} { 199 # set ::da_dcon($phase) 0 200 label $dedit.lbl1 -text "set bond fixed search range \n for phase $phase in angstroms" 201 entry $dedit.entry1 -textvariable ::da_dcon($phase) -takefocus 1 202 $dedit.entry1 selection range 0 end 203 grid $dedit.lbl1 -column 0 -row 0 204 grid $dedit.entry1 -column 0 -row 1 205 focus $dedit.entry1 206 } 207 button $dedit.quit -text "Set" -command "destroy $dedit" 208 grid $dedit.quit -column 0 -row 2 209 putontop $dedit 210 tkwait window $dedit 211 afterputontop 212 } 213 214 215 216 217 # puts "phase = $phase" 218 # puts "var = $var" 219 # puts "new value = [set ${var}($phase)]" 220 220 } 221 221 222 222 proc DA_Radii_Box {dcb args} { 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 223 #construct radii control box 224 catch {destory $dcb.radcon} 225 catch {destory $dcb.discon} 226 set radcon $dcb.radcon 227 frame $radcon -bd 2 -relief groove 228 grid $radcon -column 1 -row 0 -rowspan 2 229 230 label $radcon.lbl1 -text "Atom/Ion" 231 label $radcon.lbl2 -text "Bond \n Search Radii" 232 label $radcon.lbl3 -text "Angle \n Search Radii" 233 grid $radcon.lbl1 -row 0 -column 0 234 grid $radcon.lbl2 -row 0 -column 1 235 grid $radcon.lbl3 -row 0 -column 2 236 set count 1 237 foreach j [array names ::da_drad] { 238 label $radcon.atom$j -text "$j" -width 5 239 entry $radcon.drad$j -textvariable ::da_drad($j) -width 6 -takefocus 1 240 entry $radcon.arad$j -textvariable ::da_arad($j) -width 6 -takefocus 1 241 grid $radcon.atom$j -row $count -column 0 242 grid $radcon.drad$j -row $count -column 1 243 grid $radcon.arad$j -row $count -column 2 244 incr count 245 } 246 246 } 247 247 248 248 249 249 proc DA_Inc_Drad {args} { 250 251 252 250 foreach j [array names ::da_drad] { 251 set ::da_drad($j) [format %.1f [expr $::da_drad($j) + 0.1]] 252 } 253 253 } 254 254 255 255 proc DA_Dec_Drad {args} { 256 257 258 256 foreach j [array names ::da_drad] { 257 set ::da_drad($j) [format %.1f [expr $::da_drad($j) - 0.1]] 258 } 259 259 } 260 260 proc DA_Inc_Arad {args} { 261 262 263 261 foreach j [array names ::da_arad] { 262 set ::da_arad($j) [format %.1f [expr $::da_arad($j) + 0.1]] 263 } 264 264 } 265 265 proc DA_Dec_Arad {args} { 266 267 268 266 foreach j [array names ::da_drad] { 267 set ::da_arad($j) [format %.1f [expr $::da_arad($j) - 0.1]] 268 } 269 269 } 270 270 271 271 proc DA_Save {args} { 272 273 274 275 276 277 278 279 280 281 282 272 foreach i $::da_list { 273 if {$::da_drad($i) >= 0 && $::da_drad($i) <= 10000} { 274 AtmTypInfo distrad $i set $::da_drad($i) 275 } 276 puts 1 277 if {$::da_arad($i) >= 0 && $::da_arad($i) <= 10000} { 278 AtmTypInfo angrad $i set $::da_arad($i) 279 } 280 281 } 282 foreach j $::da_phase { 283 283 phaseinfo $j DistCalc set $::da_dcon($j) 284 284 phaseinfo $j AngCalc set $::da_acon($j) 285 286 287 288 289 290 } 285 } 286 # indicate a change to the .EXP file 287 incr ::expgui(changed) 288 set ::da_quit 0 289 destroy .disaglcon 290 } -
branches/sandbox/distrest.tcl
r1024 r1030 37 37 38 38 proc DisplayDistanceRestraints {args} { 39 #puts DisplayDistanceRestraints 39 40 global expcons 40 41 eval destroy [winfo children $expcons(distmaster)] … … 51 52 -sticky nsew 52 53 grid [frame $phasebox -bd 2 -relief groove] -column 0 -row 0 \ 53 54 -sticky new -columnspan 2 54 55 55 56 56 57 grid [frame $editorbox -bd 2 -relief groove] -column 0 -row 2 \ 57 58 -sticky sew -columnspan 2 58 59 59 60 … … 64 65 # Pick Phase to be Evaluated ********************************************** 65 66 label $phasebox.phlabel -text Phase 66 # set ::sr_phaselist $::expmap(phaselist)67 # set ::sr_phaselist $::expmap(phaselist) 67 68 68 69 eval tk_optionMenu $phasebox.phase ::sr_entryvar(softphase) $::expmap(phaselist) 69 # eval tk_optionMenu $phasebox.phase ::sr_entryvar(softphase) $::sr_phaselist70 # trace variable ::sr_entryvar(softphase) w DisplayDistanceRestraints71 # bind $phasebox.phase <ButtonRelease> {DisplayDistanceRestraints}70 # eval tk_optionMenu $phasebox.phase ::sr_entryvar(softphase) $::sr_phaselist 71 # trace variable ::sr_entryvar(softphase) w DisplayDistanceRestraints 72 # bind $phasebox.phase <ButtonRelease> {DisplayDistanceRestraints} 72 73 73 74 grid $phasebox.phlabel -column 0 -row 0 … … 78 79 grid [label $leftfr.lweight -text "Restraint Weight"] -column 0 -row 1 -sticky sw -pady 10 79 80 grid [entry $leftfr.weight -width 8 -textvariable entryvar(distrestweight)] -column 1 -row 1 -sticky sw \ 80 81 -padx 5 -pady 10 81 82 set ::entrycmd(distrestweight) "SoftConst weight" 82 83 set ::entrycmd(trace) 0 … … 95 96 grid [button $editorbox.edit -text "Activate Restraint \n Editor" -command SR_TEST] -column 0 -row 4 \ 96 97 -columnspan 2 -pady 5 97 98 $editorbox.edit config -bg LightGreen -bd 6 98 99 99 100 grid [button $editorbox.search -text "Edit Search Distance \n Parameters" -command DA_Control_Panel] -column 0 -row 3 \ 100 101 -columnspan 2 101 102 $editorbox.edit config -bd 4 102 103 103 104 … … 139 140 SR_Show_RestraintsOnly $main $rightfr 140 141 foreach item [trace vinfo ::sr_entryvar(softphase)] { 141 142 eval trace vdelete ::sr_entryvar(softphase) $item 142 143 } 143 144 … … 148 149 SR_Fill_Display $main 149 150 ResizeScrollTable $rightfr 151 #puts $rightfr 150 152 } 151 153 … … 396 398 label $main.rdistance$i -text [lindex $rprint 8] -justify center -anchor center 397 399 entry $main.restraint$i -width 8 -textvariable ::sr_restraintdist([lindex $rprint 13]) -takefocus 1 398 400 $main.restraint$i selection range 0 end 399 401 bind $main.restraint$i <KeyRelease> {SR_Validate_Soft %W distance} 400 402 entry $main.restesd$i -width 8 -textvariable ::sr_restraintesd([lindex $rprint 13]) -takefocus 1 401 403 $main.restesd$i selection range 0 end 402 404 bind $main.restesd$i <KeyRelease> {SR_Validate_Soft %W esd} 403 405 checkbutton $main.sr_crestraint$i -variable ::sr_crestraint([lindex $rprint 13]) … … 515 517 set sr_write "" 516 518 set new_list "" 517 # set len [llength $::sr_bond_list]519 # set len [llength $::sr_bond_list] 518 520 set ::sr_key_list "" 519 521 foreach temp $::sr_bond_list { 520 puts $temp 521 # for {set i 0} {$i <= [expr $len-1]} {incr i} {} 522 # set temp [lindex $::sr_bond_list $i] 523 524 catch { 525 if {[string trim $::sr_restraintdist([lindex $temp 13])] != ""} { 526 set softrest "[lindex $temp 0] [lindex $temp 1] \ 522 # for {set i 0} {$i <= [expr $len-1]} {incr i} {} 523 # set temp [lindex $::sr_bond_list $i] 524 525 catch { 526 if {[string trim $::sr_restraintdist([lindex $temp 13])] != ""} { 527 set softrest "[lindex $temp 0] [lindex $temp 1] \ 527 528 [lindex $temp 2] [lindex $temp 3] [lindex $temp 4] \ 528 529 [lindex $temp 5] [lindex $temp 6] [lindex $temp 7]\ 529 530 $::sr_restraintdist([lindex $temp 13])\ 530 531 $::sr_restraintesd([lindex $temp 13])" 531 lappend sr_write $softrest 532 puts $softrest 533 lappend new_list $temp 534 } 532 lappend sr_write $softrest 533 lappend new_list $temp 534 } 535 535 } 536 536 } 537 #537 # 538 538 #puts $sr_write 539 539 # put the entire restraint list back into the .EXP file … … 630 630 631 631 entry $srcb1.sr_dminvalue -width 8 -textvariable ::sr_dminvalue -takefocus 1 632 632 $srcb1.sr_dminvalue selection range 0 end 633 633 entry $srcb1.sr_dmaxvalue -width 8 -textvariable ::sr_dmaxvalue -takefocus 1 634 634 $srcb1.sr_dmaxvalue selection range 0 end 635 635 entry $srcb2.sr_rvalue -width 8 -textvariable ::sr_rvalue -takefocus 1 636 636 $srcb2.sr_rvalue selection range 0 end 637 637 entry $srcb2.sr_resd -width 8 -textvariable ::sr_resd -takefocus 1 638 638 $srcb2.sr_resd selection range 0 end 639 639 640 640 bind $srcb1.sr_dminvalue <KeyRelease> {SR_Validate_Soft %W dmin} … … 644 644 645 645 button $srcb1.recalc -text "Filter" -bd 6 -command {SR_Display} 646 button $srcb2.rbutton1 -text "check update" -command {SR_Update_Restraints} 647 button $srcb2.rbutton2 -text "check delete" -command {SR_Delete_Restraints} 648 button $::srcb3.rbutton3 -text "Save Restraints to EXP File" -bd 6 -bg LightGreen -command {SR_Write_Restraints} 649 button $::srcb3.rbutton4 -text "Cancel" -command {destroy .mainrestraintbox 646 button $srcb2.rbutton1 -text "Set checked" -command {SR_Update_Restraints} 647 button $srcb2.rbutton2 -text "Delete checked" -command {SR_Delete_Restraints} 648 button $::srcb3.rbutton3 -text "Save changes" -bd 6 -bg LightGreen -command {SR_Write_Restraints} 649 button $::srcb3.rbutton4 -text "Cancel" -command { 650 destroy .mainrestraintbox 650 651 afterputontop 651 652 SR_Rest_Only 652 DisplayDistanceRestraints} 653 wm protocol .mainrestraintbox WM_DELETE_WINDOW {destroy .mainrestraintbox 653 DisplayDistanceRestraints 654 } 655 wm protocol .mainrestraintbox WM_DELETE_WINDOW { 656 destroy .mainrestraintbox 654 657 afterputontop 655 658 SR_Rest_Only 656 DisplayDistanceRestraints} 659 DisplayDistanceRestraints 660 } 657 661 658 662 grid $srcb1.atomlabel1 -column 1 -row 0 … … 725 729 set ::sr_distance_button 1 726 730 set ::sr_entryvar(choicenum) 0 727 # set ::sr_entryvar(softphase) "1"728 # set ::sr_phaselist $::expmap(phaselist)731 # set ::sr_entryvar(softphase) "1" 732 # set ::sr_phaselist $::expmap(phaselist) 729 733 set ::sr_entryvar(softatom1) "all" 730 734 set ::sr_entryvar(softatom2) "all" -
branches/sandbox/widplt
r1029 r1030 11 11 package require Tk 12 12 bind all <Control-KeyPress-c> {destroy .} 13 13 14 set expnam [lindex $argv 0] 14 15 if {$expnam != ""} { … … 442 443 global UVWP XY wave lblarr WidSetList WidDisplay ttrange 443 444 global ABS absSetList AbsDisplay 445 if {$program == "absplt"} { 446 $top yaxis config -title {Abs. Corr.} 447 } else { 448 $top yaxis config -title {FWHM} 449 } 444 450 if {$graph(plotunits) == "d"} { 445 451 $top xaxis configure -title "d (A)" 452 } elseif {$graph(plotunits) == "deltad"} { 453 $top xaxis configure -title "d (A)" 454 $top yaxis configure -title "delta-d/d" 446 455 } elseif {$graph(plotunits) == "q"} { 447 456 $top xaxis configure -title "Q (A-1)" … … 450 459 } else { 451 460 $top xaxis configure -title "2Theta @ $graph(equivwave)" 452 }453 if {$program == "absplt"} {454 $top yaxis config -title {Abs. Corr.}455 } else {456 $top yaxis config -title {FWHM}457 461 } 458 462 $top yaxis configure -min 0 … … 492 496 if {$graph(plotunits) == "d"} { 493 497 set ttlist [tod $ttlist $item] 498 } elseif {$graph(plotunits) == "deltad"} { 499 set ttlist [tod $ttlist $item] 494 500 } elseif {$graph(plotunits) == "q"} { 495 501 set ttlist [toQ $ttlist $item] … … 530 536 [eval LFWHM $tt $XY($item)]] 531 537 lappend lfwhmlist $lfwhm 538 } 539 } elseif {$graph(plotunits) == "deltad"} { 540 set d [tt2d $wave($item) $tt ] 541 lappend ttlist $d 542 set gfwhm [deltad $wave($item) $tt \ 543 [eval FWHM $tt $UVWP($item)]] 544 lappend fwhmlist [expr {$gfwhm/$d}] 545 if $lflag { 546 set lfwhm [deltad $wave($item) $tt \ 547 [eval LFWHM $tt $XY($item)]] 548 lappend lfwhmlist [expr {$lfwhm/$d}] 532 549 } 533 550 } elseif {$graph(plotunits) == "q"} { … … 982 999 } 983 1000 1001 proc BLTmanualZoom {} { 1002 global graph box 1003 catch {toplevel .zoom} 1004 eval destroy [grid slaves .zoom] 1005 raise .zoom 1006 wm title .zoom {Manual Scaling} 1007 grid [label .zoom.l1 -text minimum] -row 1 -column 2 1008 grid [label .zoom.l2 -text maximum] -row 1 -column 3 1009 grid [label .zoom.l3 -text x] -row 2 -column 1 1010 grid [label .zoom.l4 -text y] -row 3 -column 1 1011 grid [entry .zoom.xmin -textvariable graph(xmin) -width 10] -row 2 -column 2 1012 grid [entry .zoom.xmax -textvariable graph(xmax) -width 10] -row 2 -column 3 1013 grid [entry .zoom.ymin -textvariable graph(ymin) -width 10] -row 3 -column 2 1014 grid [entry .zoom.ymax -textvariable graph(ymax) -width 10] -row 3 -column 3 1015 grid [frame .zoom.b] -row 4 -column 1 -columnspan 3 1016 grid [button .zoom.b.1 -text "Set Scaling" \ 1017 -command "SetManualZoom set"] -row 4 -column 1 -columnspan 2 1018 grid [button .zoom.b.2 -text Reset \ 1019 -command "SetManualZoom clear"] -row 4 -column 3 1020 grid [button .zoom.b.3 -text Close -command "destroy .zoom"] -row 4 -column 4 1021 grid rowconfigure .zoom 1 -weight 1 -pad 5 1022 grid rowconfigure .zoom 2 -weight 1 -pad 5 1023 grid rowconfigure .zoom 3 -weight 1 -pad 5 1024 grid rowconfigure .zoom 4 -weight 0 -pad 5 1025 grid columnconfigure .zoom 1 -weight 1 -pad 20 1026 grid columnconfigure .zoom 1 -weight 1 1027 grid columnconfigure .zoom 3 -weight 1 -pad 10 1028 foreach item {min min max max} \ 1029 format {3 2 3 2} \ 1030 axis {x y x y} { 1031 set val [$box ${axis}axis cget -${item}] 1032 set graph(${axis}${item}) {(auto)} 1033 catch {set graph(${axis}${item}) [format %.${format}f $val]} 1034 } 1035 bind .zoom <Return> "SetManualZoom set" 1036 } 1037 1038 proc SetManualZoom {mode} { 1039 global graph box 1040 if {$mode == "clear"} { 1041 foreach item {xmin ymin xmax ymax} { 1042 set graph($item) {(auto)} 1043 } 1044 } 1045 foreach item {xmin ymin xmax ymax} { 1046 if {[catch {expr $graph($item)}]} { 1047 set $item "" 1048 } else { 1049 set $item $graph($item) 1050 } 1051 } 1052 # reset the zoomstack 1053 catch {Blt_ZoomStack $box} 1054 catch {$box xaxis config -min $xmin -max $xmax} 1055 catch {$box yaxis config -min $ymin -max $ymax} 1056 #global program 1057 #if {$program == "bkgedit"} {bkgEditMode ""} 1058 } 1059 984 1060 #------------------------------------------------------------------------- 985 1061 # export current plot to Grace … … 1242 1318 -variable graph(plotunits) \ 1243 1319 -command "plotdata $box" 1320 .a.options.menu add radiobutton -label "delta-d/d" -value deltad \ 1321 -variable graph(plotunits) \ 1322 -command "plotdata $box" 1244 1323 .a.options.menu add checkbutton -label "Include legend" \ 1245 1324 -variable graph(legend) \ … … 1274 1353 #---------------------------------------------------------------- 1275 1354 1276 trace variable newmenu(opt) w setoptmsg 1355 trace variable newmenu(opt) w setoptmsg 1356 1357 bind . <Key-z> {BLTmanualZoom} 1358 bind . <Key-Z> {BLTmanualZoom} 1277 1359 1278 1360 proc setoptmsg {args} {
Note: See TracChangeset
for help on using the changeset viewer.