Changeset 539


Ignore:
Timestamp:
Dec 4, 2009 5:07:52 PM (13 years ago)
Author:
toby
Message:

# on 2002/01/22 22:29:18, toby did:
Significant change in display of atoms on phase panel:

changing an atom queues an update for that atom only
using new routine UpdateAtomLine?
avoid duplicate refresh (killer for big lists)

Display atoms in MM phases
Add a Export coordinates menu cascade that gets built

when used rather than every time the software is loaded (better speed)

new routines: FormatAtomLine? & UpdateAtomLine? so that only 1

atom can be updated at a time

CompressList? now divides up the list with <CR> if a maximum

length is supplied

Remove AddAtoms? & ReplacePhase? buttons for MM phases (not supported)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    • Property rcs:date changed from 2001/12/16 20:13:10 to 2002/01/22 22:29:18
    • Property rcs:lines changed from +3 -2 to +340 -106
    • Property rcs:rev changed from 1.53 to 1.54
    r500 r539  
    2525#   blank cell entries
    2626#   add phase to atom number in listing
    27 #   DisplayAllAtoms needs to loop over phases: expgui(curPhase)
     27#   DisplayAllAtoms needs to loop over phases
    2828#
    2929# idea: load more than one bank from a multi-bank .RAW file
     
    4343if {$argv != ""} {
    4444    if {[string match *noshell* [string tolower $argv]]} {
    45         puts noshell
     45        #puts noshell
    4646        set expgui(shell) 0
    4747        set expgui(expfile) [lindex $argv 1]
     
    332332    wm iconname . [file tail $expfile]
    333333
     334    # reset the phase buttons
     335    set expgui(curPhase) ""
    334336    # set the number of phases on the phase page
    335337    setphases
     
    456458    loadexp $expgui(expfile)
    457459
    458     # select the 1st phase
    459     SelectOnePhase [lindex $expmap(phaselist) 0]
     460    # reset the phase selection
     461    set expgui(curPhase) {}
     462
    460463    # select the first histogram in the list by default (if there are any)
    461464    if {[llength $expmap(histlistboxcontents)] > 0} {
     
    488491                catch {$entrybox($elem) config -fg black}
    489492            }
    490             if {[lindex $entrycmd($elem) 0] == "atominfo"} {
    491                 after idle {DisplayAllAtoms noreset}
     493            if {[string match "*atominfo" [lindex $entrycmd($elem) 0]]} {
     494                after idle "UpdateAtomLine \
     495                        [list [lindex $entrycmd($elem) 2]] \
     496                        [lindex $entrycmd($elem) 1]"
    492497            }
    493498        } errmsg] {error $errmsg}       
     
    559564LAUR 86-748 (2000)." \
    560565        info 0 OK
     566}
     567
     568# this proc gets called when the export coordinate button is pressed
     569# it loads export
     570proc BuildCoordExpMenu {menu} {
     571    global expgui_cmdlist expgui
     572    # do this only once
     573    $menu config -postcommand {}
     574    $menu delete 1 end
     575    # add the cif export routine
     576    set cmd gsas2cif
     577    set action {}
     578    catch {set action [lindex $expgui_cmdlist($cmd) 0]}
     579    if {$action != "" && $action != "-"} {
     580        $menu add command -label $cmd -command [subst $action]
     581    }
     582    # get a list of files to read
     583    set filelist [glob -nocomplain [file join $expgui(scriptdir) export_*.tcl]]
     584    foreach file $filelist {
     585        source $file
     586        $menu add command -label $label -command $action
     587    }
     588}
     589
     590# utility export routines for the export_*.tcl files:
     591# make a box for export
     592proc MakeExportBox {win title webref} {
     593    global expmap expgui
     594    catch {destroy $win}
     595    toplevel $win
     596    wm title $win "Export coordinates"
     597    if {$webref != ""} {
     598        bind $win <Key-F1> $webref
     599    }
     600    pack [label $win.lbl -text $title] -side top -anchor center
     601    pack [frame $win.ps] -side top -anchor w
     602    pack [label $win.ps.lbl -text "Select phase: "] -side left
     603    foreach num $expmap(phaselist) {
     604        pack [button $win.ps.$num -text $num \
     605                    -command "SetExportPhase $num $win"] -side left
     606    }
     607    # leave a place for format-specific items
     608    pack [frame $win.special] -side top
     609    pack [frame $win.but] -side top -fill x -expand yes
     610    pack [button $win.but.1 -text Write -command "destroy $win"] -side left
     611    SetExportPhase [lindex $expmap(phaselist) 0] $win
     612    pack [button $win.but.2 -text Quit \
     613            -command "set expgui(export_phase) 0;destroy $win"] -side left
     614    pack [button $win.but.help -text Help -bg yellow \
     615            -command "MakeWWWHelp expgui.html ExportMSI"] \
     616            -side right
     617}
     618
     619# set the phase in response to the button
     620proc SetExportPhase {num win} {
     621    global expmap expgui
     622    foreach n $expmap(phaselist) {
     623        if {$n == $num} {
     624            $win.ps.$n config -relief sunken;
     625            set expgui(export_phase) $num
     626        } else {
     627            $win.ps.$n config -relief raised
     628        }
     629    }
    561630}
    562631
     
    734803    eval destroy [winfo children $expgui(phaseFrame).top.ps]
    735804    pack [label $expgui(phaseFrame).top.ps.0 -text Phase:] -side left
    736     foreach num $expmap(phaselist) type $expmap(phasetype) {
     805    foreach num $expmap(phaselist) {
    737806        pack [button $expgui(phaseFrame).top.ps.$num -text $num \
    738807                -command "SelectOnePhase $num" -padx 1.5m] -side left
    739         if {$type > 3} {
    740             $expgui(phaseFrame).top.ps.$num config -state disabled
    741         }
    742808    }
    743809    if {[file executable $expgui(exptool)] && \
     
    753819proc SelectOnePhase {num} {
    754820    global entryvar entrycmd entrybox expmap expgui
     821    # if no phase has been selected, select the first one
     822    if {$num == ""} {set num [lindex $expmap(phaselist) 0]}
     823
    755824    set crsPhase {}
    756825    $expgui(atomxform) config -text "Xform Atoms" -state disabled
    757826    foreach n $expmap(phaselist) type $expmap(phasetype) {
    758         if {$n == $num && $type <= 3} {
     827        if {$n == $num} {
    759828            catch {$expgui(phaseFrame).top.ps.$num config -relief sunken}
    760829            set crsPhase $num
     
    764833                set expgui(phasetype) "Magnetic\n& Nuclear"
    765834            } elseif {$type == 4} {
    766                 # this is not used at present
    767835                set expgui(phasetype) "Macromolecular"
    768836            } else {
     
    794862    }
    795863
    796     set expgui(curPhase) $crsPhase
    797     # we have a phase
    798 
    799     # disable traces on entryvar for right now
     864    # don't reload the last displayed phase
     865    if {$expgui(curPhase) == $crsPhase} return
     866
     867    ##########################################################
     868    # load and display a phase
     869    ##########################################################
     870    # disable traces on entryvar while loading
    800871    set entrycmd(trace) 0
    801 
    802     ##########################################################
    803     ######   SECTION: ASSIGNMENT OF DATA VARIABLES  ##########
    804     ##########################################################
    805872    # phase title
    806873    set entrycmd(phasename) "phaseinfo $crsPhase name"
     
    814881    }
    815882
    816     #Procedure call: DisplayU -- Display Anisotropic/Isotropic widget or disable
    817     # initialize to diasbled
     883    # initialize atoms display & disable
    818884    DisplayAtom 0 0
    819885    DisplayU 0 0
     
    821887    $expgui(EditingAtoms) config -text ""
    822888
    823     DisplayAllAtoms
     889    DisplayAllAtoms $crsPhase
    824890
    825891    # enable traces on entryvar now
     
    828894
    829895set expgui(noreenterDisplayAllAtoms) 0
    830 # Populate expgui(atomlistbox) (ScrolledListBox) with atoms from selected phase.
    831 proc DisplayAllAtoms {"mode reset"} {
     896# Populate expgui(atomlistbox) (a ScrolledListBox) with atoms
     897# from the selected phase.
     898proc DisplayAllAtoms {curPhase "mode reset"} {
    832899    global entryvar entrycmd expmap expgui
    833     # if it does not show, dont bother
     900    # if it does not show, we don't have a phase or we are already displaying
     901    # don't bother
    834902    if {$expgui(pagenow) != "phaseFrame"} return
    835     if {$expgui(curPhase) == ""} return
     903    if {$curPhase == ""} return
    836904    if $expgui(noreenterDisplayAllAtoms) return
    837    
     905    # prevent reentry
    838906    set expgui(noreenterDisplayAllAtoms) 1
     907    # set the current phase
     908    set expgui(curPhase) $curPhase
    839909    if {$mode != "reset"} {
    840910        # save the scrolled position
    841911        set pos [lindex [$expgui(atomlistbox) yview] 0]
    842912    } else {
    843         # this is a reset -- clear the selected atoms list
     913        # for reset, do not keep the previously selected atoms
    844914        set expgui(selectedatomlist) {}
    845915    }
    846916    $expgui(atomlistbox) delete 0 end
    847     # loop over atoms
     917    # displaying a macromolecular phase?
     918    if {[lindex $expmap(phasetype) [expr {$expgui(curPhase) - 1}]] == 4} {
     919        set mm 1
     920        $expgui(phaseFrame).top.ps.10 config -state disabled
     921        $expgui(AddAtomBut)  config -state disabled
     922        pleasewait "loading atoms..."
     923    } else {
     924        set mm 0
     925        if {[file executable $expgui(exptool)]} {
     926            $expgui(phaseFrame).top.ps.10 config -state normal
     927            $expgui(AddAtomBut) config -state normal
     928        }
     929    }
     930
     931    # prepare header info
    848932    set maxline I
    849933    set phase $expgui(curPhase)
     
    853937    set multhead "Mult"
    854938    set coordhead "   "
    855     set frachead "Occupancy"
     939    if {$mm} {
     940        set cmd mmatominfo
     941        set frachead "Occ."
     942    } else {
     943        set cmd atominfo
     944        set frachead "Occupancy"
     945    }
     946    set reshead "res/grp/#"
     947    # sort the atoms, as requested
    856948    if  {$expgui(asorttype) == "type"} {
    857949        # sort on atom type
    858950        set typehead "type* "
    859951        foreach atom $expmap(atomlist_$phase) {
    860             lappend atomlist "$atom [atominfo $phase $atom type] $phase"
     952            lappend atomlist "$atom [$cmd $phase $atom type] $phase"
    861953        }
    862954        set expmap(atomlistboxcontents) [lsort -ascii -index 1 $atomlist]
     
    869961        set expmap(atomlistboxcontents) [lsort -integer -index 1 $atomlist]
    870962    } elseif {$expgui(asorttype) == "mult"} {
    871         # sort on atom number
    872         set multhead "Mlt*"
    873         foreach atom $expmap(atomlist_$phase) {
    874             lappend atomlist "$atom [atominfo $phase $atom mult] $phase"
    875         }
    876         set expmap(atomlistboxcontents) [lsort -integer -decreasing -index 1 $atomlist]
     963        if {$mm} {
     964            set reshead "res*/grp/#"
     965            foreach atom $expmap(atomlist_$phase) {
     966                lappend atomlist "$atom [mmatominfo $phase $atom residue] $phase"
     967            }
     968            set expmap(atomlistboxcontents) [lsort -ascii -index 1 $atomlist]
     969        } else {
     970            # sort on atom number
     971            set multhead "Mlt*"
     972            foreach atom $expmap(atomlist_$phase) {
     973                lappend atomlist "$atom [atominfo $phase $atom mult] $phase"
     974            }
     975            set expmap(atomlistboxcontents) [lsort -integer -decreasing -index 1 $atomlist]
     976        }
    877977    } elseif {$expgui(asorttype) == "occupancy"} {
    878978        # sort on atom number
    879         set frachead "  Occup* "
     979        if {$mm} {
     980            set frachead "  Occ* "
     981        } else {
     982            set frachead "  Occup* "
     983        }
    880984        foreach atom $expmap(atomlist_$phase) {
    881             lappend atomlist "$atom [atominfo $phase $atom frac] $phase"
     985            lappend atomlist "$atom [$cmd $phase $atom frac] $phase"
    882986        }
    883987        set expmap(atomlistboxcontents) [lsort -real -decreasing -index 1 $atomlist]
     
    886990        set coordhead "(x*)"
    887991        foreach atom $expmap(atomlist_$phase) {
    888             lappend atomlist "$atom [atominfo $phase $atom x] $phase"
     992            lappend atomlist "$atom [$cmd $phase $atom x] $phase"
    889993        }
    890994        set expmap(atomlistboxcontents) [lsort -real -index 1 $atomlist]
     
    893997        set coordhead "(y*)"
    894998        foreach atom $expmap(atomlist_$phase) {
    895             lappend atomlist "$atom [atominfo $phase $atom y] $phase"
     999            lappend atomlist "$atom [$cmd $phase $atom y] $phase"
    8961000        }
    8971001        set expmap(atomlistboxcontents) [lsort -real -index 1 $atomlist]
     
    9001004        set coordhead "(z*)"
    9011005        foreach atom $expmap(atomlist_$phase) {
    902             lappend atomlist "$atom [atominfo $phase $atom z] $phase"
     1006            lappend atomlist "$atom [$cmd $phase $atom z] $phase"
    9031007        }
    9041008        set expmap(atomlistboxcontents) [lsort -real -index 1 $atomlist]
     
    9071011    }
    9081012
     1013    set expgui(atomlistboxline) {}
     1014    # loop over atoms
    9091015    foreach tuple $expmap(atomlistboxcontents) {
    9101016        set atom [lindex $tuple 0]
    9111017        set phase [lindex $tuple 2]
    912         set refflag {}
     1018        lappend expgui(atomlistboxline) $atom
     1019        $expgui(atomlistbox) insert end \
     1020                [FormatAtomLine $atom $phase maxline]
     1021    }
     1022    $expgui(atomtitle) delete 0 end
     1023
     1024    # create the header
     1025    if {$mm} {
     1026        $expgui(atomtitle) insert end [format "%12s %9s  %6s %8s%29s %4s  %s" \
     1027                $namehead $reshead $typehead "ref/damp  " \
     1028                "fractional coordinates$coordhead" \
     1029                "$frachead" \
     1030                " Uiso"]
     1031        donewait
     1032    } elseif {$maxline == "A"} {
     1033        $expgui(atomtitle) insert end [format "%10s %6s %8s%29s %9s  %s" \
     1034                $namehead $typehead "ref/damp  " \
     1035                "fractional coordinates$coordhead" \
     1036                "$multhead $frachead" \
     1037                " Uiso/Uij                                            "]
     1038    } else {
     1039        $expgui(atomtitle) insert end [format "%10s %6s %8s%29s %9s  %s" \
     1040                $namehead $typehead "ref/damp  " \
     1041                "fractional coordinates$coordhead" \
     1042                "$multhead $frachead" \
     1043                " Uiso"]
     1044    }
     1045    if {$mode != "reset"} {
     1046        # restore the selected items
     1047        foreach i $expgui(selectedatomlist) {
     1048            $expgui(atomlistbox) selection set $i
     1049        }
     1050        # restore the last scrolled position
     1051        $expgui(atomlistbox) yview moveto $pos
     1052    }
     1053    # clear the reentry flag
     1054    set expgui(noreenterDisplayAllAtoms) 0
     1055}
     1056
     1057proc FormatAtomLine {atom phase maxline_var} {
     1058    global expmap
     1059    if {[lindex $expmap(phasetype) [expr {$phase - 1}]] == 4} {
     1060        foreach type {x u f} {
     1061            if {[mmatominfo $phase $atom ${type}ref]} {
     1062                append refflag "[string toupper $type][mmatominfo $phase $atom ${type}damp] "
     1063            } else {
     1064                append refflag " [mmatominfo $phase $atom ${type}damp] "
     1065            }   
     1066        }
     1067        set line [format \
     1068                "%5d %-6s %-3s%-2s%4d  %-6s %8s %9.5f%9.5f%9.5f%8.4f %7.4f" \
     1069                $atom \
     1070                [mmatominfo $phase $atom label] \
     1071                [mmatominfo $phase $atom residue] \
     1072                [mmatominfo $phase $atom group] \
     1073                [mmatominfo $phase $atom resnum] \
     1074                [mmatominfo $phase $atom type] \
     1075                $refflag \
     1076                [mmatominfo $phase $atom x] \
     1077                [mmatominfo $phase $atom y] \
     1078                [mmatominfo $phase $atom z] \
     1079                [mmatominfo $phase $atom frac] \
     1080                [mmatominfo $phase $atom Uiso]
     1081        ]
     1082    } elseif {[atominfo $phase $atom temptype] == "A"} {
    9131083        foreach type {x u f} {
    9141084            if {[atominfo $phase $atom ${type}ref]} {
     
    9161086            } else {
    9171087                append refflag " [atominfo $phase $atom ${type}damp] "
    918             }   
    919         }
     1088            }
     1089        }
     1090        # want to set maxline in parent
     1091        upvar $maxline_var maxline
     1092        set maxline A
     1093        # aniso
    9201094        set line [format "%3d %-6s %-6s %8s %10.6f%10.6f%10.6f%4d%9.4f" \
    9211095                $atom \
     
    9291103                [atominfo $phase $atom frac]
    9301104        ]
    931 
    932         # add temperature factors (iso/anoiso)
    933         if {[atominfo $phase $atom temptype] == "A"} {
    934             set maxline A
    935             append line [format "  %9.5f%9.5f%9.5f%9.5f%9.5f%9.5f" \
    936                     [atominfo $phase $atom U11] \
    937                     [atominfo $phase $atom U22] \
    938                     [atominfo $phase $atom U33] \
    939                     [atominfo $phase $atom U12] \
    940                     [atominfo $phase $atom U23] \
    941                     [atominfo $phase $atom U13]
    942             ]
    943         } else {
    944             append line [format "  %9.5f" \
    945                     [atominfo $phase $atom Uiso]
    946             ]
    947         }
    948         $expgui(atomlistbox) insert end $line
    949     }
    950     $expgui(atomtitle) delete 0 end
    951     if {$maxline == "A"} {
    952         $expgui(atomtitle) insert end [format "%10s %6s %8s%29s %9s  %s" \
    953                 $namehead $typehead "ref/damp  " \
    954                 "fractional coordinates$coordhead" \
    955                 "$multhead $frachead" \
    956                 " Uiso/Uij                                            "]
     1105        append line [format "  %9.5f%9.5f%9.5f%9.5f%9.5f%9.5f" \
     1106                [atominfo $phase $atom U11] \
     1107                [atominfo $phase $atom U22] \
     1108                [atominfo $phase $atom U33] \
     1109                [atominfo $phase $atom U12] \
     1110                [atominfo $phase $atom U23] \
     1111                [atominfo $phase $atom U13]
     1112        ]
    9571113    } else {
    958         $expgui(atomtitle) insert end [format "%10s %6s %8s%29s %9s  %s" \
    959                 $namehead $typehead "ref/damp  " \
    960                 "fractional coordinates$coordhead" \
    961                 "$multhead $frachead" \
    962                 " Uiso"]
    963     }
    964     if {$mode != "reset"} {
    965         # restore the selected items
    966         foreach i $expgui(selectedatomlist) {
    967             $expgui(atomlistbox) selection set $i
    968         }
    969         # restore the last scrolled position
    970         $expgui(atomlistbox) yview moveto $pos
    971     }
    972     set expgui(noreenterDisplayAllAtoms) 0
     1114        foreach type {x u f} {
     1115            if {[atominfo $phase $atom ${type}ref]} {
     1116                append refflag "[string toupper $type][atominfo $phase $atom ${type}damp] "
     1117            } else {
     1118                append refflag " [atominfo $phase $atom ${type}damp] "
     1119            }   
     1120        }
     1121        set line [format \
     1122                "%3d %-6s %-6s %8s %10.6f%10.6f%10.6f%4d%9.4f  %9.5f" \
     1123                $atom \
     1124                [atominfo $phase $atom label] \
     1125                [atominfo $phase $atom type] \
     1126                $refflag \
     1127                [atominfo $phase $atom x] \
     1128                [atominfo $phase $atom y] \
     1129                [atominfo $phase $atom z] \
     1130                [atominfo $phase $atom mult] \
     1131                [atominfo $phase $atom frac] \
     1132                [atominfo $phase $atom Uiso]
     1133        ]
     1134    }
     1135    return $line
     1136}
     1137
     1138# update the display of atom as they are changed
     1139proc UpdateAtomLine {atomlist phase} {
     1140    global expgui
     1141    # for lots of atoms, it is faster to repaint the listbox
     1142    if {[llength $atomlist] > 25} {
     1143        DisplayAllAtoms $expgui(curPhase) noreset
     1144        return
     1145    }
     1146    foreach atom $atomlist {
     1147        set linenum [lsearch -exact $expgui(atomlistboxline) $atom]
     1148        $expgui(atomlistbox) delete $linenum
     1149        $expgui(atomlistbox) insert $linenum \
     1150                [FormatAtomLine $atom $phase maxline]
     1151    }
     1152    # restore the selected items
     1153    foreach i $expgui(selectedatomlist) {
     1154        $expgui(atomlistbox) selection set $i
     1155    }
    9731156}
    9741157
     
    10381221# format a string of numbers to save space, e.g. "1 2 3 4 6 7 19 13 14 15"
    10391222# becomes "1-4,6,7,13-15,19"
    1040 proc CompressList {numberList} {
     1223proc CompressList {numberList "max 9999"} {
    10411224    # format the number list to save space
    10421225    set lastnum -99
    10431226    set flist {}
    10441227    set count 0
     1228    set length 0
    10451229    if [catch {set sortlist [lsort -integer $numberList]}] {return $numberList}
    10461230    foreach num $sortlist {
    1047             set next [expr $lastnum+1]
    1048             if {$num != $next} {
    1049                 if {$count == 0 && $flist != ""} {
     1231        set next [expr $lastnum+1]
     1232        if {$num != $next} {
     1233            if {$count == 0 && $flist != ""} {
     1234                if {[string length $flist] - $length > $max} {
     1235                    set length [string length $flist]
     1236                    append flist ",\n$num"
     1237                } else {
    10501238                    append flist ",$num"
    1051                 } elseif {$count == 1 && $flist != ""} {
     1239                }
     1240            } elseif {$count == 1 && $flist != ""} {
     1241                if {[string length $flist] - $length > $max} {
     1242                    set length [string length $flist]
     1243                    append flist ",$lastnum,\n$num"
     1244                } else {
    10521245                    append flist ",$lastnum,$num"
    1053                 } elseif {$flist != ""} {
     1246                }
     1247            } elseif {$flist != ""} {
     1248                if {[string length $flist] - $length > $max} {
     1249                    set length [string length $flist]
     1250                    append flist "-$lastnum,\n$num"
     1251                } else {
    10541252                    append flist "-$lastnum,$num"
     1253                }
    10551254            } else {
    10561255                append flist "$num"
     
    10761275#   or disables the widet entirly if atom = 0
    10771276proc DisplayU { atomnum p} {
    1078     global expgui entryvar entrycmd
     1277    global expgui entryvar entrycmd expmap
     1278    set mm 0
    10791279    if {$atomnum == 0} {
    10801280        set iOrA disable
     1281    } elseif {[lindex $expmap(phasetype) 0] == 4} {
     1282        set mm 1
     1283        set iOrA I
    10811284    } else {
    10821285        set iOrA [atominfo $p $atomnum temptype]
     
    11111314                    -fg $expgui(bkgcolor1) -bg $expgui(bkgcolor1) \
    11121315                    -state disabled
     1316        } elseif {$mm} {
     1317            set entrycmd(U11) "mmatominfo $p $atomnum Uiso"
     1318            set entryvar(U11) [eval $entrycmd(U11)]
     1319            $firstbox config -text Uiso -fg black
     1320            [lindex $expgui(anisoentry) 0] config -fg black -bg white -state normal
    11131321        } else {
    11141322            set entrycmd(U11) "atominfo $p $atomnum Uiso"
     
    11241332# Procedure to display refinement flags
    11251333proc DisplayRefFlags { atomnum p} {
    1126     global expgui entryvar entrycmd
     1334    global expgui entryvar entrycmd expmap
    11271335    if {$atomnum == 0} {
    11281336        foreach label $expgui(atomreflbl) {
     
    11441352        $entry config -state normal -fg black -bg $expgui(bkgcolor1)
    11451353    }
    1146     foreach var {xref uref fref xdamp udamp fdamp}  {
    1147         set entrycmd($var) "atominfo $p [list $atomnum] $var"
    1148         set entryvar($var) [eval $entrycmd($var)]
     1354    if {[lindex $expmap(phasetype) 0] == 4} {
     1355        foreach var {xref uref fref xdamp udamp fdamp}  {
     1356            set entrycmd($var) "mmatominfo $p [list $atomnum] $var"
     1357            set entryvar($var) [eval $entrycmd($var)]
     1358        }
     1359    } else {
     1360        foreach var {xref uref fref xdamp udamp fdamp}  {
     1361            set entrycmd($var) "atominfo $p [list $atomnum] $var"
     1362            set entryvar($var) [eval $entrycmd($var)]
     1363        }
    11491364    }
    11501365}
     
    11521367# Procedure to display an atom in the atom edit boxes
    11531368proc DisplayAtom { atomnum p} {
    1154     global expgui entryvar entrycmd
     1369    global expgui entryvar entrycmd expmap
    11551370    if {$atomnum == 0} {
    11561371        foreach label $expgui(atomlabels) {
     
    11691384        $entry config -state normal -fg black -bg white
    11701385    }
    1171     foreach var {x y z label frac } {
    1172         set entrycmd($var) "atominfo $p $atomnum $var"
    1173         set entryvar($var) [eval $entrycmd($var)]
     1386    if {[lindex $expmap(phasetype) 0] == 4} {
     1387        foreach var {x y z label frac } {
     1388            set entrycmd($var) "mmatominfo $p $atomnum $var"
     1389            set entryvar($var) [eval $entrycmd($var)]
     1390        }
     1391    } else {
     1392        foreach var {x y z label frac } {
     1393            set entrycmd($var) "atominfo $p $atomnum $var"
     1394            set entryvar($var) [eval $entrycmd($var)]
     1395        }
    11741396    }
    11751397}
     
    26552877    {phaseFrame   Phase        \
    26562878            "" \
    2657             "SelectOnePhase \$expgui(curPhase); DisplayAllAtoms noreset" \
     2879            {SelectOnePhase $expgui(curPhase)} \
    26582880            0  expgui2.html ""}
    26592881    {histFrame    Histogram \
     
    26922914        set expgui($frm) [\
    26932915            .n insert end $frm -text [lindex $item 1] \
    2694             -createcmd [lindex $item 2] \
     2916            -createcmd "set expgui(pagenow) $frm; [lindex $item 2]" \
    26952917            -raisecmd "set expgui(pagenow) $frm; [lindex $item 3]"]
    26962918
     
    27182940    }
    27192941    lappend expgui(frameactionlist) "lsFrame SetupExtractHist"
    2720     lappend expgui(frameactionlist) "phaseFrame {DisplayAllAtoms noreset}"
     2942    lappend expgui(frameactionlist) "phaseFrame {DisplayAllAtoms $expgui(curPhase) noreset}"
    27212943    lappend expgui(frameactionlist) "histFrame DisplayHistogram"
    27222944    lappend expgui(frameactionlist) "fracFrame DisplayFrac"
     
    27322954    global expgui
    27332955    if $expgui(haveBW) {
     2956        set expgui(pagenow) $nextpage
    27342957        .n see $nextpage
    27352958        .n raise $nextpage
    2736         set expgui(pagenow) $nextpage
    27372959    } else {
    27382960        Notebook:raise .n $nextpage
     
    28353057        incr i
    28363058        set expgui(asorttype) [lindex {number type mult x y z occupancy number} $i]
    2837         DisplayAllAtoms
    2838     }
    2839     bind $expgui(atomtitle) <Button-3> {set expgui(asorttype) number; DisplayAllAtoms}
     3059        DisplayAllAtoms $expgui(curPhase)
     3060    }
     3061    bind $expgui(atomtitle) <Button-3> {set expgui(asorttype) number; DisplayAllAtoms $expgui(curPhase)}
    28403062
    28413063    $expgui(atomtitle) configure -selectmode extended
     
    28703092                -command {MakeAddAtomsBox $expgui(curPhase)}
    28713093        grid $frame3.newa -column 11 -row 0
     3094        set expgui(AddAtomBut) $frame3.newa
    28723095    }
    28733096    button [set expgui(atomxform) $frame3.xa] \
     
    30023225        }
    30033226    }
     3227
    30043228    grid [frame $expgui(histFrame).bb] -column 1 -row 6
    30053229    if [file executable $expgui(exptool)] {
     
    30413265            -row 2 -column 4 -sticky news -padx 4 -pady 3 -sticky e
    30423266    #^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^END OF HISTOGRAM PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
    3043     # insert the histograms & resize in case the pane needs more space
     3267    # insert the histograms & resize in case the pane needs more space   
    30443268    sethistlist
    30453269    ResizeNotebook
     
    33983622menu $expgui(fm).option.menu.asort
    33993623foreach opt {number type mult x y z occupancy} {
    3400     $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \
     3624    $expgui(fm).option.menu.asort add radiobutton -command {DisplayAllAtoms $expgui(curPhase)}\
    34013625            -label $opt -value $opt -variable expgui(asorttype)
    34023626}
     
    34823706
    34833707if {$expgui(shell)} {
     3708    # add an export command to the last menu that gets filled in later
     3709    $expgui(fm).$m.menu add  cascade -label "Coord Export" \
     3710            -menu $expgui(fm).$m.menu.coordexp
     3711    menu $expgui(fm).$m.menu.coordexp \
     3712            -postcommand "BuildCoordExpMenu $expgui(fm).$m.menu.coordexp"
     3713    $expgui(fm).$m.menu.coordexp add command -label "Building menu" \
     3714            -state disabled
     3715    $expgui(fm).$m.menu.coordexp add command -label "Please wait..." \
     3716            -state disabled
     3717
    34843718    # add the commands in expgui_menulist
    34853719    foreach menu [array names expgui_menulist ] {
     
    35403774#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF MENU DEFINITION ^^^^^^^^^^^^^^^^^^^
    35413775
    3542 # make the phase pane
     3776# make the phase pane -- this must be done before setphases
     3777# can be called (in loadexp)
    35433778MakePhasePane
    35443779# and the rest of the windows w/o BWidget
    3545 if !$expgui(haveBW) {
     3780if {!$expgui(haveBW)} {
    35463781    MakeHistPane
    35473782    MakeScalingPane
     
    35533788bind . <Control-c> catchQuit
    35543789
    3555 set expgui(curPhase) ""
    35563790set expgui(pagenow) ""
    35573791set expgui(curhist) {}
     
    35603794loadexp $expgui(expfile)
    35613795
    3562 # select the 1st phase
    3563 SelectOnePhase [lindex $expmap(phaselist) 0]
     3796# reset the phase selection
     3797set expgui(curPhase) {}
    35643798# select the first histogram in the list by default (if there are any)
    35653799if {[llength $expmap(histlistboxcontents)] > 0} {
Note: See TracChangeset for help on using the changeset viewer.