source: trunk/dumpexp.tcl @ 487

Last change on this file since 487 was 459, checked in by toby, 13 years ago

# on 2001/10/14 05:37:32, toby did:
dump coordinates from a .EXP file

  • Property rcs:author set to toby
  • Property rcs:date set to 2001/10/14 05:37:32
  • Property rcs:rev set to 1.1
  • Property rcs:state set to Exp
  • Property svn:keywords set to Author Date Revision Id
File size: 3.2 KB
Line 
1if {[llength $argv] != 1} {
2    wm withdraw .
3    tk_dialog .err {Wrong Args} \
4            "$argv0: argument should be a .EXP file name" \
5            error 0 Continue
6    exit
7}
8set expgui(font) 14
9set expgui(debug) 0
10
11pack [label .l -text "Reading $argv\nPlease wait"]
12update
13wm protocol . WM_DELETE_WINDOW {puts ""; exit}
14#=============================================================================
15#----------------------------------------------------------------
16# where are we?
17set expgui(script) [info script]
18# translate links -- go six levels deep
19foreach i {1 2 3 4 5 6} {
20    if {[file type $expgui(script)] == "link"} {
21        set link [file readlink $expgui(script)]
22        if { [file  pathtype  $link] == "absolute" } {
23            set expgui(script) $link
24        } {
25            set expgui(script) [file dirname $expgui(script)]/$link
26        }
27    } else {
28        break
29    }
30}
31# fixup relative paths
32if {[file pathtype $expgui(script)] == "relative"} {
33    set expgui(script) [file join [pwd] $expgui(script)]
34}
35set expgui(scriptdir) [file dirname $expgui(script) ]
36#----------------------------------------------------------------
37source [file join $expgui(scriptdir) opts.tcl]
38# fetch EXP file processing routines
39source [file join $expgui(scriptdir) readexp.tcl]
40# commands for running GSAS programs
41#source [file join $expgui(scriptdir) gsascmds.tcl]
42# override options with locally defined values
43if [file exists [file join $expgui(scriptdir) localconfig]] {
44    source [file join $expgui(scriptdir) localconfig]
45}
46if [file exists [file join ~ .gsas_config]] {
47    source [file join ~ .gsas_config]
48}
49SetTkDefaultOptions $expgui(font)
50
51if {![file exists $argv]} {
52    # read error
53    wm withdraw .
54    tk_dialog .err {Bad file} \
55            "$argv0: error\nfile $argv not found" \
56            error 0 Continue
57    exit
58}
59set fmt [expload $argv]
60if {$fmt < 0} {
61    # read error
62    wm withdraw .
63    tk_dialog .err {Bad file} \
64            "$argv0: error reading $argv\nThis is not a valid GSAS .EXP file" \
65            error 0 Continue
66    exit
67}
68mapexp
69if {[llength $expmap(phaselist)] == 0} {
70    # read error
71    wm withdraw .
72    tk_dialog .err {Bad file} \
73            "$argv0: error reading $argv\nNo phases found" \
74            error 0 Continue
75    exit
76}
77if {[llength $expmap(phaselist)] > 1} {
78    # need to select a phase
79    .l config -text "Select a phase"
80    foreach p $expmap(phaselist) {
81        set n [phaseinfo $p name]
82        pack [radiobutton .p$p -text "Phase $p: $n" -variable phase \
83                -value $p] -anchor w
84    }
85    wm withdraw .
86    update idletasks
87    set x [expr {[winfo screenwidth .]/2 - [winfo reqwidth .]/2}]
88    set y [expr {[winfo screenheight .]/2 - [winfo reqheight .]/2}]
89    wm geom . +$x+$y
90    wm deiconify .
91    grab .
92    focus .
93    tkwait variable phase
94} else {
95    set phase $expmap(phaselist)
96}
97foreach v {a b c alpha beta gamma} {
98    lappend l [phaseinfo $phase $v]
99}
100set l1 {}
101foreach a $expmap(atomlist_$phase) {
102    set l2 {}
103    foreach p {label x y z type frac} {
104        lappend l2 [atominfo $phase $a $p]
105    }
106    if {[atominfo $phase $a temptype] == "I"} {
107        lappend l2 [atominfo $phase $a Uiso]
108    } else {
109        set ueq {} 
110        catch {
111            set ueq [expr {
112                ([atominfo $phase $a U11] + 
113                [atominfo $phase $a U22] + 
114                [atominfo $phase $a U33]) /3.
115            }]
116            }
117        lappend l2 $ueq
118#    }
119    lappend l1 $l2
120}
121puts [list [phaseinfo $phase spacegroup] $l $l1]
122exit
Note: See TracBrowser for help on using the repository browser.