Index: trunk/gui/apps/driver
===================================================================
--- trunk/gui/apps/driver	(revision 7)
+++ trunk/gui/apps/driver	(revision 8)
@@ -128,5 +128,5 @@
 # build everything inside this main window
 set win [.main component app]
-$win configure -background #a6a6a6
+#$win configure -background #a6a6a6
 
 frame $win.input -borderwidth 12 -relief flat
@@ -137,10 +137,10 @@
 
 # make an arrow that goes from input to output side
-label $win.arrow -borderwidth 0 -image in2out
-place $win.arrow -y 2 -anchor n
-bind $win.input <Configure> [list align_arrow $win]
-proc align_arrow {win} {
-    place $win.arrow -x [expr {[winfo width $win.input]+5}]
-}
+#label $win.arrow -borderwidth 0 -image in2out
+#place $win.arrow -y 2 -anchor n
+#bind $win.input <Configure> [list align_arrow $win]
+#proc align_arrow {win} {
+#    place $win.arrow -x [expr {[winfo width $win.input]+5}]
+#}
 
 # ----------------------------------------------------------------------
@@ -150,10 +150,8 @@
 set dfirst ""
 set dlist [$config children -type structure controls]
-puts "device: $dlist"
 if {"" != $dlist} {
     foreach dname $dlist {
         set obj [$config element -flavor object controls.$dname]
         set name [$obj get label]
-puts " => $name = $obj"
         set devs($name) $obj
     }
@@ -177,9 +175,8 @@
     set first [lindex $devlist 0]
     set dfirst $devs($first)
-    set tags [$dfirst children]
+    set tags [$dfirst children components]
     set i [lsearch $tags label]
     if {$i >= 0} {set tags [lreplace $tags $i $i]}
 
-puts "first device: tags = $tags"
     if {$tags == "molecule"} {
         Rappture::MoleculeViewer $w.device -device $devs($first) \
Index: trunk/gui/scripts/analyzer.tcl
===================================================================
--- trunk/gui/scripts/analyzer.tcl	(revision 7)
+++ trunk/gui/scripts/analyzer.tcl	(revision 8)
@@ -125,5 +125,5 @@
 #
 # If the simulation page is showing, this kicks off the simulator
-# by executing the executable.command associated with the -tool.  While
+# by executing the tool.command associated with the -tool.  While
 # the simulation is running, it shows status.  When the simulation is
 # finished, it switches automatically to "analyze" mode and shows
@@ -137,4 +137,5 @@
 
         set job(control) ""
+        set job(error) ""
 
         # if the hold window is set, then put up a busy cursor
@@ -152,5 +153,5 @@
             set xml2 [$itk_option(-device) xml]
             regsub -all {&} $xml2 {\\\&} xml2
-            regsub {</tool>} $xml "$xml2</tool>" xml
+            regsub {</run>} $xml "$xml2</run>" xml
             puts $fid $xml
             close $fid
@@ -159,5 +160,5 @@
         # execute the tool using the path from the tool description
         if {$status == 0} {
-            set cmd [$itk_option(-tool) get executable.command]
+            set cmd [$itk_option(-tool) get tool.command]
 
             set status [catch {eval blt::bgexec \
@@ -211,5 +212,5 @@
 
     # if control mode is "auto", then simulate right away
-    if {$_control == "auto"} {
+    if {[string match auto* $_control]} {
         simulate
     }
@@ -231,9 +232,9 @@
 
     # try to load new results from the given file
-    set _run [Rappture::Library::open $file]
+    set _run [Rappture::library $file]
 
     # go through the analysis and create widgets to display results
     foreach item [array names _widgets] {
-        $_widgets($item) configure -run $_run
+        $_widgets($item) configure -output $_run
     }
 }
@@ -254,10 +255,10 @@
 # CONFIGURATION OPTION: -tool
 #
-# Set to the Rappture::Library object representing the tool being
+# Set to the Rappture::library object representing the tool being
 # run in this analyzer.
 # ----------------------------------------------------------------------
 itcl::configbody Rappture::Analyzer::tool {
     if {![Rappture::library isvalid $itk_option(-tool)]} {
-        error "bad value \"$itk_option(-tool)\": should be Rappture::Library"
+        error "bad value \"$itk_option(-tool)\": should be Rappture::library"
     }
 
@@ -271,5 +272,5 @@
 # CONFIGURATION OPTION: -device
 #
-# Set to the Rappture::Library object representing the device being
+# Set to the Rappture::library object representing the device being
 # run in this analyzer.
 # ----------------------------------------------------------------------
@@ -277,5 +278,5 @@
     if {$itk_option(-device) != ""
           && ![Rappture::library isvalid $itk_option(-device)]} {
-        error "bad value \"$itk_option(-device)\": should be Rappture::Library"
+        error "bad value \"$itk_option(-device)\": should be Rappture::library"
     }
     reset
@@ -285,10 +286,10 @@
 # CONFIGURATION OPTION: -analysis
 #
-# Set to the Rappture::Library object representing the analysis that
+# Set to the Rappture::library object representing the analysis that
 # should be shown in this analyzer.
 # ----------------------------------------------------------------------
 itcl::configbody Rappture::Analyzer::analysis {
     if {![Rappture::library isvalid $itk_option(-analysis)]} {
-        error "bad value \"$itk_option(-analysis)\": should be Rappture::Library"
+        error "bad value \"$itk_option(-analysis)\": should be Rappture::library"
     }
     set _control [$itk_option(-analysis) get control]
@@ -314,4 +315,15 @@
                 pack $_widgets($item) -expand yes -fill both
             }
+            elevels* {
+                set name "page[incr counter]"
+
+                set page [$itk_component(results) insert end $name]
+                $itk_component(resultselector) choices insert end \
+                    $name "Energy Levels"
+
+                set _widgets($item) [Rappture::EnergyLevels $page.#auto \
+                    -layout [$itk_option(-analysis) element -flavor object $item]]
+                pack $_widgets($item) -expand yes -fill both
+            }
         }
     }
Index: trunk/gui/scripts/energyLevels.tcl
===================================================================
--- trunk/gui/scripts/energyLevels.tcl	(revision 7)
+++ trunk/gui/scripts/energyLevels.tcl	(revision 8)
@@ -16,14 +16,33 @@
 option add *EnergyLevels.width 4i widgetDefault
 option add *EnergyLevels.height 4i widgetDefault
+option add *EnergyLevels.levelColor blue widgetDefault
+option add *EnergyLevels.levelTextForeground blue widgetDefault
+option add *EnergyLevels.levelTextBackground #d9d9d9 widgetDefault
+
+option add *EnergyLevels.font \
+    -*-helvetica-medium-r-normal-*-*-120-* widgetDefault
+
+option add *EnergyLevels.detailFont \
+    -*-helvetica-medium-r-normal-*-*-100-* widgetDefault
 
 itcl::class Rappture::EnergyLevels {
     inherit itk::Widget
 
+    itk_option define -layout layout Layout ""
+    itk_option define -output output Output ""
+    itk_option define -levelcolor levelColor LevelColor ""
+    itk_option define -leveltextforeground levelTextForeground Foreground ""
+    itk_option define -leveltextbackground levelTextBackground Background ""
+
     constructor {args} { # defined below }
     destructor { # defined below }
 
-    method load {libobj}
-}
-                                                                                
+    protected method _render {}
+    protected method _adjust {what val}
+    protected method _getColumn {name}
+    protected method _getUnits {name}
+    protected method _getMidPt {elist pos}
+}
+
 itk::usual EnergyLevels {
 }
@@ -36,4 +55,110 @@
     pack propagate $itk_component(hull) no
 
+    #
+    # Add label for the title.
+    #
+    itk_component add title {
+        label $itk_interior.title
+    }
+    pack $itk_component(title) -side top
+
+    #
+    # Add labels showing level stats at bottom.
+    #
+    itk_component add stats {
+        frame $itk_interior.stats
+    }
+    pack $itk_component(stats) -side bottom -fill x
+
+    itk_component add numvall {
+        label $itk_component(stats).numvall -text "Number of valence electrons:"
+    }
+    grid $itk_component(numvall) -row 0 -column 0 -sticky e
+
+    itk_component add numvalv {
+        label $itk_component(stats).numvalv
+    }
+    grid $itk_component(numvalv) -row 0 -column 1 -sticky w
+
+    itk_component add numbasl {
+        label $itk_component(stats).numbasl -text "Number of basis functions:"
+    }
+    grid $itk_component(numbasl) -row 1 -column 0 -sticky e
+
+    itk_component add numbasv {
+        label $itk_component(stats).numbasv
+    }
+    grid $itk_component(numbasv) -row 1 -column 1 -sticky w
+
+
+    itk_component add cntls {
+        frame $itk_interior.cntls
+    }
+    pack $itk_component(cntls) -side right -fill y
+    grid rowconfigure $itk_component(cntls) 0 -weight 1
+    grid rowconfigure $itk_component(cntls) 1 -minsize 10
+    grid rowconfigure $itk_component(cntls) 2 -weight 1
+
+    #
+    # Add MORE/FEWER levels control for TOP of graph
+    #
+    itk_component add upperE {
+        frame $itk_component(cntls).upperE
+    }
+
+    itk_component add upperEmore {
+        label $itk_component(upperE).morel -text "More"
+    } {
+        usual
+        rename -font -detailfont detailFont Font
+    }
+    pack $itk_component(upperEmore) -side top
+
+    itk_component add upperEfewer {
+        label $itk_component(upperE).fewerl -text "Fewer"
+    } {
+        usual
+        rename -font -detailfont detailFont Font
+    }
+    pack $itk_component(upperEfewer) -side bottom
+
+    itk_component add upperEcntl {
+        scale $itk_component(upperE).cntl -orient vertical -showvalue 0 \
+            -command [itcl::code $this _adjust upper]
+    }
+    pack $itk_component(upperEcntl) -side top -fill y
+
+    #
+    # Add MORE/FEWER levels control for BOTTOM of graph
+    #
+    itk_component add lowerE {
+        frame $itk_component(cntls).lowerE
+    }
+
+    itk_component add lowerEmore {
+        label $itk_component(lowerE).morel -text "More"
+    } {
+        usual
+        rename -font -detailfont detailFont Font
+    }
+    pack $itk_component(lowerEmore) -side bottom
+
+    itk_component add lowerEfewer {
+        label $itk_component(lowerE).fewerl -text "Fewer"
+    } {
+        usual
+        rename -font -detailfont detailFont Font
+    }
+    pack $itk_component(lowerEfewer) -side top
+
+    itk_component add lowerEcntl {
+        scale $itk_component(lowerE).cntl -orient vertical -showvalue 0 \
+            -command [itcl::code $this _adjust lower]
+    }
+    pack $itk_component(lowerEcntl) -side top -fill y
+
+    #
+    # Add graph showing levels
+    #
     itk_component add graph {
         blt::graph $itk_interior.graph \
@@ -56,28 +181,15 @@
 
 # ----------------------------------------------------------------------
-# USAGE: load <libObj>
+# USAGE: _render
 #
-# Clients use this to load a list of energy levels from the specified
-# XML libObj, which should be a <table>.  One column in the table
-# should have "labels" and the other "energies".
-# ----------------------------------------------------------------------
-itcl::body Rappture::EnergyLevels::load {libobj} {
-    set clist [$libobj children]
-    set ilabel [lsearch $clist [$libobj element column(labels)]]
-    if {$ilabel < 0} {
-        error "can't find column(labels) in energy table data"
-    }
-    set ienergy [lsearch $clist [$libobj element column(energies)]]
-    if {$ienergy < 0} {
-        error "can't find column(energies) in energy table data"
-    }
-
-    set units [$libobj get column(energies).units]
-    if {$units == ""} {
-        set units "eV"
-    }
-
-    #
-    # Update the graph to show the current set of levels.
+# Used internally to load a list of energy levels from a <table> within
+# the -output XML object.  The -layout object indicates how information
+# should be extracted from the table.  The <layout> should have an
+# <energies> tag and perhaps a <labels> tag, which indicates the table
+# and the column within the table containing the energies.
+# ----------------------------------------------------------------------
+itcl::body Rappture::EnergyLevels::_render {} {
+    #
+    # Clear any information shown in the graph.
     #
     set graph $itk_component(graph)
@@ -85,32 +197,66 @@
     eval $graph marker delete [$graph marker names]
 
+    #
+    # Plug in the title from the layout
+    #
+    set title ""
+    if {$itk_option(-layout) != ""} {
+        set title [$itk_option(-layout) get label]
+    }
+    if {"" != $title} {
+        pack $itk_component(title) -side top -before $itk_component(stats)
+        $itk_component(title) configure -text $title
+    } else {
+        pack forget $itk_component(title)
+    }
+
+    #
+    # Look through the layout and figure out what to extract
+    # from the table.
+    #
+    set elist [_getColumn energies]
+    if {[llength $elist] == 0} {
+        return
+    }
+    set units [_getUnits energies]
+
+    set llist [_getColumn names]
+    if {[llength $llist] == 0} {
+        # no labels? then invent some
+        set i 0
+        foreach name $elist {
+            lappend llist "E$i"
+            incr i
+        }
+    }
+
+    #
+    # Update the graph to show the current set of levels.
+    #
     set n 0
+    set nlumo 0
     set emax ""
     set emin ""
     set ehomo ""
     set elumo ""
-    foreach line [split [$libobj get data] "\n"] {
-        set lval [lindex $line $ilabel]
-        set eval [lindex $line $ienergy]
-        if {$lval == "" || $eval == ""} {
-            continue
-        }
-
-        set eval [Rappture::Units::convert $eval \
-            -context $units -to $units -units off]
-
+    foreach eval $elist lval $llist {
         if {$lval == "HOMO"} {
             set ehomo $eval
-        } elseif {$lval == "LUMO"} {
+            set lval "HOMO = $eval $units"
+            set nlumo [expr {$n+1}]
+        } elseif {$lval == "LUMO" || $n == $nlumo} {
             set elumo $eval
+            set lval "LUMO = $eval $units"
         }
 
         set elem "elem[incr n]"
         $graph element create $elem \
-            -xdata {0 0.8} -ydata [list $eval $eval] \
-            -color blue -symbol "" -linewidth 2
-
-        $graph marker create text -coords [list 0.8 $eval] \
-            -text $lval -anchor w -background ""
+            -xdata {0 1} -ydata [list $eval $eval] \
+            -color $itk_option(-levelcolor) -symbol "" -linewidth 2
+
+        $graph marker create text -coords [list 0.5 $eval] \
+            -text $lval -anchor c \
+            -foreground $itk_option(-leveltextforeground) \
+            -background $itk_option(-leveltextbackground)
 
         if {$emax == ""} {
@@ -123,46 +269,239 @@
     }
     $graph xaxis configure -min 0 -max 1 -showticks off -linewidth 0
-    $graph yaxis configure -title "Energy ($units)"
+    if {$units != ""} {
+        $graph yaxis configure -title "Energy ($units)"
+    } else {
+        $graph yaxis configure -title "Energy"
+    }
 
     # bump the limits so they are big enough to show labels
     set fnt $itk_option(-font)
     set h [expr {0.5*([font metrics $fnt -linespace] + 5)}]
-    set emin [expr {$emin-$h/150.0}]
-    set emax [expr {$emax+$h/150.0}]
+    set emin [expr {$emin-($emax-$emin)*$h/150.0}]
+    set emax [expr {$emax+($emax-$emin)*$h/150.0}]
     $graph yaxis configure -min $emin -max $emax
 
+    # fill in the stats at the bottom
+    $itk_component(numvalv) configure -text $nlumo
+    $itk_component(numbasv) configure -text $n
+
     #
     # If we found HOMO/LUMO levels, then add the band gap at
-    # that point.
+    # that point.  Also, fix the controls for energy range.
     #
     if {$ehomo != "" && $elumo != ""} {
-        $graph marker create line \
-            -coords [list 0.2 $elumo 0.2 $ehomo]
-
-        set egap [expr {$ehomo-$elumo}]
+        set id [$graph marker create line \
+            -coords [list 0.2 $elumo 0.2 $ehomo]]
+        $graph marker after $id
+
+        set egap [expr {$elumo-$ehomo}]
         set emid [expr {0.5*($ehomo+$elumo)}]
         $graph marker create text \
             -coords [list 0.21 $emid] -background "" \
             -text "Eg = [format %.2g $egap] $units" -anchor w
-    }
-}
-
-package require Rappture
-Rappture::EnergyLevels .e
-pack .e -expand yes -fill both
-
-set lib [Rappture::library {<?xml version="1.0"?>
-<table>
-<column id="labels">Name</column>
-<column id="energies">Energy</column>
-<data>
-  E0    0.1
-  E1    0.2
-  LUMO  0.4
-  HOMO  0.9
-  E4    1.5
-  E5    2.8
-</data>
-</table>}]
-
-.e load $lib
+
+        # fix the limits for the lower scale
+        set elim [_getMidPt $elist [expr {$nlumo-1}]]
+        if {"" != $elim} {
+            $itk_component(lowerEcntl) configure -from $elim -to $emin \
+                -resolution [expr {0.02*($elim-$emin)}]
+            grid $itk_component(lowerE) -row 2 -column 0 -sticky ns
+
+            set e0 [_getMidPt $elist [expr {$nlumo-3}]]
+            if {"" != $e0} {
+                $itk_component(lowerEcntl) set $e0
+            } else {
+                $itk_component(lowerEcntl) set $elim
+            }
+        } else {
+            grid forget $itk_component(lowerE)
+        }
+
+        # fix the limits for the upper scale
+        set elim [_getMidPt $elist [expr {$nlumo+1}]]
+        if {"" != $elim} {
+            $itk_component(upperEcntl) configure -from $emax -to $elim \
+                -resolution [expr {0.02*($emax-$elim)}]
+            grid $itk_component(upperE) -row 0 -column 0 -sticky ns
+
+            set e0 [_getMidPt $elist [expr {$nlumo+3}]]
+            if {"" != $e0} {
+                $itk_component(upperEcntl) set $e0
+            } else {
+                $itk_component(upperEcntl) set $elim
+            }
+        } else {
+            grid forget $itk_component(upperE)
+        }
+    } else {
+        grid forget $itk_component(upperE)
+        grid forget $itk_component(lowerE)
+    }
+}
+
+# ----------------------------------------------------------------------
+# USAGE: _adjust <what> <val>
+#
+# Used internally to adjust the upper/lower limits of the graph
+# as the user drags the slider from "More" to "Fewer".  Sets
+# the specified limit to the given value.
+# ----------------------------------------------------------------------
+itcl::body Rappture::EnergyLevels::_adjust {what val} {
+    switch -- $what {
+        upper {
+            $itk_component(graph) yaxis configure -max $val
+        }
+        lower {
+            $itk_component(graph) yaxis configure -min $val
+        }
+        default {
+            error "bad limit \"$what\": should be upper or lower"
+        }
+    }
+}
+
+# ----------------------------------------------------------------------
+# USAGE: _getColumn <name>
+#
+# Used internally to load a list of energy levels from a <table> within
+# the -output XML object.  The -layout object indicates how information
+# should be extracted from the table.  The <layout> should have an
+# <energies> tag and perhaps a <labels> tag, which indicates the table
+# and the column within the table containing the energies.
+# ----------------------------------------------------------------------
+itcl::body Rappture::EnergyLevels::_getColumn {name} {
+    if {$itk_option(-layout) == "" || $itk_option(-output) == ""} {
+        return
+    }
+
+    #
+    # Figure out which column in which table contains the data.
+    # Then, find that table and extract the column.  Figure out
+    # the position of the column from the list of all column names.
+    #
+    set table [$itk_option(-layout) get $name.table]
+    set col [$itk_option(-layout) get $name.column]
+
+    set clist ""
+    foreach c [$itk_option(-output) children -type column $table] {
+        lappend clist [$itk_option(-output) get $table.$c.label]
+    }
+    set ipos [lsearch $clist $col]
+    if {$ipos < 0} {
+        return  ;# can't find data -- bail out!
+    }
+
+    set units [$itk_option(-output) get $table.column$ipos.units]
+
+    set rlist ""
+    foreach line [split [$itk_option(-output) get $table.data] "\n"] {
+        if {"" != [string trim $line]} {
+            set val [lindex $line $ipos]
+
+            if {$units != ""} {
+                set val [Rappture::Units::convert $val \
+                    -context $units -to $units -units off]
+            }
+            lappend rlist $val
+        }
+    }
+    return $rlist
+}
+
+# ----------------------------------------------------------------------
+# USAGE: _getUnits <name>
+#
+# Used internally to extract the units from a <table> within the
+# -output XML object.  The -layout object indicates how information
+# should be extracted from the table.  The <layout> should have an
+# <energies> tag and perhaps a <labels> tag, which indicates the table
+# and the column within the table containing the units.
+# ----------------------------------------------------------------------
+itcl::body Rappture::EnergyLevels::_getUnits {name} {
+    if {$itk_option(-layout) == "" || $itk_option(-output) == ""} {
+        return
+    }
+
+    #
+    # Figure out which column in which table contains the data.
+    # Then, find that table and extract the column.  Figure out
+    # the position of the column from the list of all column names.
+    #
+    set table [$itk_option(-layout) get $name.table]
+    set col [$itk_option(-layout) get $name.column]
+
+    set clist ""
+    foreach c [$itk_option(-output) children -type column $table] {
+        lappend clist [$itk_option(-output) get $table.$c.label]
+    }
+    set ipos [lsearch $clist $col]
+    if {$ipos < 0} {
+        return  ;# can't find data -- bail out!
+    }
+
+    return [$itk_option(-output) get $table.column$ipos.units]
+}
+
+# ----------------------------------------------------------------------
+# USAGE: _getMidPt <elist> <pos>
+#
+# Used internally to compute the midpoint between two energy levels
+# at <pos> and <pos-1> in the <elist>.  Returns a number representing
+# the mid-point (average value) or "" if the levels involved do
+# no exist in <elist>.
+# ----------------------------------------------------------------------
+itcl::body Rappture::EnergyLevels::_getMidPt {elist pos} {
+    if {$pos < [llength $elist] && $pos > 1} {
+        set e1 [lindex $elist $pos]
+        set e0 [lindex $elist [expr {$pos-1}]]
+        return [expr {0.5*($e0+$e1)}]
+    }
+    return ""
+}
+
+# ----------------------------------------------------------------------
+# OPTION: -layout
+# ----------------------------------------------------------------------
+itcl::configbody Rappture::EnergyLevels::layout {
+    if {$itk_option(-layout) != ""
+          && ![Rappture::library isvalid $itk_option(-layout)]} {
+        error "bad value \"$itk_option(-layout)\": should be Rappture::library object"
+    }
+    after idle [itcl::code $this _render]
+}
+
+# ----------------------------------------------------------------------
+# OPTION: -output
+# ----------------------------------------------------------------------
+itcl::configbody Rappture::EnergyLevels::output {
+    if {$itk_option(-output) != ""
+          && ![Rappture::library isvalid $itk_option(-output)]} {
+        error "bad value \"$itk_option(-output)\": should be Rappture::library object"
+    }
+    after cancel [itcl::code $this _render]
+    after idle [itcl::code $this _render]
+}
+
+# ----------------------------------------------------------------------
+# OPTION: -levelColor
+# ----------------------------------------------------------------------
+itcl::configbody Rappture::EnergyLevels::levelcolor {
+    after cancel [itcl::code $this _render]
+    after idle [itcl::code $this _render]
+}
+
+# ----------------------------------------------------------------------
+# OPTION: -leveltextforeground
+# ----------------------------------------------------------------------
+itcl::configbody Rappture::EnergyLevels::leveltextforeground {
+    after cancel [itcl::code $this _render]
+    after idle [itcl::code $this _render]
+}
+
+# ----------------------------------------------------------------------
+# OPTION: -leveltextbackground
+# ----------------------------------------------------------------------
+itcl::configbody Rappture::EnergyLevels::leveltextbackground {
+    after cancel [itcl::code $this _render]
+    after idle [itcl::code $this _render]
+}
Index: trunk/gui/scripts/moleculeViewer.tcl
===================================================================
--- trunk/gui/scripts/moleculeViewer.tcl	(revision 7)
+++ trunk/gui/scripts/moleculeViewer.tcl	(revision 8)
@@ -164,101 +164,101 @@
 }
 
-package require Rappture
-Rappture::MoleculeViewer .e -library [Rappture::library -std library.xml]
-pack .e -expand yes -fill both
-
-set dev [Rappture::library {<?xml version="1.0"?>
-<structure>
-<components>
-<molecule id="Aspirin">
-  <formula>???</formula>
-  <info>Aspirin molecule</info>
-  <atom id="1">
-    <symbol>C</symbol>
-    <xyz>-1.892  -0.992  -1.578</xyz>
-  </atom>
-  <atom id="2">
-    <symbol>C</symbol>
-    <xyz>-1.370  -2.149  -0.990</xyz>
-  </atom>
-  <atom id="3">
-    <symbol>C</symbol>
-    <xyz>-0.079  -2.146  -0.464</xyz>
-  </atom>
-  <atom id="4">
-    <symbol>C</symbol>
-    <xyz>0.708  -0.986  -0.521</xyz>
-  </atom>
-  <atom id="5">
-    <symbol>C</symbol>
-    <xyz>0.203   0.156  -1.196</xyz>
-  </atom>
-  <atom id="6">
-    <symbol>C</symbol>
-    <xyz>-1.108   0.161  -1.654</xyz>
-  </atom>
-  <atom id="7">
-    <symbol>C</symbol>
-    <xyz>2.085  -1.030   0.104</xyz>
-  </atom>
-  <atom id="8">
-    <symbol>O</symbol>
-    <xyz>2.533  -2.034   0.636</xyz>
-  </atom>
-  <atom id="9">
-    <symbol>O</symbol>
-    <xyz>2.879   0.025   0.112</xyz>
-  </atom>
-  <atom id="10">
-    <symbol>O</symbol>
-    <xyz>0.753   1.334  -1.084</xyz>
-  </atom>
-  <atom id="11">
-    <symbol>C</symbol>
-    <xyz>0.668   2.025   0.034</xyz>
-  </atom>
-  <atom id="12">
-    <symbol>O</symbol>
-    <xyz>1.300   3.063   0.152</xyz>
-  </atom>
-  <atom id="13">
-    <symbol>C</symbol>
-    <xyz>-0.243   1.577   1.144</xyz>
-  </atom>
-  <atom id="14">
-    <symbol>H</symbol>
-    <xyz>-2.879  -0.962  -1.985</xyz>
-  </atom>
-  <atom id="15">
-    <symbol>H</symbol>
-    <xyz>-1.988  -3.037  -0.955</xyz>
-  </atom>
-  <atom id="16">
-    <symbol>H</symbol>
-    <xyz>0.300  -3.063  -0.005</xyz>
-  </atom>
-  <atom id="17">
-    <symbol>H</symbol>
-    <xyz>-1.489   1.084  -2.059</xyz>
-  </atom>
-  <atom id="18">
-    <symbol>H</symbol>
-    <xyz>2.566   0.782  -0.326</xyz>
-  </atom>
-  <atom id="19">
-    <symbol>H</symbol>
-    <xyz>-0.761   0.636   0.933</xyz>
-  </atom>
-  <atom id="20">
-    <symbol>H</symbol>
-    <xyz>-1.009   2.349   1.290</xyz>
-  </atom>
-  <atom id="21">
-    <symbol>H</symbol>
-    <xyz>0.346   1.435   2.059</xyz>
-  </atom>
-</molecule>
-</components>
-</structure>}]
+#package require Rappture
+#Rappture::MoleculeViewer .e -library [Rappture::library -std library.xml]
+#pack .e -expand yes -fill both
+#
+#set dev [Rappture::library {<?xml version="1.0"?>
+#<structure>
+#<components>
+#<molecule id="Aspirin">
+#  <formula>???</formula>
+#  <info>Aspirin molecule</info>
+#  <atom id="1">
+#    <symbol>C</symbol>
+#    <xyz>-1.892  -0.992  -1.578</xyz>
+#  </atom>
+#  <atom id="2">
+#    <symbol>C</symbol>
+#    <xyz>-1.370  -2.149  -0.990</xyz>
+#  </atom>
+#  <atom id="3">
+#    <symbol>C</symbol>
+#    <xyz>-0.079  -2.146  -0.464</xyz>
+#  </atom>
+#  <atom id="4">
+#    <symbol>C</symbol>
+#    <xyz>0.708  -0.986  -0.521</xyz>
+#  </atom>
+#  <atom id="5">
+#    <symbol>C</symbol>
+#    <xyz>0.203   0.156  -1.196</xyz>
+#  </atom>
+#  <atom id="6">
+#    <symbol>C</symbol>
+#    <xyz>-1.108   0.161  -1.654</xyz>
+#  </atom>
+#  <atom id="7">
+#    <symbol>C</symbol>
+#    <xyz>2.085  -1.030   0.104</xyz>
+#  </atom>
+#  <atom id="8">
+#    <symbol>O</symbol>
+#    <xyz>2.533  -2.034   0.636</xyz>
+#  </atom>
+#  <atom id="9">
+#    <symbol>O</symbol>
+#    <xyz>2.879   0.025   0.112</xyz>
+#  </atom>
+#  <atom id="10">
+#    <symbol>O</symbol>
+#    <xyz>0.753   1.334  -1.084</xyz>
+#  </atom>
+#  <atom id="11">
+#    <symbol>C</symbol>
+#    <xyz>0.668   2.025   0.034</xyz>
+#  </atom>
+#  <atom id="12">
+#    <symbol>O</symbol>
+#    <xyz>1.300   3.063   0.152</xyz>
+#  </atom>
+#  <atom id="13">
+#    <symbol>C</symbol>
+#    <xyz>-0.243   1.577   1.144</xyz>
+#  </atom>
+#  <atom id="14">
+#    <symbol>H</symbol>
+#    <xyz>-2.879  -0.962  -1.985</xyz>
+#  </atom>
+#  <atom id="15">
+#    <symbol>H</symbol>
+#    <xyz>-1.988  -3.037  -0.955</xyz>
+#  </atom>
+#  <atom id="16">
+#    <symbol>H</symbol>
+#    <xyz>0.300  -3.063  -0.005</xyz>
+#  </atom>
+#  <atom id="17">
+#    <symbol>H</symbol>
+#    <xyz>-1.489   1.084  -2.059</xyz>
+#  </atom>
+#  <atom id="18">
+#    <symbol>H</symbol>
+#    <xyz>2.566   0.782  -0.326</xyz>
+#  </atom>
+#  <atom id="19">
+#    <symbol>H</symbol>
+#    <xyz>-0.761   0.636   0.933</xyz>
+#  </atom>
+#  <atom id="20">
+#    <symbol>H</symbol>
+#    <xyz>-1.009   2.349   1.290</xyz>
+#  </atom>
+#  <atom id="21">
+#    <symbol>H</symbol>
+#    <xyz>0.346   1.435   2.059</xyz>
+#  </atom>
+#</molecule>
+#</components>
+#</structure>}]
 # add connectivity at some point...
 #CONECT    1    2    6   14                   
@@ -284,3 +284,3 @@
 #CONECT   21   13                
 
-.e configure -device $dev
+#.e configure -device $dev
Index: trunk/gui/scripts/xyplot.tcl
===================================================================
--- trunk/gui/scripts/xyplot.tcl	(revision 7)
+++ trunk/gui/scripts/xyplot.tcl	(revision 8)
@@ -4,5 +4,5 @@
 #  This widget is an X/Y plot, meant to view line graphs produced
 #  as output from the run of a Rappture tool.  It takes a -layout
-#  object describing what should be plotted, and a -run object
+#  object describing what should be plotted, and an -output object
 #  containing the data.  This widget puts it all together, and lets
 #  the user explore the results.
@@ -23,5 +23,5 @@
 
     itk_option define -layout layout Layout ""
-    itk_option define -run run Run ""
+    itk_option define -output output Output ""
 
     constructor {args} { # defined below }
@@ -30,5 +30,5 @@
     protected method _rebuild {}
 
-    private variable _device ""  ;# device contained in -run
+    private variable _device ""  ;# device contained in -output
     private variable _path2obj   ;# maps field/curve name => object
 }
@@ -82,5 +82,5 @@
     set g $itk_component(plot)
     set layout $itk_option(-layout)
-    set run $itk_option(-run)
+    set run $itk_option(-output)
 
     # first clear out the widget
@@ -220,5 +220,5 @@
 
 # ----------------------------------------------------------------------
-# CONFIGURATION OPTION: -run
+# CONFIGURATION OPTION: -output
 #
 # Set to the Rappture::Library object representing the data being
@@ -230,9 +230,9 @@
         set _device ""
     }
-    if {$itk_option(-run) != ""} {
-        if {![Rappture::library isvalid $itk_option(-run)]} {
-            error "bad value \"$itk_option(-run)\": should be Rappture::Library"
-        }
-        set _device [$itk_option(-run) element -flavor object device]
+    if {$itk_option(-output) != ""} {
+        if {![Rappture::library isvalid $itk_option(-output)]} {
+            error "bad value \"$itk_option(-output)\": should be Rappture::Library"
+        }
+        set _device [$itk_option(-output) element -flavor object device]
     }
     after cancel [itcl::code $this _rebuild]
