Changeset 8 for trunk/gui/scripts
- Timestamp:
- Apr 2, 2005, 9:33:16 AM (20 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/analyzer.tcl
r6 r8 125 125 # 126 126 # If the simulation page is showing, this kicks off the simulator 127 # by executing the executable.command associated with the -tool. While127 # by executing the tool.command associated with the -tool. While 128 128 # the simulation is running, it shows status. When the simulation is 129 129 # finished, it switches automatically to "analyze" mode and shows … … 137 137 138 138 set job(control) "" 139 set job(error) "" 139 140 140 141 # if the hold window is set, then put up a busy cursor … … 152 153 set xml2 [$itk_option(-device) xml] 153 154 regsub -all {&} $xml2 {\\\&} xml2 154 regsub {</ tool>} $xml "$xml2</tool>" xml155 regsub {</run>} $xml "$xml2</run>" xml 155 156 puts $fid $xml 156 157 close $fid … … 159 160 # execute the tool using the path from the tool description 160 161 if {$status == 0} { 161 set cmd [$itk_option(-tool) get executable.command]162 set cmd [$itk_option(-tool) get tool.command] 162 163 163 164 set status [catch {eval blt::bgexec \ … … 211 212 212 213 # if control mode is "auto", then simulate right away 213 if { $_control == "auto"} {214 if {[string match auto* $_control]} { 214 215 simulate 215 216 } … … 231 232 232 233 # try to load new results from the given file 233 set _run [Rappture:: Library::open$file]234 set _run [Rappture::library $file] 234 235 235 236 # go through the analysis and create widgets to display results 236 237 foreach item [array names _widgets] { 237 $_widgets($item) configure - run$_run238 $_widgets($item) configure -output $_run 238 239 } 239 240 } … … 254 255 # CONFIGURATION OPTION: -tool 255 256 # 256 # Set to the Rappture:: Library object representing the tool being257 # Set to the Rappture::library object representing the tool being 257 258 # run in this analyzer. 258 259 # ---------------------------------------------------------------------- 259 260 itcl::configbody Rappture::Analyzer::tool { 260 261 if {![Rappture::library isvalid $itk_option(-tool)]} { 261 error "bad value \"$itk_option(-tool)\": should be Rappture:: Library"262 error "bad value \"$itk_option(-tool)\": should be Rappture::library" 262 263 } 263 264 … … 271 272 # CONFIGURATION OPTION: -device 272 273 # 273 # Set to the Rappture:: Library object representing the device being274 # Set to the Rappture::library object representing the device being 274 275 # run in this analyzer. 275 276 # ---------------------------------------------------------------------- … … 277 278 if {$itk_option(-device) != "" 278 279 && ![Rappture::library isvalid $itk_option(-device)]} { 279 error "bad value \"$itk_option(-device)\": should be Rappture:: Library"280 error "bad value \"$itk_option(-device)\": should be Rappture::library" 280 281 } 281 282 reset … … 285 286 # CONFIGURATION OPTION: -analysis 286 287 # 287 # Set to the Rappture:: Library object representing the analysis that288 # Set to the Rappture::library object representing the analysis that 288 289 # should be shown in this analyzer. 289 290 # ---------------------------------------------------------------------- 290 291 itcl::configbody Rappture::Analyzer::analysis { 291 292 if {![Rappture::library isvalid $itk_option(-analysis)]} { 292 error "bad value \"$itk_option(-analysis)\": should be Rappture:: Library"293 error "bad value \"$itk_option(-analysis)\": should be Rappture::library" 293 294 } 294 295 set _control [$itk_option(-analysis) get control] … … 314 315 pack $_widgets($item) -expand yes -fill both 315 316 } 317 elevels* { 318 set name "page[incr counter]" 319 320 set page [$itk_component(results) insert end $name] 321 $itk_component(resultselector) choices insert end \ 322 $name "Energy Levels" 323 324 set _widgets($item) [Rappture::EnergyLevels $page.#auto \ 325 -layout [$itk_option(-analysis) element -flavor object $item]] 326 pack $_widgets($item) -expand yes -fill both 327 } 316 328 } 317 329 } -
trunk/gui/scripts/energyLevels.tcl
r7 r8 16 16 option add *EnergyLevels.width 4i widgetDefault 17 17 option add *EnergyLevels.height 4i widgetDefault 18 option add *EnergyLevels.levelColor blue widgetDefault 19 option add *EnergyLevels.levelTextForeground blue widgetDefault 20 option add *EnergyLevels.levelTextBackground #d9d9d9 widgetDefault 21 22 option add *EnergyLevels.font \ 23 -*-helvetica-medium-r-normal-*-*-120-* widgetDefault 24 25 option add *EnergyLevels.detailFont \ 26 -*-helvetica-medium-r-normal-*-*-100-* widgetDefault 18 27 19 28 itcl::class Rappture::EnergyLevels { 20 29 inherit itk::Widget 21 30 31 itk_option define -layout layout Layout "" 32 itk_option define -output output Output "" 33 itk_option define -levelcolor levelColor LevelColor "" 34 itk_option define -leveltextforeground levelTextForeground Foreground "" 35 itk_option define -leveltextbackground levelTextBackground Background "" 36 22 37 constructor {args} { # defined below } 23 38 destructor { # defined below } 24 39 25 method load {libobj} 26 } 27 40 protected method _render {} 41 protected method _adjust {what val} 42 protected method _getColumn {name} 43 protected method _getUnits {name} 44 protected method _getMidPt {elist pos} 45 } 46 28 47 itk::usual EnergyLevels { 29 48 } … … 36 55 pack propagate $itk_component(hull) no 37 56 57 # 58 # Add label for the title. 59 # 60 itk_component add title { 61 label $itk_interior.title 62 } 63 pack $itk_component(title) -side top 64 65 # 66 # Add labels showing level stats at bottom. 67 # 68 itk_component add stats { 69 frame $itk_interior.stats 70 } 71 pack $itk_component(stats) -side bottom -fill x 72 73 itk_component add numvall { 74 label $itk_component(stats).numvall -text "Number of valence electrons:" 75 } 76 grid $itk_component(numvall) -row 0 -column 0 -sticky e 77 78 itk_component add numvalv { 79 label $itk_component(stats).numvalv 80 } 81 grid $itk_component(numvalv) -row 0 -column 1 -sticky w 82 83 itk_component add numbasl { 84 label $itk_component(stats).numbasl -text "Number of basis functions:" 85 } 86 grid $itk_component(numbasl) -row 1 -column 0 -sticky e 87 88 itk_component add numbasv { 89 label $itk_component(stats).numbasv 90 } 91 grid $itk_component(numbasv) -row 1 -column 1 -sticky w 92 93 94 itk_component add cntls { 95 frame $itk_interior.cntls 96 } 97 pack $itk_component(cntls) -side right -fill y 98 grid rowconfigure $itk_component(cntls) 0 -weight 1 99 grid rowconfigure $itk_component(cntls) 1 -minsize 10 100 grid rowconfigure $itk_component(cntls) 2 -weight 1 101 102 # 103 # Add MORE/FEWER levels control for TOP of graph 104 # 105 itk_component add upperE { 106 frame $itk_component(cntls).upperE 107 } 108 109 itk_component add upperEmore { 110 label $itk_component(upperE).morel -text "More" 111 } { 112 usual 113 rename -font -detailfont detailFont Font 114 } 115 pack $itk_component(upperEmore) -side top 116 117 itk_component add upperEfewer { 118 label $itk_component(upperE).fewerl -text "Fewer" 119 } { 120 usual 121 rename -font -detailfont detailFont Font 122 } 123 pack $itk_component(upperEfewer) -side bottom 124 125 itk_component add upperEcntl { 126 scale $itk_component(upperE).cntl -orient vertical -showvalue 0 \ 127 -command [itcl::code $this _adjust upper] 128 } 129 pack $itk_component(upperEcntl) -side top -fill y 130 131 # 132 # Add MORE/FEWER levels control for BOTTOM of graph 133 # 134 itk_component add lowerE { 135 frame $itk_component(cntls).lowerE 136 } 137 138 itk_component add lowerEmore { 139 label $itk_component(lowerE).morel -text "More" 140 } { 141 usual 142 rename -font -detailfont detailFont Font 143 } 144 pack $itk_component(lowerEmore) -side bottom 145 146 itk_component add lowerEfewer { 147 label $itk_component(lowerE).fewerl -text "Fewer" 148 } { 149 usual 150 rename -font -detailfont detailFont Font 151 } 152 pack $itk_component(lowerEfewer) -side top 153 154 itk_component add lowerEcntl { 155 scale $itk_component(lowerE).cntl -orient vertical -showvalue 0 \ 156 -command [itcl::code $this _adjust lower] 157 } 158 pack $itk_component(lowerEcntl) -side top -fill y 159 160 # 161 # Add graph showing levels 162 # 38 163 itk_component add graph { 39 164 blt::graph $itk_interior.graph \ … … 56 181 57 182 # ---------------------------------------------------------------------- 58 # USAGE: load <libObj>183 # USAGE: _render 59 184 # 60 # Clients use this to load a list of energy levels from the specified 61 # XML libObj, which should be a <table>. One column in the table 62 # should have "labels" and the other "energies". 63 # ---------------------------------------------------------------------- 64 itcl::body Rappture::EnergyLevels::load {libobj} { 65 set clist [$libobj children] 66 set ilabel [lsearch $clist [$libobj element column(labels)]] 67 if {$ilabel < 0} { 68 error "can't find column(labels) in energy table data" 69 } 70 set ienergy [lsearch $clist [$libobj element column(energies)]] 71 if {$ienergy < 0} { 72 error "can't find column(energies) in energy table data" 73 } 74 75 set units [$libobj get column(energies).units] 76 if {$units == ""} { 77 set units "eV" 78 } 79 80 # 81 # Update the graph to show the current set of levels. 185 # Used internally to load a list of energy levels from a <table> within 186 # the -output XML object. The -layout object indicates how information 187 # should be extracted from the table. The <layout> should have an 188 # <energies> tag and perhaps a <labels> tag, which indicates the table 189 # and the column within the table containing the energies. 190 # ---------------------------------------------------------------------- 191 itcl::body Rappture::EnergyLevels::_render {} { 192 # 193 # Clear any information shown in the graph. 82 194 # 83 195 set graph $itk_component(graph) … … 85 197 eval $graph marker delete [$graph marker names] 86 198 199 # 200 # Plug in the title from the layout 201 # 202 set title "" 203 if {$itk_option(-layout) != ""} { 204 set title [$itk_option(-layout) get label] 205 } 206 if {"" != $title} { 207 pack $itk_component(title) -side top -before $itk_component(stats) 208 $itk_component(title) configure -text $title 209 } else { 210 pack forget $itk_component(title) 211 } 212 213 # 214 # Look through the layout and figure out what to extract 215 # from the table. 216 # 217 set elist [_getColumn energies] 218 if {[llength $elist] == 0} { 219 return 220 } 221 set units [_getUnits energies] 222 223 set llist [_getColumn names] 224 if {[llength $llist] == 0} { 225 # no labels? then invent some 226 set i 0 227 foreach name $elist { 228 lappend llist "E$i" 229 incr i 230 } 231 } 232 233 # 234 # Update the graph to show the current set of levels. 235 # 87 236 set n 0 237 set nlumo 0 88 238 set emax "" 89 239 set emin "" 90 240 set ehomo "" 91 241 set elumo "" 92 foreach line [split [$libobj get data] "\n"] { 93 set lval [lindex $line $ilabel] 94 set eval [lindex $line $ienergy] 95 if {$lval == "" || $eval == ""} { 96 continue 97 } 98 99 set eval [Rappture::Units::convert $eval \ 100 -context $units -to $units -units off] 101 242 foreach eval $elist lval $llist { 102 243 if {$lval == "HOMO"} { 103 244 set ehomo $eval 104 } elseif {$lval == "LUMO"} { 245 set lval "HOMO = $eval $units" 246 set nlumo [expr {$n+1}] 247 } elseif {$lval == "LUMO" || $n == $nlumo} { 105 248 set elumo $eval 249 set lval "LUMO = $eval $units" 106 250 } 107 251 108 252 set elem "elem[incr n]" 109 253 $graph element create $elem \ 110 -xdata {0 0.8} -ydata [list $eval $eval] \ 111 -color blue -symbol "" -linewidth 2 112 113 $graph marker create text -coords [list 0.8 $eval] \ 114 -text $lval -anchor w -background "" 254 -xdata {0 1} -ydata [list $eval $eval] \ 255 -color $itk_option(-levelcolor) -symbol "" -linewidth 2 256 257 $graph marker create text -coords [list 0.5 $eval] \ 258 -text $lval -anchor c \ 259 -foreground $itk_option(-leveltextforeground) \ 260 -background $itk_option(-leveltextbackground) 115 261 116 262 if {$emax == ""} { … … 123 269 } 124 270 $graph xaxis configure -min 0 -max 1 -showticks off -linewidth 0 125 $graph yaxis configure -title "Energy ($units)" 271 if {$units != ""} { 272 $graph yaxis configure -title "Energy ($units)" 273 } else { 274 $graph yaxis configure -title "Energy" 275 } 126 276 127 277 # bump the limits so they are big enough to show labels 128 278 set fnt $itk_option(-font) 129 279 set h [expr {0.5*([font metrics $fnt -linespace] + 5)}] 130 set emin [expr {$emin- $h/150.0}]131 set emax [expr {$emax+ $h/150.0}]280 set emin [expr {$emin-($emax-$emin)*$h/150.0}] 281 set emax [expr {$emax+($emax-$emin)*$h/150.0}] 132 282 $graph yaxis configure -min $emin -max $emax 133 283 284 # fill in the stats at the bottom 285 $itk_component(numvalv) configure -text $nlumo 286 $itk_component(numbasv) configure -text $n 287 134 288 # 135 289 # If we found HOMO/LUMO levels, then add the band gap at 136 # that point. 290 # that point. Also, fix the controls for energy range. 137 291 # 138 292 if {$ehomo != "" && $elumo != ""} { 139 $graph marker create line \ 140 -coords [list 0.2 $elumo 0.2 $ehomo] 141 142 set egap [expr {$ehomo-$elumo}] 293 set id [$graph marker create line \ 294 -coords [list 0.2 $elumo 0.2 $ehomo]] 295 $graph marker after $id 296 297 set egap [expr {$elumo-$ehomo}] 143 298 set emid [expr {0.5*($ehomo+$elumo)}] 144 299 $graph marker create text \ 145 300 -coords [list 0.21 $emid] -background "" \ 146 301 -text "Eg = [format %.2g $egap] $units" -anchor w 147 } 148 } 149 150 package require Rappture 151 Rappture::EnergyLevels .e 152 pack .e -expand yes -fill both 153 154 set lib [Rappture::library {<?xml version="1.0"?> 155 <table> 156 <column id="labels">Name</column> 157 <column id="energies">Energy</column> 158 <data> 159 E0 0.1 160 E1 0.2 161 LUMO 0.4 162 HOMO 0.9 163 E4 1.5 164 E5 2.8 165 </data> 166 </table>}] 167 168 .e load $lib 302 303 # fix the limits for the lower scale 304 set elim [_getMidPt $elist [expr {$nlumo-1}]] 305 if {"" != $elim} { 306 $itk_component(lowerEcntl) configure -from $elim -to $emin \ 307 -resolution [expr {0.02*($elim-$emin)}] 308 grid $itk_component(lowerE) -row 2 -column 0 -sticky ns 309 310 set e0 [_getMidPt $elist [expr {$nlumo-3}]] 311 if {"" != $e0} { 312 $itk_component(lowerEcntl) set $e0 313 } else { 314 $itk_component(lowerEcntl) set $elim 315 } 316 } else { 317 grid forget $itk_component(lowerE) 318 } 319 320 # fix the limits for the upper scale 321 set elim [_getMidPt $elist [expr {$nlumo+1}]] 322 if {"" != $elim} { 323 $itk_component(upperEcntl) configure -from $emax -to $elim \ 324 -resolution [expr {0.02*($emax-$elim)}] 325 grid $itk_component(upperE) -row 0 -column 0 -sticky ns 326 327 set e0 [_getMidPt $elist [expr {$nlumo+3}]] 328 if {"" != $e0} { 329 $itk_component(upperEcntl) set $e0 330 } else { 331 $itk_component(upperEcntl) set $elim 332 } 333 } else { 334 grid forget $itk_component(upperE) 335 } 336 } else { 337 grid forget $itk_component(upperE) 338 grid forget $itk_component(lowerE) 339 } 340 } 341 342 # ---------------------------------------------------------------------- 343 # USAGE: _adjust <what> <val> 344 # 345 # Used internally to adjust the upper/lower limits of the graph 346 # as the user drags the slider from "More" to "Fewer". Sets 347 # the specified limit to the given value. 348 # ---------------------------------------------------------------------- 349 itcl::body Rappture::EnergyLevels::_adjust {what val} { 350 switch -- $what { 351 upper { 352 $itk_component(graph) yaxis configure -max $val 353 } 354 lower { 355 $itk_component(graph) yaxis configure -min $val 356 } 357 default { 358 error "bad limit \"$what\": should be upper or lower" 359 } 360 } 361 } 362 363 # ---------------------------------------------------------------------- 364 # USAGE: _getColumn <name> 365 # 366 # Used internally to load a list of energy levels from a <table> within 367 # the -output XML object. The -layout object indicates how information 368 # should be extracted from the table. The <layout> should have an 369 # <energies> tag and perhaps a <labels> tag, which indicates the table 370 # and the column within the table containing the energies. 371 # ---------------------------------------------------------------------- 372 itcl::body Rappture::EnergyLevels::_getColumn {name} { 373 if {$itk_option(-layout) == "" || $itk_option(-output) == ""} { 374 return 375 } 376 377 # 378 # Figure out which column in which table contains the data. 379 # Then, find that table and extract the column. Figure out 380 # the position of the column from the list of all column names. 381 # 382 set table [$itk_option(-layout) get $name.table] 383 set col [$itk_option(-layout) get $name.column] 384 385 set clist "" 386 foreach c [$itk_option(-output) children -type column $table] { 387 lappend clist [$itk_option(-output) get $table.$c.label] 388 } 389 set ipos [lsearch $clist $col] 390 if {$ipos < 0} { 391 return ;# can't find data -- bail out! 392 } 393 394 set units [$itk_option(-output) get $table.column$ipos.units] 395 396 set rlist "" 397 foreach line [split [$itk_option(-output) get $table.data] "\n"] { 398 if {"" != [string trim $line]} { 399 set val [lindex $line $ipos] 400 401 if {$units != ""} { 402 set val [Rappture::Units::convert $val \ 403 -context $units -to $units -units off] 404 } 405 lappend rlist $val 406 } 407 } 408 return $rlist 409 } 410 411 # ---------------------------------------------------------------------- 412 # USAGE: _getUnits <name> 413 # 414 # Used internally to extract the units from a <table> within the 415 # -output XML object. The -layout object indicates how information 416 # should be extracted from the table. The <layout> should have an 417 # <energies> tag and perhaps a <labels> tag, which indicates the table 418 # and the column within the table containing the units. 419 # ---------------------------------------------------------------------- 420 itcl::body Rappture::EnergyLevels::_getUnits {name} { 421 if {$itk_option(-layout) == "" || $itk_option(-output) == ""} { 422 return 423 } 424 425 # 426 # Figure out which column in which table contains the data. 427 # Then, find that table and extract the column. Figure out 428 # the position of the column from the list of all column names. 429 # 430 set table [$itk_option(-layout) get $name.table] 431 set col [$itk_option(-layout) get $name.column] 432 433 set clist "" 434 foreach c [$itk_option(-output) children -type column $table] { 435 lappend clist [$itk_option(-output) get $table.$c.label] 436 } 437 set ipos [lsearch $clist $col] 438 if {$ipos < 0} { 439 return ;# can't find data -- bail out! 440 } 441 442 return [$itk_option(-output) get $table.column$ipos.units] 443 } 444 445 # ---------------------------------------------------------------------- 446 # USAGE: _getMidPt <elist> <pos> 447 # 448 # Used internally to compute the midpoint between two energy levels 449 # at <pos> and <pos-1> in the <elist>. Returns a number representing 450 # the mid-point (average value) or "" if the levels involved do 451 # no exist in <elist>. 452 # ---------------------------------------------------------------------- 453 itcl::body Rappture::EnergyLevels::_getMidPt {elist pos} { 454 if {$pos < [llength $elist] && $pos > 1} { 455 set e1 [lindex $elist $pos] 456 set e0 [lindex $elist [expr {$pos-1}]] 457 return [expr {0.5*($e0+$e1)}] 458 } 459 return "" 460 } 461 462 # ---------------------------------------------------------------------- 463 # OPTION: -layout 464 # ---------------------------------------------------------------------- 465 itcl::configbody Rappture::EnergyLevels::layout { 466 if {$itk_option(-layout) != "" 467 && ![Rappture::library isvalid $itk_option(-layout)]} { 468 error "bad value \"$itk_option(-layout)\": should be Rappture::library object" 469 } 470 after idle [itcl::code $this _render] 471 } 472 473 # ---------------------------------------------------------------------- 474 # OPTION: -output 475 # ---------------------------------------------------------------------- 476 itcl::configbody Rappture::EnergyLevels::output { 477 if {$itk_option(-output) != "" 478 && ![Rappture::library isvalid $itk_option(-output)]} { 479 error "bad value \"$itk_option(-output)\": should be Rappture::library object" 480 } 481 after cancel [itcl::code $this _render] 482 after idle [itcl::code $this _render] 483 } 484 485 # ---------------------------------------------------------------------- 486 # OPTION: -levelColor 487 # ---------------------------------------------------------------------- 488 itcl::configbody Rappture::EnergyLevels::levelcolor { 489 after cancel [itcl::code $this _render] 490 after idle [itcl::code $this _render] 491 } 492 493 # ---------------------------------------------------------------------- 494 # OPTION: -leveltextforeground 495 # ---------------------------------------------------------------------- 496 itcl::configbody Rappture::EnergyLevels::leveltextforeground { 497 after cancel [itcl::code $this _render] 498 after idle [itcl::code $this _render] 499 } 500 501 # ---------------------------------------------------------------------- 502 # OPTION: -leveltextbackground 503 # ---------------------------------------------------------------------- 504 itcl::configbody Rappture::EnergyLevels::leveltextbackground { 505 after cancel [itcl::code $this _render] 506 after idle [itcl::code $this _render] 507 } -
trunk/gui/scripts/moleculeViewer.tcl
r7 r8 164 164 } 165 165 166 package require Rappture167 Rappture::MoleculeViewer .e -library [Rappture::library -std library.xml]168 pack .e -expand yes -fill both169 170 set dev [Rappture::library {<?xml version="1.0"?>171 <structure>172 <components>173 <molecule id="Aspirin">174 <formula>???</formula>175 <info>Aspirin molecule</info>176 <atom id="1">177 <symbol>C</symbol>178 <xyz>-1.892 -0.992 -1.578</xyz>179 </atom>180 <atom id="2">181 <symbol>C</symbol>182 <xyz>-1.370 -2.149 -0.990</xyz>183 </atom>184 <atom id="3">185 <symbol>C</symbol>186 <xyz>-0.079 -2.146 -0.464</xyz>187 </atom>188 <atom id="4">189 <symbol>C</symbol>190 <xyz>0.708 -0.986 -0.521</xyz>191 </atom>192 <atom id="5">193 <symbol>C</symbol>194 <xyz>0.203 0.156 -1.196</xyz>195 </atom>196 <atom id="6">197 <symbol>C</symbol>198 <xyz>-1.108 0.161 -1.654</xyz>199 </atom>200 <atom id="7">201 <symbol>C</symbol>202 <xyz>2.085 -1.030 0.104</xyz>203 </atom>204 <atom id="8">205 <symbol>O</symbol>206 <xyz>2.533 -2.034 0.636</xyz>207 </atom>208 <atom id="9">209 <symbol>O</symbol>210 <xyz>2.879 0.025 0.112</xyz>211 </atom>212 <atom id="10">213 <symbol>O</symbol>214 <xyz>0.753 1.334 -1.084</xyz>215 </atom>216 <atom id="11">217 <symbol>C</symbol>218 <xyz>0.668 2.025 0.034</xyz>219 </atom>220 <atom id="12">221 <symbol>O</symbol>222 <xyz>1.300 3.063 0.152</xyz>223 </atom>224 <atom id="13">225 <symbol>C</symbol>226 <xyz>-0.243 1.577 1.144</xyz>227 </atom>228 <atom id="14">229 <symbol>H</symbol>230 <xyz>-2.879 -0.962 -1.985</xyz>231 </atom>232 <atom id="15">233 <symbol>H</symbol>234 <xyz>-1.988 -3.037 -0.955</xyz>235 </atom>236 <atom id="16">237 <symbol>H</symbol>238 <xyz>0.300 -3.063 -0.005</xyz>239 </atom>240 <atom id="17">241 <symbol>H</symbol>242 <xyz>-1.489 1.084 -2.059</xyz>243 </atom>244 <atom id="18">245 <symbol>H</symbol>246 <xyz>2.566 0.782 -0.326</xyz>247 </atom>248 <atom id="19">249 <symbol>H</symbol>250 <xyz>-0.761 0.636 0.933</xyz>251 </atom>252 <atom id="20">253 <symbol>H</symbol>254 <xyz>-1.009 2.349 1.290</xyz>255 </atom>256 <atom id="21">257 <symbol>H</symbol>258 <xyz>0.346 1.435 2.059</xyz>259 </atom>260 </molecule>261 </components>262 </structure>}]166 #package require Rappture 167 #Rappture::MoleculeViewer .e -library [Rappture::library -std library.xml] 168 #pack .e -expand yes -fill both 169 # 170 #set dev [Rappture::library {<?xml version="1.0"?> 171 #<structure> 172 #<components> 173 #<molecule id="Aspirin"> 174 # <formula>???</formula> 175 # <info>Aspirin molecule</info> 176 # <atom id="1"> 177 # <symbol>C</symbol> 178 # <xyz>-1.892 -0.992 -1.578</xyz> 179 # </atom> 180 # <atom id="2"> 181 # <symbol>C</symbol> 182 # <xyz>-1.370 -2.149 -0.990</xyz> 183 # </atom> 184 # <atom id="3"> 185 # <symbol>C</symbol> 186 # <xyz>-0.079 -2.146 -0.464</xyz> 187 # </atom> 188 # <atom id="4"> 189 # <symbol>C</symbol> 190 # <xyz>0.708 -0.986 -0.521</xyz> 191 # </atom> 192 # <atom id="5"> 193 # <symbol>C</symbol> 194 # <xyz>0.203 0.156 -1.196</xyz> 195 # </atom> 196 # <atom id="6"> 197 # <symbol>C</symbol> 198 # <xyz>-1.108 0.161 -1.654</xyz> 199 # </atom> 200 # <atom id="7"> 201 # <symbol>C</symbol> 202 # <xyz>2.085 -1.030 0.104</xyz> 203 # </atom> 204 # <atom id="8"> 205 # <symbol>O</symbol> 206 # <xyz>2.533 -2.034 0.636</xyz> 207 # </atom> 208 # <atom id="9"> 209 # <symbol>O</symbol> 210 # <xyz>2.879 0.025 0.112</xyz> 211 # </atom> 212 # <atom id="10"> 213 # <symbol>O</symbol> 214 # <xyz>0.753 1.334 -1.084</xyz> 215 # </atom> 216 # <atom id="11"> 217 # <symbol>C</symbol> 218 # <xyz>0.668 2.025 0.034</xyz> 219 # </atom> 220 # <atom id="12"> 221 # <symbol>O</symbol> 222 # <xyz>1.300 3.063 0.152</xyz> 223 # </atom> 224 # <atom id="13"> 225 # <symbol>C</symbol> 226 # <xyz>-0.243 1.577 1.144</xyz> 227 # </atom> 228 # <atom id="14"> 229 # <symbol>H</symbol> 230 # <xyz>-2.879 -0.962 -1.985</xyz> 231 # </atom> 232 # <atom id="15"> 233 # <symbol>H</symbol> 234 # <xyz>-1.988 -3.037 -0.955</xyz> 235 # </atom> 236 # <atom id="16"> 237 # <symbol>H</symbol> 238 # <xyz>0.300 -3.063 -0.005</xyz> 239 # </atom> 240 # <atom id="17"> 241 # <symbol>H</symbol> 242 # <xyz>-1.489 1.084 -2.059</xyz> 243 # </atom> 244 # <atom id="18"> 245 # <symbol>H</symbol> 246 # <xyz>2.566 0.782 -0.326</xyz> 247 # </atom> 248 # <atom id="19"> 249 # <symbol>H</symbol> 250 # <xyz>-0.761 0.636 0.933</xyz> 251 # </atom> 252 # <atom id="20"> 253 # <symbol>H</symbol> 254 # <xyz>-1.009 2.349 1.290</xyz> 255 # </atom> 256 # <atom id="21"> 257 # <symbol>H</symbol> 258 # <xyz>0.346 1.435 2.059</xyz> 259 # </atom> 260 #</molecule> 261 #</components> 262 #</structure>}] 263 263 # add connectivity at some point... 264 264 #CONECT 1 2 6 14 … … 284 284 #CONECT 21 13 285 285 286 .e configure -device $dev286 #.e configure -device $dev -
trunk/gui/scripts/xyplot.tcl
r6 r8 4 4 # This widget is an X/Y plot, meant to view line graphs produced 5 5 # as output from the run of a Rappture tool. It takes a -layout 6 # object describing what should be plotted, and a -runobject6 # object describing what should be plotted, and an -output object 7 7 # containing the data. This widget puts it all together, and lets 8 8 # the user explore the results. … … 23 23 24 24 itk_option define -layout layout Layout "" 25 itk_option define - run run Run""25 itk_option define -output output Output "" 26 26 27 27 constructor {args} { # defined below } … … 30 30 protected method _rebuild {} 31 31 32 private variable _device "" ;# device contained in - run32 private variable _device "" ;# device contained in -output 33 33 private variable _path2obj ;# maps field/curve name => object 34 34 } … … 82 82 set g $itk_component(plot) 83 83 set layout $itk_option(-layout) 84 set run $itk_option(- run)84 set run $itk_option(-output) 85 85 86 86 # first clear out the widget … … 220 220 221 221 # ---------------------------------------------------------------------- 222 # CONFIGURATION OPTION: - run222 # CONFIGURATION OPTION: -output 223 223 # 224 224 # Set to the Rappture::Library object representing the data being … … 230 230 set _device "" 231 231 } 232 if {$itk_option(- run) != ""} {233 if {![Rappture::library isvalid $itk_option(- run)]} {234 error "bad value \"$itk_option(- run)\": should be Rappture::Library"235 } 236 set _device [$itk_option(- run) element -flavor object device]232 if {$itk_option(-output) != ""} { 233 if {![Rappture::library isvalid $itk_option(-output)]} { 234 error "bad value \"$itk_option(-output)\": should be Rappture::Library" 235 } 236 set _device [$itk_option(-output) element -flavor object device] 237 237 } 238 238 after cancel [itcl::code $this _rebuild]
Note: See TracChangeset
for help on using the changeset viewer.