Changeset 542


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

# on 2002/01/22 22:53:34, toby did:
support absplt in widplt routine
move export to .xtl to separate file
change order of date-sorted .EXP files, put newest on top

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsascmds.tcl

    • Property rcs:date changed from 2001/12/16 17:31:47 to 2002/01/22 22:53:34
    • Property rcs:lines changed from +2 -2 to +4 -133
    • Property rcs:rev changed from 1.43 to 1.44
    r491 r542  
    10321032
    10331033# run widplt
    1034 proc widplt {} {
     1034proc widplt {"prog widplt"} {
    10351035    global expgui wishshell
    1036     exec $wishshell [file join $expgui(scriptdir) widplt] \
     1036    exec $wishshell [file join $expgui(scriptdir) $prog] \
    10371037            $expgui(expfile) &
    10381038}
     
    11441144            -command "MakeWWWHelp expgui.html Composition"] \
    11451145            -side right
    1146 }
    1147 
    1148 # save coordinates in an MSI .xtl file
    1149 proc exp2xtl {} {
    1150     global expmap expgui
    1151     catch {destroy .export}
    1152     toplevel .export
    1153     wm title .export "Export coordinates"
    1154     bind .export <Key-F1> "MakeWWWHelp expgui.html ExportMSI"
    1155     pack [label .export.lbl -text "Export coordinates in MSI .xtl format"\
    1156             ] -side top -anchor center
    1157     pack [frame .export.ps] -side top -anchor w
    1158     pack [label .export.ps.lbl -text "Select phase: "] -side left
    1159     foreach num $expmap(phaselist) type $expmap(phasetype) {
    1160         pack [button .export.ps.$num -text $num \
    1161                     -command "SetExportPhase $num"] -side left
    1162         if {$type == 4} {
    1163             .export.ps.$num config -state disabled
    1164         }
    1165     }
    1166     pack [frame .export.sg] -side top
    1167     pack [label .export.sg.1 -text "Space Group: "] -side left
    1168     pack [entry .export.sg.2 -textvariable expgui(export_sg) -width 8] -side left
    1169     pack [checkbutton .export.sg.3 -variable expgui(export_orig) -text "Origin 2"] -side left
    1170     pack [frame .export.but] -side top -fill x -expand yes
    1171     if {[llength $expmap(phaselist)] > 0} {
    1172         pack [button .export.but.1 -text Write -command writextl] -side left
    1173         SetExportPhase [lindex $expmap(phaselist) 0]
    1174     }
    1175     pack [button .export.but.2 -text Quit -command "destroy .export"] -side left
    1176     pack [button .export.but.help -text Help -bg yellow \
    1177             -command "MakeWWWHelp expgui.html ExportMSI"] \
    1178             -side right
    1179     # force the window to stay on top
    1180     putontop .export
    1181     afterputontop
    1182 }
    1183 
    1184 proc SetExportPhase {phase} {
    1185     global expmap expgui
    1186     foreach n $expmap(phaselist) type $expmap(phasetype) {
    1187         if {$n == $phase && $type != 4} {
    1188             .export.ps.$n config -relief sunken
    1189             set expgui(export_phase) $phase
    1190             # remove spaces from space group
    1191             set spacegroup [phaseinfo $phase spacegroup]
    1192             if {[string toupper [string range $spacegroup end end]] == "R"} {
    1193                 set spacegroup [string range $spacegroup 0 \
    1194                         [expr [string length $spacegroup]-2]]
    1195             }
    1196             regsub -all " " $spacegroup "" expgui(export_sg)   
    1197         } else {
    1198             .export.ps.$n config -relief raised
    1199         }
    1200     }
    1201 }
    1202 
    1203 
    1204 proc writextl {} {
    1205     global expgui expmap
    1206     if ![catch {
    1207         set phase $expgui(export_phase)
    1208         set origin $expgui(export_orig)
    1209         set spsymbol $expgui(export_sg)
    1210     } errmsg] {
    1211         set errmsg {}
    1212         if {$phase == ""} {
    1213             set errmsg "Error: invalid phase number $phase"
    1214         } elseif {$spsymbol == ""} {
    1215             set errmsg "Error: invalid Space Group: $spsymbol"
    1216         }
    1217     }
    1218     if {$errmsg != ""} {
    1219         MyMessageBox -parent . -title "Export error" \
    1220                 -message "Export error: $errmsg" -icon warning
    1221         return
    1222     }
    1223 
    1224     if [catch {
    1225         set filnam [file rootname $expgui(expfile)]_${phase}.xtl
    1226         set spacegroup [phaseinfo $phase spacegroup]
    1227         set fp [open $filnam w]
    1228         puts $fp "TITLE from $expgui(expfile)"
    1229         puts $fp "TITLE history [string trim [lindex [exphistory last] 1]]"
    1230         puts $fp "TITLE phase [phaseinfo $phase name]"
    1231         puts $fp "CELL"
    1232         puts $fp "  [phaseinfo $phase a] [phaseinfo $phase b] [phaseinfo $phase c] [phaseinfo $phase alpha] [phaseinfo $phase beta] [phaseinfo $phase gamma]"
    1233        
    1234         puts $fp "Symmetry Label $spsymbol"
    1235         set rhomb 0
    1236         if {[string toupper [string range $spacegroup end end]] == "R"} {
    1237             set rhomb 1
    1238         }
    1239         if $origin {
    1240             puts $fp "Symmetry Qualifier origin_2"
    1241         }
    1242         if $rhomb {
    1243             puts $fp "Symmetry Qualifier rhombohedral"
    1244         }
    1245        
    1246         puts $fp "ATOMS"
    1247         puts $fp "NAME       X          Y          Z    UISO      OCCUP"
    1248         foreach atom $expmap(atomlist_$phase) {
    1249             set label [atominfo $phase $atom label]
    1250             # remove () characters
    1251             regsub -all "\[()\]" $label "" label
    1252             # are there anisotropic atoms?
    1253             if {[atominfo $phase $atom temptype] == "A"} {
    1254                 set uiso [expr \
    1255                         ([atominfo $phase $atom U11] + \
    1256                         [atominfo $phase $atom U22] + \
    1257                         [atominfo $phase $atom U33]) / 3.]
    1258             } else {
    1259                 set uiso [atominfo $phase $atom Uiso]
    1260             }
    1261             puts $fp "$label [atominfo $phase $atom x] \
    1262                         [atominfo $phase $atom y] [atominfo $phase $atom z] \
    1263                         $uiso  [atominfo $phase $atom frac]"
    1264         }
    1265     } errmsg] {
    1266         catch {close $fp}
    1267         MyMessageBox -parent . -title "Export error" \
    1268                 -message "Export error: $errmsg" -icon warning
    1269     } else {
    1270         catch {close $fp}
    1271         MyMessageBox -parent . -title "Done" \
    1272                 -message "File [file tail $filnam] was written in directory [file dirname $filnam]"
    1273     }
    1274     if {[llength $expmap(phaselist)] == 1} {destroy .export}
    12751146}
    12761147
     
    23152186    }
    23162187    if {$expgui(filesort) == 0} {
    2317         foreach pair [lsort -index 1 -integer $pairlist] {
     2188        foreach pair [lsort -index 1 -integer -decreasing $pairlist] {
    23182189            set file [lindex $pair 0]
    23192190            set modified [clock format [lindex $pair 1] -format "%T %D"]
Note: See TracChangeset for help on using the changeset viewer.