Changeset 1220 for branches/sandbox


Ignore:
Timestamp:
Aug 26, 2012 6:51:47 PM (8 years ago)
Author:
toby
Message:

fix chem constrain add row bug; Add Fourier to export_drawxtl; new param on MakeExportBox? -- not used?

Location:
branches/sandbox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/chemrest.tcl

    r1215 r1220  
    293293# show a box as yellow, if an invalid number is entered
    294294proc ChemUpdateRow {var index mode} {
     295    if $::expcons(DisableChemWeightsTrace) return
    295296    set num $index
    296     if $::expcons(DisableChemWeightsTrace) return
    297297    set weight [string trim $::ChemWeights($num)]
    298298    set box $::expcons(ChemConstBox)
     
    363363}
    364364
    365 foreach item [trace vinfo ChemWeights] {
    366     eval trace vdelete ChemWeights $item
    367 }
    368 trace variable ChemWeights w ChemUpdateRow
    369 
     365set ::ChemWeights(0) ""
     366foreach item [trace vinfo ::ChemWeights] {
     367    eval trace vdelete ::ChemWeights $item
     368}
     369trace variable ::ChemWeights w ChemUpdateRow
     370
     371set ::expcons(ChemSum) ""
     372set ::expcons(ChemSumESD) ""
    370373foreach item [trace vinfo expcons(ChemSum)] {
    371374    eval trace vdelete expcons(ChemSum) $item
  • branches/sandbox/expgui

    r1215 r1220  
    767767# utility export routines for the export_*.tcl files:
    768768# make a box for export
    769 proc MakeExportBox {win title webref} {
     769proc MakeExportBox {win title webref {bookmark ""}} {
    770770    global expmap expgui
    771771    catch {destroy $win}
     
    783783    }
    784784    # leave a place for format-specific items
    785     pack [frame $win.special] -side top
    786     pack [frame $win.but] -side top -fill x -expand yes
     785    pack [frame $win.special] -side top -fill both -expand yes
     786    pack [frame $win.but] -side top -fill x -expand no
    787787    pack [button $win.but.1 -text Write -command "destroy $win"] -side left
    788788    SetExportPhase [lindex $expmap(phaselist) 0] $win
     
    790790            -command "set expgui(export_phase) 0;destroy $win"] -side left
    791791    pack [button $win.but.help -text Help -bg yellow \
    792             -command "MakeWWWHelp expgui.html ExportMSI"] \
     792            -command "MakeWWWHelp expgui.html $bookmark"] \
    793793            -side right
    794794}
  • branches/sandbox/export_drawxtl.tcl

    r1215 r1220  
    66set action export_drawxtl
    77set ::DXTLcolorlist "White Red Green Blue Yellow Cyan Magenta Black Orange Brown Grey Silver White"
     8set ::DXTL(bonds) 0
     9set ::DXTL(coords) 1
     10set ::DXTL(blackarrow) Green
     11set ::DXTL(redarrow) Red
     12foreach a {X Y Z} {
     13    set ::DXTL(${a}dispMin) 0.0
     14    set ::DXTL(${a}dispMax) 1.0
     15}
     16set ::DXTL(mtype) ""
     17set ::DXTL(mfil) ""
     18set ::DXTL(FourierRange) ""
     19
    820proc export_drawxtl {} {
    921    global expmap expgui
     
    1527        return
    1628    }
    17     foreach t [trace vinfo expgui(export_phase)] {
    18         eval trace vdelete expgui(export_phase) $t
    19     }
    20      MakeExportBox .export "Export coordinates to program DRAWXTL" ""
     29    foreach t [trace vinfo ::expgui(export_phase)] {
     30        eval trace vdelete ::expgui(export_phase) $t
     31    }
     32    MakeExportBox .export "Export coordinates to program DRAWXTL" ""
    2133#           "MakeWWWHelp expgui.html export"
    2234
     
    2436    wm protocol .export WM_DELETE_WINDOW {set expgui(export_phase) 0; destroy .export }
    2537    set bx .export.special
    26     global DXTL
    27     if {[info global DXTL] == ""} {
    28         set DXTL(bonds) 0
    29         set DXTL(coords) 1
    30         set DXTL(blackarrow) Green
    31         set DXTL(redarrow) Red
    32     }
    3338    set row 1
    3439    grid [label $bx.1 -text "Title:"] -column 1 -row $row -sticky e
    35     grid [entry $bx.2 -textvariable DXTL(title) -width 40] \
     40    grid [entry $bx.2 -textvariable ::DXTL(title) -width 40] \
    3641        -row $row -column 2 -columnspan 5 -sticky w
    37     set DXTL(title) [expinfo title]
     42    set ::DXTL(title) [expinfo title]
    3843    incr row
    3944    grid [checkbutton $bx.3 -text "Include coordinates in .str file" \
    40               -variable DXTL(coords)] \
     45              -variable ::DXTL(coords)] \
    4146        -row $row -column 1 -columnspan 5 -sticky w
    4247    incr row
    43     set DXTL(arrowbox) $bx.4
     48    set ::DXTL(arrowbox) $bx.4
    4449    grid [checkbutton $bx.4 -text "Display arrows for magnetic atoms" \
    45               -variable DXTL(genarrows) -state disabled] \
     50              -variable ::DXTL(genarrows) -state disabled] \
    4651        -row $row -column 1 -columnspan 5 -sticky w
    4752    incr row
    48     set DXTL(arrowcolorbox) $bx.4a
    49     set DXTL(arrowcolorbox_row) $row
    50     grid [frame $bx.4a] -sticky ew -row $DXTL(arrowcolorbox_row) \
     53    set ::DXTL(arrowcolorbox) $bx.4a
     54    set ::DXTL(arrowcolorbox_row) $row
     55    grid [frame $bx.4a] -sticky ew -row $::DXTL(arrowcolorbox_row) \
    5156        -column 1 -columnspan 5
    5257    grid [label $bx.4a.h -text "Arrow colors: "] -column 0 -row 1 -sticky w
    5358    grid [label $bx.4a.bll -text "   generated by Black operator "] -column 0 -row 2
    54     eval tk_optionMenu $bx.4a.bl DXTL(blackarrow) $::DXTLcolorlist
     59    eval tk_optionMenu $bx.4a.bl ::DXTL(blackarrow) $::DXTLcolorlist
    5560    grid $bx.4a.bl -column 2 -row 2
    5661    grid [label $bx.4a.redl -text "  generated by Red operator "] -column 0 -row 3
    57     eval tk_optionMenu $bx.4a.red DXTL(redarrow) $::DXTLcolorlist
     62    eval tk_optionMenu $bx.4a.red ::DXTL(redarrow) $::DXTLcolorlist
    5863    grid $bx.4a.red -column 2 -row 3
    5964    incr row
     
    7277    if {$app != ""} {
    7378        set show normal
    74         set DXTL(app) $appname
    75         set DXTL(launch) 1
     79        set ::DXTL(app) $appname
     80        set ::DXTL(launch) 1
    7681    } else {
    7782        set show disabled
    78         set DXTL(launch) 0
     83        set ::DXTL(launch) 0
    7984    }
    8085    grid [checkbutton $bx.l -text "Launch DRAWxtl" \
    81               -variable DXTL(launch) -state $show] \
     86              -variable ::DXTL(launch) -state $show] \
    8287        -row $row -column 1 -columnspan 5 -sticky w
    8388    incr row
     
    8893        incr row
    8994        grid [label $bx.c.${v}1 -text "${V} min:"] -column 1 -row $row
    90         grid [entry $bx.c.${v}2 -textvariable DXTL(${v}min) -width 4] -column 2 -row $row
    91         grid [scale $bx.c.${v}3 -resolution 0.1 -variable DXTL(${v}min) \
     95        grid [entry $bx.c.${v}2 -textvariable ::DXTL(${v}min) -width 4] -column 2 -row $row
     96        grid [scale $bx.c.${v}3 -resolution 0.1 -variable ::DXTL(${v}min) \
    9297                  -showvalue 0 -orient h -from -2 -to 1] -column 3 -row $row
    93         set DXTL(${v}min) -0.1
     98        set ::DXTL(${v}min) -0.1
    9499        grid [label $bx.c.${v}4 -text " max:"] -column 4 -row $row
    95         grid [entry $bx.c.${v}5 -textvariable DXTL(${v}max) -width 4] -column 5 -row $row
    96         grid [scale $bx.c.${v}6 -resolution 0.1 -variable DXTL(${v}max) \
     100        grid [entry $bx.c.${v}5 -textvariable ::DXTL(${v}max) -width 4] -column 5 -row $row
     101        grid [scale $bx.c.${v}6 -resolution 0.1 -variable ::DXTL(${v}max) \
    97102                  -showvalue 0 -orient h -from 0 -to 3] -column 6 -row $row
    98         set DXTL(${v}max) 1.1
     103        set ::DXTL(${v}max) 1.1
    99104    }
    100105    # atom type box
    101106    grid [frame $bx.s -relief groove -bd 4] -row $row -column 0 -columnspan 5 -sticky nsew
     107    grid rowconfigure $bx $row -weight 1
    102108    grid [label $bx.s.0 -text "Atom representation" \
    103109              -anchor w] -row 0 -column 0 -sticky w
     
    106112              -yscrollcommand "$bx.s.scroll set" ] \
    107113        -column 0 -row [incr row] -sticky nsew
     114    grid rowconfigure $bx.s $row -weight 1
    108115    grid columnconfig $bx.s 0 -weight 1
    109     frame [set DXTL(lb) $bx.s.canvas.fr]
    110     $bx.s.canvas create window 0 0 -anchor nw -window $DXTL(lb)
     116    frame [set ::DXTL(lb) $bx.s.canvas.fr]
     117    $bx.s.canvas create window 0 0 -anchor nw -window $::DXTL(lb)
    111118    grid [scrollbar $bx.s.scroll \
    112119              -command "$bx.s.canvas yview"] -sticky ns -row $row -column 1
     
    114121    incr row
    115122    grid [frame $bx.b -relief groove -bd 4] -row $row -column 0 -columnspan 5 -sticky ew
     123    grid rowconfigure $bx $row -weight 1
    116124    grid [frame $bx.b.0] -row 0 -column 0 -columnspan 7 -sticky ew
    117125    grid [label $bx.b.0.1 -text "Bond List" \
     
    124132              -yscrollcommand "$bx.b.scroll set" ] \
    125133        -column 0 -row [incr row] -sticky nsew
     134    grid rowconfigure $bx.b $row -weight 1
    126135    grid columnconfig $bx.b 0 -weight 1
    127     frame [set DXTL(Blst) $bx.b.canvas.fr]
    128     $bx.b.canvas create window 0 0 -anchor nw -window $DXTL(Blst)
     136    frame [set ::DXTL(Blst) $bx.b.canvas.fr]
     137    $bx.b.canvas create window 0 0 -anchor nw -window $::DXTL(Blst)
    129138    grid [scrollbar $bx.b.scroll \
    130139              -command "$bx.b.canvas yview"] -sticky ns -row $row -column 1
     
    132141    incr row
    133142    grid [frame $bx.f -relief groove -bd 4] -row $row -column 0 -columnspan 5 -sticky nsew
    134     grid [label $bx.f.0 -text "Fourier display" \
     143    grid [frame $bx.f.0] -column 0 -columnspan 3 -row 0 -sticky news
     144    grid columnconfig $bx.f.0 0 -weight 1
     145    grid [label $bx.f.0.l1 -text "Fourier display" \
    135146              -anchor w] -row 0 -column 0 -sticky w
    136     grid [frame $bx.f.1] -column 0 -row 1 -sticky news
    137     grid [frame $bx.f.2] -column 0 -row 2 -sticky news
     147    set ::DXTL(FourierRange) "Range: unknown"
     148    grid [label $bx.f.0.l2 -textvariable ::DXTL(FourierRange) \
     149              -anchor w] -row 0 -column 1 -sticky e
     150    grid [frame $bx.f.1] -column 0 -columnspan 3 -row 1 -sticky news
     151    grid [frame $bx.f.2] -column 0 -columnspan 3 -row 2 -sticky news
    138152    grid [canvas $bx.f.canvas -relief sunk -bd 2 \
    139153              -scrollregion {0 0 5000 500} -width 250 -height 70 \
    140154              -yscrollcommand "$bx.f.scroll set" ] \
    141155        -column 0 -row 3 -sticky nsew
     156    grid rowconfigure $bx $row -weight 1
     157    grid rowconfigure $bx.f 3 -weight 1
    142158    grid columnconfig $bx.f 0 -weight 1
    143     frame [set DXTL(fb) $bx.f.canvas.fr]
    144     $bx.f.canvas create window 0 0 -anchor nw -window $DXTL(fb)
     159    frame [set ::DXTL(fb) $bx.f.canvas.fr]
     160    $bx.f.canvas create window 0 0 -anchor nw -window $::DXTL(fb)
    145161    grid [scrollbar $bx.f.scroll \
    146               -command "$bx.f.canvas yview"] -sticky ns -row 3 -column 1
     162              -command "$bx.f.canvas yview"] -sticky ns -row 3 -column 2
    147163    grid [button $bx.f.1.1 -text "Setup\nFourier" \
    148164              -command EditFourier] -column 0 -row 0
    149     grid [button [set DXTL(FourCompute) $bx.f.1.2] -text "Compute\nFourier" \
     165    grid [button [set ::DXTL(FourCompute) $bx.f.1.2] -text "Compute\nFourier" \
    150166              -command {DXTLwritegrd $expgui(export_phase)}] -column 1 -row 0
    151167    grid [label $bx.f.1.3 -text "Select\nMap"] -column 3 -row 0
    152     set DXTL(fmenu) [tk_optionMenu $bx.f.1.4 DXTL(mtype) test]
     168    set ::DXTL(fmenu) [tk_optionMenu $bx.f.1.4 ::DXTL(mtype) test]
    153169    grid $bx.f.1.4 -column 4 -row 0
    154     grid [button [set DXTL(AddContour) $bx.f.1.5] -text "Add\nContour" \
     170    grid [button [set ::DXTL(AddContour) $bx.f.1.5] -text "Add\nContour" \
    155171              -command AddContour] -column 5 -row 0
    156     SetupFourierButtons
    157 return
     172    grid [frame $bx.f.1.f] -column 0 -columnspan 9 -row 1
     173    grid [label $bx.f.1.f.0 -text "display\nlimits"] -column 0 -row 0
     174    set col 0
     175    foreach a {X Y Z} {
     176        incr col
     177        grid [label $bx.f.1.f.$col -text $a] -column $col -row 0
     178        incr col
     179        grid [entry $bx.f.1.f.$col -textvariable ::DXTL(${a}dispMin) \
     180                  -width 6] -column $col -row 0
     181        incr col
     182        grid [entry $bx.f.1.f.$col -textvariable ::DXTL(${a}dispMax) \
     183                  -width 6] -column $col -row 0
     184    }
     185    set ::DXTL(contours) 0
     186    trace variable ::expgui(export_phase) w OnNewFourierPhase
     187    OnNewFourierPhase
     188#SetupFourierButtons
     189#return
     190    # this appears to be needed by OSX
     191    ResizeWin .export
    158192    # force the window to stay on top
    159193    putontop .export
    160     trace variable expgui(export_phase) w "SetDXTLatoms;SetupFourierButtons"
    161194    SetDXTLatoms
    162     # this appears to be needed by OSX
    163     ResizeWin .export
    164195
    165196    # Wait for the Write or Quit button to be pressed
     
    187218        # title info from GSAS title & phase title
    188219        puts $fp "REM  created by EXPGUI from $expgui(expfile) on [clock format [clock seconds]]"
    189         puts $fp "title \"$DXTL(title)\""
    190         puts $fp "pack $DXTL(xmin) $DXTL(xmax) $DXTL(ymin) $DXTL(ymax) $DXTL(zmin) $DXTL(zmax)"
     220        puts $fp "title \"$::DXTL(title)\""
     221        puts $fp "pack $::DXTL(xmin) $::DXTL(xmax) $::DXTL(ymin) $::DXTL(ymax) $::DXTL(zmin) $::DXTL(zmax)"
    191222        puts $fp "edges 0.02 Black"
    192223        puts $fp "phong 1.0 30."
    193224        foreach type [array names typelist] {
    194             if {$DXTL(display_$type) == "sphere"} {
    195                 puts $fp "sphere $type $DXTL(radius_$type) $DXTL(color_$type)"
    196             } elseif {$DXTL(display_$type) == "polyhedron"} {
    197                 puts $fp "polysz $type $DXTL(radius_$type) $DXTL(color_$type)"
    198             } elseif {$DXTL(display_$type) == "ellipsoid"} {
    199                 puts $fp "ellipcolor $type * $DXTL(color_$type)"
     225            if {$::DXTL(display_$type) == "sphere"} {
     226                puts $fp "sphere $type $::DXTL(radius_$type) $::DXTL(color_$type)"
     227            } elseif {$::DXTL(display_$type) == "polyhedron"} {
     228                puts $fp "polysz $type $::DXTL(radius_$type) $::DXTL(color_$type)"
     229            } elseif {$::DXTL(display_$type) == "ellipsoid"} {
     230                puts $fp "ellipcolor $type * $::DXTL(color_$type)"
    200231            }
    201232        }
    202         if {$DXTL(coords)} {
     233        if {$::DXTL(coords)} {
    203234            # write out cell parameters
    204235            puts -nonewline $fp "cell"
     
    230261            puts $fp "import gsas [file tail $expgui(expfile)] $phase"
    231262        }
    232         for {set i 1} {$i <= $DXTL(bonds)} {incr i} {
    233             puts $fp "bond $DXTL(ba_$i) $DXTL(bb_$i) $DXTL(bw_$i) $DXTL(bmin_$i) $DXTL(bmax_$i) $DXTL(bc_$i)"
     263        for {set i 1} {$i <= $::DXTL(bonds)} {incr i} {
     264            puts $fp "bond $::DXTL(ba_$i) $::DXTL(bb_$i) $::DXTL(bw_$i) $::DXTL(bmin_$i) $::DXTL(bmax_$i) $::DXTL(bc_$i)"
    234265        }
    235266        # list arrows, when requested
    236267        if {[lindex $expmap(phasetype) [expr {$phase - 1}]] != 1 && \
    237                 $DXTL(genarrows)} {
     268                $::DXTL(genarrows)} {
    238269            DXTLwriteArrows $fp $phase
    239270        }
    240         DXTLwriteFourierCommands
     271        DXTLwriteFourierCommands $fp
    241272        puts $fp "END"
    242273        close $fp
    243         if {$DXTL(launch)} {
    244             exec $DXTL(app) $filnam &
     274        if {$::DXTL(launch)} {
     275            exec $::DXTL(app) $filnam &
    245276        }
    246277    } errmsg] {
     
    251282                -message "File [file tail $filnam] was written"
    252283    }
    253     catch {unset DXTL}
     284    #catch {unset DXTL}
    254285    foreach t [trace vinfo expgui(export_phase)] {
    255286        eval trace vdelete expgui(export_phase) $t
     
    272303# add atoms to atom representation list
    273304proc SetDXTLatoms {args} {
    274     global DXTL expgui expmap
    275     eval destroy [winfo children $DXTL(lb)]
    276     eval destroy [winfo children $DXTL(Blst)]
    277     set DXTL(bonds) 0
     305    global expgui expmap
     306    eval destroy [winfo children $::DXTL(lb)]
     307    eval destroy [winfo children $::DXTL(Blst)]
     308    set ::DXTL(bonds) 0
    278309    if {$expgui(export_phase) == 0} {return}
    279310    set phase $expgui(export_phase)
     
    285316    }
    286317    if {[lindex $expmap(phasetype) [expr {$phase - 1}]] == 1} {
    287         set DXTL(genarrows) 0
    288         $DXTL(arrowbox) configure -state disabled
    289         grid forget $DXTL(arrowcolorbox)
     318        set ::DXTL(genarrows) 0
     319        $::DXTL(arrowbox) configure -state disabled
     320        grid forget $::DXTL(arrowcolorbox)
    290321    } else {
    291         set DXTL(genarrows) 1
    292         $DXTL(arrowbox) configure -state normal
    293         grid $DXTL(arrowcolorbox) -sticky ew -row $DXTL(arrowcolorbox_row) \
     322        set ::DXTL(genarrows) 1
     323        $::DXTL(arrowbox) configure -state normal
     324        grid $::DXTL(arrowcolorbox) -sticky ew -row $::DXTL(arrowcolorbox_row) \
    294325            -column 1 -columnspan 5
    295326    }
    296327    catch {unset typelist}
    297     set DXTL(title)  [phaseinfo $phase name]
     328    set ::DXTL(title)  [phaseinfo $phase name]
    298329    foreach atom $expmap(atomlist_$phase) {
    299330        set typelist([atominfo $phase $atom type]) 1
    300331    }
    301     set DXTL(typelist) [array names typelist]
     332    set ::DXTL(typelist) [array names typelist]
    302333    set row 0
    303     grid [label $DXTL(lb).l$row -text "type " -bg yellow\
     334    grid [label $::DXTL(lb).l$row -text "type " -bg yellow\
    304335             ] -column 0 -row $row  -sticky ew
    305     grid [label $DXTL(lb).d$row -text " representation " -bg yellow
     336    grid [label $::DXTL(lb).d$row -text " representation " -bg yellow
    306337         ] -column 1 -row $row -sticky ew
    307     grid [label $DXTL(lb).e$row -text " radius " -bg yellow\
     338    grid [label $::DXTL(lb).e$row -text " radius " -bg yellow\
    308339             ] -column 2 -row $row -sticky ew
    309     grid [label $DXTL(lb).c$row -text " color " -bg yellow\
     340    grid [label $::DXTL(lb).c$row -text " color " -bg yellow\
    310341             ] -column 3 -row $row -sticky ew
    311342    foreach type [array names typelist] {
    312343        incr row
    313         grid [label $DXTL(lb).l$row -text $type] -column 0 -row $row
    314         tk_optionMenu $DXTL(lb).d$row DXTL(display_$type) sphere polyhedron ellipsoid none
    315         grid $DXTL(lb).d$row -column 1 -row $row
    316         grid [entry $DXTL(lb).e$row -textvariable DXTL(radius_$type) \
     344        grid [label $::DXTL(lb).l$row -text $type] -column 0 -row $row
     345        tk_optionMenu $::DXTL(lb).d$row ::DXTL(display_$type) sphere polyhedron ellipsoid none
     346        grid $::DXTL(lb).d$row -column 1 -row $row
     347        grid [entry $::DXTL(lb).e$row -textvariable ::DXTL(radius_$type) \
    317348                -width 5] -column 2 -row $row
    318         eval tk_optionMenu $DXTL(lb).c$row DXTL(color_$type) $::DXTLcolorlist
    319         grid $DXTL(lb).c$row -column 3 -row $row
    320         set DXTL(display_$type) sphere
    321         set DXTL(radius_$type) 0.2
    322         set DXTL(color_$type) [lindex $::DXTLcolorlist $row]
    323     }
     349        eval tk_optionMenu $::DXTL(lb).c$row ::DXTL(color_$type) $::DXTLcolorlist
     350        grid $::DXTL(lb).c$row -column 3 -row $row
     351        set ::DXTL(display_$type) sphere
     352        set ::DXTL(radius_$type) 0.2
     353        set ::DXTL(color_$type) [lindex $::DXTLcolorlist $row]
     354    }
     355    # Resize the list
     356    update idletasks
     357    foreach i {lb Blst fb} {
     358        set sizes [grid bbox $::DXTL($i)]
     359        [winfo parent $::DXTL($i)] config -scrollregion $sizes  \
     360            -width [lindex $sizes 2]
     361    }
     362    wm geom [winfo toplevel $::DXTL(Blst)] {}
     363}
     364
     365# add bonds to bond list
     366proc DXTLaddBond {} {
     367    if {$::DXTL(bonds) == 0} {
     368        # insert header
     369        set row 0
     370        grid [label $::DXTL(Blst).a$row -text "from " -bg yellow\
     371                 ] -column 1 -row $row  -sticky ew
     372        grid [label $::DXTL(Blst).b$row -text " to " -bg yellow\
     373                 ] -column 2 -row $row  -sticky ew
     374        grid [label $::DXTL(Blst).c$row -text " width " -bg yellow\
     375                 ] -column 3 -row $row  -sticky ew
     376        grid [label $::DXTL(Blst).d$row -text " min " -bg yellow\
     377             ] -column 4 -row $row  -sticky ew
     378        grid [label $::DXTL(Blst).e$row -text " max " -bg yellow\
     379                 ] -column 5 -row $row  -sticky ew
     380        grid [label $::DXTL(Blst).f$row -text " color " -bg yellow\
     381                 ] -column 6 -row $row  -sticky ew
     382    }
     383    set row [incr ::DXTL(bonds)]
     384    eval tk_optionMenu $::DXTL(Blst).ta$row ::DXTL(ba_$row) $::DXTL(typelist)
     385    grid $::DXTL(Blst).ta$row -column 1 -row $row
     386    eval tk_optionMenu $::DXTL(Blst).tb$row ::DXTL(bb_$row) $::DXTL(typelist)
     387    grid $::DXTL(Blst).tb$row -column 2 -row $row
     388    grid [entry $::DXTL(Blst).w$row -textvariable ::DXTL(bw_$row) \
     389              -width 5] -column 3 -row $row
     390    grid [entry $::DXTL(Blst).mi$row -textvariable ::DXTL(bmin_$row) \
     391              -width 5] -column 4 -row $row
     392    grid [entry $::DXTL(Blst).mx$row -textvariable ::DXTL(bmax_$row) \
     393              -width 5] -column 5 -row $row
     394    eval tk_optionMenu $::DXTL(Blst).c$row ::DXTL(bc_$row) $::DXTLcolorlist
     395    grid $::DXTL(Blst).c$row -column 6 -row $row
     396    set ::DXTL(bw_$row) 0.02
     397    set ::DXTL(bmin_$row) 1.0
     398    set ::DXTL(bmax_$row) 2.0
     399    set ::DXTL(bc_$row) [lindex $::DXTLcolorlist $row]
    324400    # Resize the list
    325401    update
    326     set sizes [grid bbox $DXTL(lb)]
    327     [winfo parent $DXTL(lb)] config -scrollregion $sizes \
     402    set sizes [grid bbox $::DXTL(Blst)]
     403    [winfo parent $::DXTL(Blst)] config -scrollregion $sizes \
    328404        -width [lindex $sizes 2]
    329     set sizes [grid bbox $DXTL(Blst)]
    330     [winfo parent $DXTL(Blst)] config -scrollregion $sizes \
    331         -width [lindex $sizes 2]
    332     wm geom [winfo toplevel $DXTL(Blst)] {}
    333 }
    334 
    335 # add bonds to bond list
    336 proc DXTLaddBond {} {
    337     global DXTL
    338     if {$DXTL(bonds) == 0} {
    339         # insert header
    340         set row 0
    341         grid [label $DXTL(Blst).a$row -text "from " -bg yellow\
    342                  ] -column 1 -row $row  -sticky ew
    343         grid [label $DXTL(Blst).b$row -text " to " -bg yellow\
    344                  ] -column 2 -row $row  -sticky ew
    345         grid [label $DXTL(Blst).c$row -text " width " -bg yellow\
    346                  ] -column 3 -row $row  -sticky ew
    347         grid [label $DXTL(Blst).d$row -text " min " -bg yellow\
    348              ] -column 4 -row $row  -sticky ew
    349         grid [label $DXTL(Blst).e$row -text " max " -bg yellow\
    350                  ] -column 5 -row $row  -sticky ew
    351         grid [label $DXTL(Blst).f$row -text " color " -bg yellow\
    352                  ] -column 6 -row $row  -sticky ew
    353     }
    354     set row [incr DXTL(bonds)]
    355     eval tk_optionMenu $DXTL(Blst).ta$row DXTL(ba_$row) $DXTL(typelist)
    356     grid $DXTL(Blst).ta$row -column 1 -row $row
    357     eval tk_optionMenu $DXTL(Blst).tb$row DXTL(bb_$row) $DXTL(typelist)
    358     grid $DXTL(Blst).tb$row -column 2 -row $row
    359     grid [entry $DXTL(Blst).w$row -textvariable DXTL(bw_$row) \
    360               -width 5] -column 3 -row $row
    361     grid [entry $DXTL(Blst).mi$row -textvariable DXTL(bmin_$row) \
    362               -width 5] -column 4 -row $row
    363     grid [entry $DXTL(Blst).mx$row -textvariable DXTL(bmax_$row) \
    364               -width 5] -column 5 -row $row
    365     eval tk_optionMenu $DXTL(Blst).c$row DXTL(bc_$row) $::DXTLcolorlist
    366     grid $DXTL(Blst).c$row -column 6 -row $row
    367     set DXTL(bw_$row) 0.02
    368     set DXTL(bmin_$row) 1.0
    369     set DXTL(bmax_$row) 2.0
    370     set DXTL(bc_$row) [lindex $::DXTLcolorlist $row]
    371     # Resize the list
    372     update
    373     set sizes [grid bbox $DXTL(Blst)]
    374     [winfo parent $DXTL(Blst)] config -scrollregion $sizes \
    375         -width [lindex $sizes 2]
     405    #set can [winfo parent $::DXTL($i)]
     406    #set scroll [winfo parent $can].scroll
     407    #[winfo parent $::DXTL($i)] config -scrollregion $sizes
    376408}
    377409
    378410proc DXTLwriteArrows {out phase} {
    379     global expgui expmap DXTL
     411    global expgui expmap
    380412    set fp [open geom.in w]
    381413    puts $fp "N"
     
    423455                puts $out "rem spin for atom $name # $k ($spin)"
    424456                if {$spin == "Red"} {
    425                     puts $out "arrow $pos     $vec    1. 0.15 $DXTL(redarrow)"
     457                    puts $out "arrow $pos     $vec    1. 0.15 $::DXTL(redarrow)"
    426458                } else {
    427                     puts $out "arrow $pos     $vec    1. 0.15 $DXTL(blackarrow)"
     459                    puts $out "arrow $pos     $vec    1. 0.15 $::DXTL(blackarrow)"
    428460                }
    429461            } elseif {$i == 6} {
     
    440472#   returns a list of Fourier map types
    441473proc DXTLwritegrd {phase} {
    442     global expgui expmap DXTL
     474    global expgui expmap
    443475    set lst [listFourier]
    444     if {$lst < 1} {
     476    if {[llength $lst] < 1} {
    445477        MyMessageBox -parent . -title "No Fourier" \
    446478            -message "You have not set up to compute a Fourier map." \
     
    481513    }
    482514    set fp [open f.in w]
    483     if {[llength $typelist] > 1} {
     515    if {[OutputFourierType]} {
    484516        puts $fp [lindex $typelist 0]
    485517    }
     
    502534        set deleteerror 1
    503535    }
     536    # Save the current exp file
     537    savearchiveexp
     538    # disable the file changed monitor
     539    set expgui(expModifiedLast) 0
    504540    catch {
    505541        exec $fourier [file root $expgui(expfile)] >& f.out
    506542        exec $map [file root $expgui(expfile)] < f.in >>& f.out
    507543    }
     544    # reset the file changed monitor
     545    #loadexp $expgui(expfile)
     546    set expgui(expModifiedLast) [file mtime $expgui(expfile)]
     547
    508548    if {[llength [glob -nocomplain "[file root $expgui(expfile)]*.grd"]] == 0} {
    509549        set fp [open f.out r]
     
    520560        catch {close $fp}
    521561        catch {file delete -force f.in f.out}
     562        SetupFourierButtons
    522563        return $typelist
    523564    }
    524565}
    525566
     567# called when the phase # is set or changed
     568# clean up old Fourier maps
     569proc OnNewFourierPhase {args} {
     570    SetDXTLatoms
     571    if {[llength $::expmap(phaselist)] > 1} {
     572        # there is more than one phase; delete any .grd files to make sure
     573        # generate ones for the current phase
     574        foreach f [glob -nocomplain "[file root $::expgui(expfile)]*.grd"] {
     575            catch {file delete -force $f}
     576        }
     577    }
     578    SetupFourierButtons
     579    eval destroy [winfo children $::DXTL(fb)]
     580    set ::DXTL(contours) 0
     581}
     582
     583# this enables/disables Fourier buttons based on the Fourier setup
     584# and the files that are present
    526585proc SetupFourierButtons {} {
    527586    set phase $::expgui(export_phase)
     
    531590    set ::DXTL(mtype) ""
    532591    set ::DXTL(mfil) ""
     592    set ::DXTL(FourierRange) ""
    533593    # if the Fourier is not set up; return here
    534     if {[listFourier] < 1} return
     594    if {[llength [set nF [listFourier]]] < 1} return
     595    # check that all phases are set to current phase
     596    foreach i $nF {
     597        set ph [Fourierinfo $i phase]
     598        if {$ph != $phase} return
     599    }
    535600    if {[llength [FourierHists $phase]] < 1} return
    536601    # make sure we have default limits
    537602    getFourierLimits $phase
    538603    $::DXTL(FourCompute) config -state normal
    539     # if there are no maps, return here
     604    # if there are no maps, return now
    540605    set maps [glob -nocomplain "[file root $::expgui(expfile)]*.grd"]
    541606    if {[llength $maps] < 1} return
     
    544609        lappend types [lindex [split [file root [file tail $fil]] "_"] end]
    545610    }
    546     $::DXTL(AddContour) config -state normal
    547611    set i 0
    548612    foreach fil $maps lbl $types {
    549         if {$i == 1} {$::DXTL(fmenu) invoke 0}
     613        $::DXTL(fmenu) add command -label $lbl \
     614            -command "set DXTL(mtype) $lbl; set DXTL(mfil) $fil; GetFourierRange"
     615        if {$i == 0} {
     616            $::DXTL(fmenu) invoke 0
     617            $::DXTL(AddContour) config -state normal
     618        }
    550619        incr i
    551         $::DXTL(fmenu) add command -label $lbl \
    552             -command "set DXTL(mtype) $lbl; set DXTL(mfil) $fil"
    553620    }
    554621}
    555622
    556623proc EditFourier {} {
    557     error
     624    set phase $::expgui(export_phase)
     625    # check that all Fourier records are set to the current phase
     626    foreach i [listFourier] {
     627        set ph [Fourierinfo $i phase]
     628        if {$ph != $phase} {Fourierinfo $i phase set $phase}
     629    }
     630    # for now we will not offer access to section, (dmin, dmax not supported)
     631    set typelist {}
     632    foreach i [listFourier] {
     633        lappend typelist [Fourierinfo $i type]
     634    }
     635    set histlist [FourierHists $phase]
     636    set limits  [getFourierLimits $phase]
     637    set box .export.fourier
     638    catch {destroy $box}
     639    toplevel $box
     640    grid [frame $box.1] -row 1 -column 1 -rowspan 10
     641    grid [frame $box.2] -row 1 -column 2 -rowspan 10
     642    grid [frame $box.b] -sticky news -row 11 -column 1 -columnspan 2
     643    grid columnconfigure $box.b 0 -weight 1
     644    grid columnconfigure $box.b 3 -weight 1
     645    grid [button $box.b.1 -text Continue \
     646              -command "set ::DXTL(quit) 0; destroy $box" \
     647             ] -row 1 -column 1
     648    grid [button $box.b.2 -text Quit \
     649              -command "set ::DXTL(quit) 1; destroy $box" \
     650             ] -row 1 -column 2
     651   
     652    # map type selection
     653    set row 0
     654    grid [label $box.1.$row -text "Select map type(s)"] -column 1 -row $row
     655    foreach typ {DELF FCLC FOBS 2FDF 3FDF 4FDF PTSN DPTS} lbl {
     656        "Difference Fourier" "Fcalc Fourier" "Fobs Fourier"
     657        "2*Fo-Fc Fourier" "3*Fo-2*Fc Fourier" "4*Fo-3*Fc Fourier" "Patterson map" "Delta-F Patterson"\
     658        } {
     659            incr row
     660            grid [ \
     661                       checkbutton $box.1.$row -variable ::DXTL($typ) \
     662                       -text "$lbl ($typ)" \
     663                      ] -column 1 -row $row -sticky w
     664            if {[lsearch $typelist $typ] == -1} {
     665                set ::DXTL($typ) 0
     666            } else {
     667                set ::DXTL($typ) 1
     668            }
     669        }
     670    grid [label $box.2.a1 -text "Histogram(s) to be used\n(last superceeds)"] -column 1 -row 1
     671    grid [entry $box.2.a2 -textvariable ::DXTL(histlist) -width 20] -column 2 -row 1 -columnspan 3
     672    set ::DXTL(histlist) $histlist
     673    grid [label $box.2.m1 -text min] -column 2 -row 2
     674    grid [label $box.2.m2 -text max] -column 3 -row 2
     675    grid [label $box.2.m3 -text "map step\n(A)"] -column 4 -row 2
     676    set row 3
     677    foreach axis {X Y Z} lim [lrange $limits 1 end] step [lindex $limits 0] {
     678        incr row
     679        grid [label $box.2.0$axis -text "$axis limits"] -column 1 -row $row -sticky e
     680        grid [entry $box.2.min$axis -width 10 -textvariable ::DXTL(min$axis)] -column 2 -row $row
     681        grid [entry $box.2.max$axis -width 10 -textvariable ::DXTL(max$axis)] -column 3 -row $row
     682        grid [entry $box.2.step$axis -width 10 -textvariable ::DXTL(step$axis)] -column 4 -row $row
     683        set ::DXTL(min$axis) [lindex $lim 0]
     684        set ::DXTL(max$axis) [lindex $lim 1]
     685        set ::DXTL(step$axis) [format "%.4f" [expr {$step + 0.0001}]]
     686    }
     687    putontop $box
     688    tkwait window $box
     689    afterputontop
     690    if $::DXTL(quit) return
     691    delFourier
     692    foreach typ {DELF FCLC FOBS 2FDF 3FDF 4FDF PTSN DPTS} {
     693        if {$::DXTL($typ)} {
     694            addFourier $phase $typ
     695        }
     696    }
     697    FourierHists $phase set $::DXTL(histlist)
     698    setFourierLimits $phase \
     699        [list $::DXTL(stepX) $::DXTL(stepY) $::DXTL(stepZ)] \
     700        [list $::DXTL(minX) $::DXTL(maxX)] \
     701        [list $::DXTL(minY) $::DXTL(maxY)] \
     702        [list $::DXTL(minZ) $::DXTL(maxZ)]
     703    SetupFourierButtons
     704    incr ::expgui(changed)
    558705}
    559706
    560707proc AddContour {} {
    561     global DXTL
    562     # if {$DXTL(bonds) == 0} {
    563     #     # insert header
    564     #     set row 0
    565     #     grid [label $DXTL(Blst).a$row -text "from " -bg yellow\
    566     #            ] -column 1 -row $row  -sticky ew
    567     #     grid [label $DXTL(Blst).b$row -text " to " -bg yellow\
    568     #            ] -column 2 -row $row  -sticky ew
    569     #     grid [label $DXTL(Blst).c$row -text " width " -bg yellow\
    570     #            ] -column 3 -row $row  -sticky ew
    571     #     grid [label $DXTL(Blst).d$row -text " min " -bg yellow\
    572     #          ] -column 4 -row $row  -sticky ew
    573     #     grid [label $DXTL(Blst).e$row -text " max " -bg yellow\
    574     #            ] -column 5 -row $row  -sticky ew
    575     #     grid [label $DXTL(Blst).f$row -text " color " -bg yellow\
    576     #            ] -column 6 -row $row  -sticky ew
    577     # }
    578     # set row [incr DXTL(bonds)]
    579     # eval tk_optionMenu $DXTL(Blst).ta$row DXTL(ba_$row) $DXTL(typelist)
    580     # grid $DXTL(Blst).ta$row -column 1 -row $row
    581     # eval tk_optionMenu $DXTL(Blst).tb$row DXTL(bb_$row) $DXTL(typelist)
    582     # grid $DXTL(Blst).tb$row -column 2 -row $row
    583     # grid [entry $DXTL(Blst).w$row -textvariable DXTL(bw_$row) \
    584     #           -width 5] -column 3 -row $row
    585     # grid [entry $DXTL(Blst).mi$row -textvariable DXTL(bmin_$row) \
    586     #           -width 5] -column 4 -row $row
    587     # grid [entry $DXTL(Blst).mx$row -textvariable DXTL(bmax_$row) \
    588     #           -width 5] -column 5 -row $row
    589     # eval tk_optionMenu $DXTL(Blst).c$row DXTL(bc_$row) $::DXTLcolorlist
    590     # grid $DXTL(Blst).c$row -column 6 -row $row
    591     # set DXTL(bw_$row) 0.02
    592     # set DXTL(bmin_$row) 1.0
    593     # set DXTL(bmax_$row) 2.0
    594     # set DXTL(bc_$row) [lindex $::DXTLcolorlist $row]
    595     # # Resize the list
    596     # update
    597     # set sizes [grid bbox $DXTL(Blst)]
    598     # [winfo parent $DXTL(Blst)] config -scrollregion $sizes \
    599     #     -width [lindex $sizes 2]
    600     error
    601 }
    602 
    603 proc DXTLwriteFourierCommands {} {
    604     error
    605     #mapread grd 10CO_DELF.grd 4
    606     #mapcontour  2.000 mesh Green
    607     #mapcontour  2.500 solid Blue
    608 }
     708    # set a header
     709    if {$::DXTL(contours) == 0} {
     710        set row 0
     711        grid [label $::DXTL(fb).a$row -text "Type" -bg yellow \
     712                 ] -column 1 -row $row  -sticky ew
     713        grid [label $::DXTL(fb).b$row -text "Contour Level" -bg yellow \
     714                 ] -column 2 -row $row  -sticky ew
     715        grid [label $::DXTL(fb).c$row -text "Color" -bg yellow \
     716                 -anchor center] -column 3 -row $row  -sticky ew
     717    }
     718    set row [incr ::DXTL(contours)]
     719    eval tk_optionMenu $::DXTL(fb).ta$row ::DXTL(fb_type_$row) {mesh solid}
     720    grid $::DXTL(fb).ta$row -column 1 -row $row
     721    grid [entry $::DXTL(fb).w$row -width 10 -textvariable ::DXTL(fb_val_$row) \
     722         ] -column 2 -row $row
     723    set menu [eval tk_optionMenu $::DXTL(fb).tb$row \
     724                  ::DXTL(fb_color_$row) $::DXTLcolorlist]
     725    $menu invoke $row
     726    grid $::DXTL(fb).tb$row -column 3 -row $row
     727    grid [button $::DXTL(fb).del$row -text "Delete"\
     728             -command "DeleteFourierContour $row"] -column 4 -row $row
     729    update idletasks
     730    set sizes [grid bbox $::DXTL(fb)]
     731    [winfo parent $::DXTL(fb)] config -scrollregion $sizes \
     732        -width [lindex $sizes 2]
     733}
     734
     735proc DeleteFourierContour {row} {
     736    foreach i "$::DXTL(fb).ta$row $::DXTL(fb).w$row $::DXTL(fb).tb$row \
     737$::DXTL(fb).tb$row $::DXTL(fb).del$row" {
     738        catch {destroy $i}
     739    }
     740    set ::DXTL(fb_val_$i) ""
     741    if {$::DXTL(contours) == $row} {incr ::DXTL(contours) -1}
     742}
     743
     744proc GetFourierRange {} {
     745    set fp [open f.in w]
     746    set lst [listFourier]
     747    if {[llength $lst] < 1} {
     748        MyMessageBox -parent . -title "No Fourier" \
     749            -message "You have not set up to compute a Fourier map." \
     750            -icon warning
     751        return
     752    }
     753    set typelist {}
     754    foreach l $lst {
     755        lappend typelist [Fourierinfo $l type]
     756    }
     757    if {[OutputFourierType]} {
     758        puts $fp $::DXTL(mtype)
     759    }
     760    close $fp
     761    if {$::tcl_platform(platform) == "windows"} {
     762        set map [file join $::expgui(gsasexe) forsrh.exe]
     763    } else {
     764        set map [file join $::expgui(gsasexe) forsrh]
     765    }
     766    catch {
     767        exec $map [file root $::expgui(expfile)] < f.in >& f.out
     768    }
     769    foreach {min max} {{} {}} {}
     770    catch {
     771        set fp [open "f.out" r]       
     772        while {[gets $fp line] >= 0} {
     773            if {[string first "range of map values" $line] != -1} {
     774                set off [expr 4 + [string first " is " $line]]
     775                foreach {min to max} [string trim [string range $line $off end]] {}
     776                break
     777            }
     778        }
     779    }
     780    catch {
     781        close $fp
     782    }
     783    if {$min != ""} {set ::DXTL(FourierRange) "Range: $min to $max"}
     784}
     785
     786# is output of the current Fourier map type required as input to a program?
     787# answer is yes when more than one map file is present
     788proc OutputFourierType {} {
     789    set i 0
     790    foreach ext {DEL FCL FOB PTS DPT} {
     791        if {[file exists [file root $::expgui(expfile)].$ext]} {
     792            incr i
     793        }
     794        for {set i 2} {$i <= 9} {incr i} {
     795            if {[file exists [file root $::expgui(expfile)].${i}FD]} {
     796                incr i
     797            }
     798        }
     799    }
     800    if {$i > 1} {
     801        return 1
     802    }
     803    return 0
     804}
     805
     806proc DXTLwriteFourierCommands {fp} {
     807    if {$::DXTL(mfil) == ""} return
     808    if {![file exists $::DXTL(mfil)]} {
     809        puts "file not found $::DXTL(mfil)"
     810        return
     811    }
     812    set cntlist {}
     813    for {set i 1} {$i <= $::DXTL(contours)} {incr i} {
     814        set val ""
     815        catch {set val $::DXTL(fb_val_$i)}
     816        if {[catch {set val [expr 1.*$val]}]} continue
     817        lappend cntlist [list $val $::DXTL(fb_type_$i) $::DXTL(fb_color_$i)]       }
     818    if {[llength $cntlist] <= 0} return
     819    puts $fp "mapread grd [file tail $::DXTL(mfil)] 4"
     820    foreach item $cntlist {
     821        puts $fp "mapcontour $item"
     822    }
     823    set s {}
     824    foreach a {X Y Z} {
     825        lappend s $::DXTL(${a}dispMin)
     826        lappend s $::DXTL(${a}dispMax)
     827    }
     828    puts $fp "mapregion $s"
     829}
  • branches/sandbox/readexp.tcl

    r1215 r1220  
    47504750# read a Fourier map entry
    47514751# returns five values:
    4752 #   0: type of map (DELF,FCLC,FOBS,NFDF,PTSN,DPTS)
     4752#   0: type of map (DELF,FCLC,FOBS,*FDF,PTSN,DPTS)
    47534753#   1: section (X,Y or Z)
    47544754#   2: phase (1-9)
     
    47614761    }
    47624762    set vals {}
    4763     # 0: type of map (DELF,FCLC,FOBS,NFDF,PTSN,DPTS)
     4763    # 0: type of map (DELF,FCLC,FOBS,[2-9]FDF,PTSN,DPTS)
    47644764    lappend vals [string trim [string range [readexp $key] 2 6]]
    47654765    # 1: section (X,Y or Z)
     
    47774777#   arguments:
    47784778#      phase: (1-9)
    4779 #      type: type of map (DELF,FCLC,FOBS,NFDF,PTSN,DPTS) - default DELF
     4779#      type: type of map (DELF,FCLC,FOBS,*FDF,PTSN,DPTS) - default DELF
    47804780#      section: (X,Y or Z) - default Z
    47814781#   returns the number of the map that is added
     
    48004800}
    48014801
     4802# delete all Fourier map computations
     4803proc delFourier {} {
     4804    foreach i {1 2 3 4 5 6 7 8 9} {
     4805        set key "  FOUR CDAT$i"
     4806        delexp $key
     4807    }
     4808}
     4809
    48024810# read/set a Fourier computation value
    48034811# use: Fourierinfo num parm
     
    48064814#  num is the Fourier entry
    48074815#  parm is one of the following
    4808 #     type    -- type of map (DELF,FCLC,FOBS,NFDF,PTSN,DPTS)
     4816#     type    -- type of map (DELF,FCLC,FOBS,*FDF,PTSN,DPTS)
    48094817#     section -- last running map direction (X,Y or Z)
    48104818#     phase   -- phase (1-9)
     
    48194827    switch -glob ${parm}-$action {
    48204828        type-get {
    4821             # type of map (DELF,FCLC,FOBS,NFDF,PTSN,DPTS)
     4829            # type of map (DELF,FCLC,FOBS,*FDF,PTSN,DPTS)
    48224830            return [string trim [string range [readexp $key] 2 6]]
    48234831        }
    48244832        type-set {
    48254833            set found 0
    4826             foreach val {DELF FCLC FOBS NFDF PTSN DPTS} {
     4834            foreach val {DELF FCLC FOBS 2FDF 3FDF 4FDF 5FDF 6FDF 7FDF 8FDF 9FDF PTSN DPTS} {
    48274835                if {$val == $value} {
    48284836                    set found 1
     
    49354943    }
    49364944    set steps {}
    4937     foreach v {x y z} {
    4938         set range_$v {}
    4939         lappend steps [expr {[set cell_$v] / [set step_$v]}]
    4940         lappend range_$v [expr {[set min_$v] * 1. / [set step_$v] }]
    4941         lappend range_$v [expr {[set max_$v] * 1. / [set step_$v] }]
    4942     }
    4943     return [list $steps $range_x $range_y $range_z]
     4945    if {[catch {
     4946        foreach v {x y z} {
     4947            set range_$v {}
     4948            lappend steps [expr {[set cell_$v] / [set step_$v]}]
     4949            lappend range_$v [expr {[set min_$v] * 1. / [set step_$v] }]
     4950            lappend range_$v [expr {[set max_$v] * 1. / [set step_$v] }]
     4951        }
     4952    }]} {
     4953        return [list {.2 .2 .2} {0 1} {0 1} {0 1}]
     4954    } else {
     4955        return [list $steps $range_x $range_y $range_z]
     4956    }
    49444957}
    49454958
Note: See TracChangeset for help on using the changeset viewer.