Changeset 1166
- Timestamp:
- 08/17/2011 06:17:04 PM (19 months ago)
- Location:
- trunk
- Files:
-
- 26 added
- 2 deleted
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Geo_Viewer.tcl
r1025 r1166 47 47 array set ::geo_bonds "" 48 48 set ::geo_alist "" 49 set ::geo_filterval 5.00 49 50 } 50 51 … … 60 61 set angle_total -1 61 62 63 set ::geo_phase_list {} 64 catch {unset ::geo_angles} 65 catch {unset ::geo_bonds} 62 66 array set ::geo_bonds "" 63 67 array set ::geo_angles "" 64 68 array set ::geo_angle_keys "" 69 65 70 66 71 while {[gets $fh line] >= 0} { … … 143 148 Geo_Read $root.disagl 144 149 donewait 150 if {[llength $::geo_phase_list] == 0} { 151 MyMessageBox -parent . -title "DISAGL Problem" \ 152 -message "No output found in DISAGL output. Is something wrong with DISAGL settings or this .EXP file?" \ 153 -icon error 154 return 155 } 145 156 set mcb .maincontrolbox 146 157 catch {toplevel $mcb} … … 175 186 eval tk_optionMenu $sc.phase ::geo_entryvar(phase) $::geo_phase_list 176 187 label $sc.atom1 -text "Atom Type" 188 label $sc.filterlab -text "Dmax Filter" 189 entry $sc.filterval -textvariable ::geo_filterval 190 $sc.filterval config -width 6 177 191 #button $sc.engage -text "Print Info" -command Geo_Fill_Display 178 192 grid $sc.phlabel -row 0 -column 0 179 grid $sc.phase -row 0 -column 1 180 grid $sc.atom1 -column 0 -row 1 193 grid $sc.phase -row 0 -column 1 194 grid $sc.atom1 -row 1 -column 0 195 grid $sc.filterlab -row 2 -column 0 196 grid $sc.filterval -row 2 -column 1 181 197 182 198 label $as.atom -text "Choose Atom(s)" … … 270 286 label $top.toplabel1 -text "Atom 2" -width 8 271 287 label $top.toplabel2 -text "symm" -width 8 272 label $top.toplabel3 -text "Distance" -width 8288 label $top.toplabel3 -text "Distance" -width 10 273 289 label $top.toplabel4 -text "Angle" 274 290 # grid $top.toplabel0 -column 0 -row 0 … … 293 309 set symlist {} 294 310 incr rownum 311 if {[string trim $::geo_filterval] == ""} {set ::geo_filterval 5.00} 295 312 foreach j $slist { 296 lappend keylist [lindex $j 10] 297 lappend atmlist [lindex $j 6] 298 lappend symlist [lindex $j 9] 299 label $::geo_side.atom1${bondnum} -text [lindex $j 5] -width 8 300 label $::geo_main.atom2${bondnum} -text [lindex $j 6] -width 8 301 label $::geo_main.atom2symm${bondnum} -text [lindex $j 9] -width 8 302 label $::geo_main.bonddist${bondnum} -text [lindex $j 7] -width 8 303 304 grid $::geo_side.atom1${bondnum} -row $rownum -column 0 305 grid $::geo_main.atom2${bondnum} -row $rownum -column 0 306 grid $::geo_main.atom2symm${bondnum} -row $rownum -column 1 307 grid $::geo_main.bonddist${bondnum} -row $rownum -column 2 308 309 set key [lindex $j 10] 310 set atom [lindex $j 1] 311 set phase [lindex $j 0] 312 313 314 foreach k $keylist { 315 316 if {$key != $k} { 317 if {[array name ::geo_angles "$phase,$key,$atom,$k"] != ""} { 318 label $::geo_main.$counter -text [lindex $::geo_angles($phase,$key,$atom,$k) 7] 319 grid $::geo_main.$counter -row $rownum -column $colnum -padx 5 320 incr colnum 321 incr counter 322 } elseif {[array name ::geo_angles "$phase,$k,$atom,$key"] != ""} { 323 label $::geo_main.$counter -text [lindex $::geo_angles($phase,$k,$atom,$key) 7] 324 grid $::geo_main.$counter -row $rownum -column $colnum -padx 5 325 326 incr colnum 327 incr counter 313 if {[lindex $j 7] <= $::geo_filterval} { 314 lappend keylist [lindex $j 10] 315 lappend atmlist [lindex $j 6] 316 lappend symlist [lindex $j 9] 317 label $::geo_side.atom1${bondnum} -text [lindex $j 5] -width 8 318 label $::geo_main.atom2${bondnum} -text [lindex $j 6] -width 8 319 label $::geo_main.atom2symm${bondnum} -text [lindex $j 9] -width 8 320 set bonddist [lindex $j 7] 321 set bondesd [lindex $j 8] 322 set bondentry [formatSU $bonddist $bondesd] 323 label $::geo_main.bonddist${bondnum} -text $bondentry -width 10 324 325 grid $::geo_side.atom1${bondnum} -row $rownum -column 0 326 grid $::geo_main.atom2${bondnum} -row $rownum -column 0 327 grid $::geo_main.atom2symm${bondnum} -row $rownum -column 1 328 grid $::geo_main.bonddist${bondnum} -row $rownum -column 2 329 330 set key [lindex $j 10] 331 set atom [lindex $j 1] 332 set phase [lindex $j 0] 333 334 335 foreach k $keylist { 336 337 if {$key != $k} { 338 # search for atom 1 - central atom - atom 2 angle. 339 if {[array name ::geo_angles "$phase,$key,$atom,$k"] != ""} { 340 set ang [lindex $::geo_angles($phase,$key,$atom,$k) 7] 341 set angesd [lindex $::geo_angles($phase,$key,$atom,$k) 8] 342 set angentry [formatSU $ang $angesd] 343 label $::geo_main.$counter -text $angentry 344 # label $::geo_main.$counter -text [lindex $::geo_angles($phase,$key,$atom,$k) 7] 345 grid $::geo_main.$counter -row $rownum -column $colnum -padx 5 346 incr colnum 347 incr counter 348 # search for atom 2 - central atom - atom 1 angle. 349 } elseif {[array name ::geo_angles "$phase,$k,$atom,$key"] != ""} { 350 set ang [lindex $::geo_angles($phase,$k,$atom,$key) 7] 351 set angesd [lindex $::geo_angles($phase,$k,$atom,$key) 8] 352 set angentry [formatSU $ang $angesd] 353 label $::geo_main.$counter -text $angentry 354 # label $::geo_main.$counter -text [lindex $::geo_angles($phase,$k,$atom,$key) 7] 355 grid $::geo_main.$counter -row $rownum -column $colnum -padx 5 356 357 incr colnum 358 incr counter 359 } 360 } 328 361 } 329 330 }331 }332 362 incr bondnum 333 incr rownum363 incr rownum 334 364 set colnum 3 335 365 } 336 366 } 337 367 set colnum 3 -
trunk/addcmds.tcl
r1116 r1166 709 709 # mode must be t-max or 2theta, at least for now 710 710 if {$newhist(LimitMode) != 1} return 711 # is a instrument parameter file loaded? If not, try again later712 if {[string trim $newhist(instfile)] == ""} return713 711 # get data bank number, test if valid 714 712 set num $newhist(banknum) 715 713 if {[catch {expr $num}]} {return} 716 714 if {$newhist(insttype) == "TOF"} { 715 # is a instrument parameter file loaded? If not, try again later 716 if {[string trim $newhist(instfile)] == ""} return 717 717 set newhist(2tLimit) [expr {$newhist(tmin$num) / 10.}] 718 718 # at Ashfia's request, override the bank header # with the … … 740 740 set inp [ 741 741 tk_getOpenFile -parent $np -initialfile $newhist(instfile) -filetypes { 742 {"Inst files" .INS*} {"Inst files" .ins*} 742 {"Inst files" .INS*} {"Inst files" .ins*} 743 743 {"Inst files" .PRM} {"Inst files" .prm} 744 744 {"All files" *} … … 937 937 puts $fp "H" 938 938 if {$tcl_platform(platform) == "windows"} { 939 puts $fp [file attributes $rawfile -shortname] 940 puts $fp [file attributes $instfile -shortname] 939 if {[string length $rawfile] > 50} { 940 puts $fp [file attributes $rawfile -shortname] 941 } else { 942 puts $fp $rawfile 943 } 944 if {[string length $instfile] > 50} { 945 puts $fp [file attributes $instfile -shortname] 946 } else { 947 puts $fp $instfile 948 } 941 949 } else { 942 950 puts $fp $rawfile … … 1637 1645 grid $top.scroll -sticky ns -column 4 -row 2 1638 1646 } else { 1639 grid forget $top.scroll 1647 grid forget $top.scroll 1640 1648 } 1641 1649 update … … 1949 1957 } 1950 1958 1959 # allow fixing of atom coordinates 1960 if {[lindex $expmap(phasetype) [expr {$p - 1}]] != 4} { 1961 grid [TitleFrame $w.10 -bd 6 -relief groove \ 1962 -text "Fix Atom$suffix Coordinates"] \ 1963 -row 9 -column 0 -columnspan 10 -sticky news 1964 set fix [$w.10 getframe] 1965 Fix_Initialize $numberList 1966 1967 label $fix.xlab -text " x " -width 8 1968 label $fix.ylab -text " y " -width 8 1969 label $fix.zlab -text " z " -width 8 1970 grid $fix.xlab -row 2 -column 0 1971 grid $fix.ylab -row 2 -column 1 1972 grid $fix.zlab -row 2 -column 2 1973 1974 1975 button $fix.x -text "$::fix_state_X" -width 8 \ 1976 -command "Fix_Atoms $phase [list $numberList] X $fix.x; 1977 Fix_Write 1978 DisplayAllAtoms $phase" 1979 1980 button $fix.y -text "$::fix_state_Y" -width 8 \ 1981 -command "Fix_Atoms $phase [list $numberList] Y $fix.y 1982 Fix_Write 1983 DisplayAllAtoms $phase" 1984 button $fix.z -text "$::fix_state_Z" -width 8 \ 1985 -command "Fix_Atoms $phase [list $numberList] Z $fix.z 1986 Fix_Write 1987 DisplayAllAtoms $phase" 1988 grid $fix.x -row 3 -column 0 1989 grid $fix.y -row 3 -column 1 1990 grid $fix.z -row 3 -column 2 1991 } 1992 #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1993 1951 1994 grid rowconfigure $w 11 -minsize 5 1952 1995 grid [frame $w.b] -row 12 -column 0 -columnspan 10 -sticky ew … … 1966 2009 if {[llength $expgui(selectedatomlist)] != 0} editRecord 1967 2010 } 2011 2012 #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x 2013 2014 proc Fix_Initialize {numberList} { 2015 set phaselist $::expmap(phaselist) 2016 catch {unset ::fix_param} 2017 foreach i $phaselist { 2018 set ::fix_list(X,$i) "" 2019 set ::fix_list(Y,$i) "" 2020 set ::fix_list(Z,$i) "" 2021 2022 set temp [atom_constraint_read $i] 2023 foreach j $temp { 2024 set atomnum [string trim [string range $j 2 3]] 2025 set param [string trim [string range $j 4 6]] 2026 set ::fix_param($i,$atomnum,$param) 1 2027 if {$param == "X"} {lappend ::fix_list(X,$i) $atomnum} 2028 if {$param == "Y"} {lappend ::fix_list(Y,$i) $atomnum} 2029 if {$param == "Z"} {lappend ::fix_list(Z,$i) $atomnum} 2030 } 2031 } 2032 set ::fix_state_X [Fix_State $i $numberList X] 2033 set ::fix_state_Y [Fix_State $i $numberList Y] 2034 set ::fix_state_Z [Fix_State $i $numberList Z] 2035 } 2036 2037 proc Fix_State {phase numberList coord} { 2038 set status_fixed "-1" 2039 set status_unfixed "-1" 2040 #puts "$coord before: $status_fixed $status_unfixed" 2041 foreach i $numberList { 2042 set temp [info exists ::fix_param($phase,$i,$coord)] 2043 #puts "::fix_param($phase,$i,$coord) is variable present?: $temp" 2044 if {$temp != 0} {set status_fixed 1} 2045 if {$temp == 0} {set status_unfixed 1} 2046 } 2047 #puts "$coord after $status_fixed $status_unfixed" 2048 if {$status_fixed == 1 && $status_unfixed != 1} {return "fixed"} 2049 if {$status_fixed == 1 && $status_unfixed == 1} {return "mixed"} 2050 if {$status_fixed != 1 && $status_unfixed == 1} {return "unfixed"} 2051 } 2052 2053 proc Fix_Write {} { 2054 incr ::expgui(changed) 2055 #puts "Prepare to write [array names ::fix_Param]" 2056 foreach j [array names ::fix_param] { 2057 regexp {[0-9]+} $j temp_phase 2058 regexp {,[0-9]+} $j ans 2059 set temp_atom [string range $ans 1 end] 2060 regexp {[a-zA-Z]+} $j temp_param 2061 if {$temp_param == "U"} {regexp {[a-zA-Z]+[0-9]+} $j temp_param} 2062 set temp_entry [format "%1s %+2s%-4s" $temp_phase $temp_atom $temp_param] 2063 lappend fix_list($temp_phase) $temp_entry 2064 } 2065 set phaselist $::expmap(phaselist) 2066 foreach i $phaselist { 2067 catch {atom_constraint_write $i $fix_list($i)} 2068 catch {RecordMacroEntry "catch {atom_constraint_write $i $fix_list($i)}" 0} 2069 #puts $fix_list($i) 2070 } 2071 } 2072 2073 proc Fix_Atoms {phase numberList coord but} { 2074 # puts "before ::fix_state_$coord [set ::fix_state_$coord]" 2075 #puts " before operationi: $::fix_list($coord,$phase)" 2076 switch [set ::fix_state_$coord] { 2077 "unfixed" {$but config -text "fixed" 2078 set ::fix_state_$coord "fixed" 2079 } 2080 "fixed" {$but config -text "unfixed" 2081 set ::fix_state_$coord "unfixed" 2082 } 2083 "mixed" {$but config -text "unfixed" 2084 set ::fix_state_$coord "unfixed" 2085 } 2086 } 2087 if {[set ::fix_state_$coord] == "fixed"} { 2088 #puts "fixing atom number $numberList" 2089 foreach i $numberList { 2090 lappend ::fix_list($coord,$phase) $i 2091 set ::fix_list($coord,$phase) [lsort -uniq -integer $::fix_list($coord,$phase)] 2092 set ::fix_param($phase,$i,$coord) 1 2093 } 2094 } 2095 if {[set ::fix_state_$coord] == "unfixed"} { 2096 #puts "unfixing atoms $numberList" 2097 foreach i $numberList { 2098 set temp [lsearch $::fix_list($coord,$phase) $i] 2099 if {$temp != -1} { 2100 set ::fix_list($coord,$phase) [lreplace $::fix_list($coord,$phase) $temp $temp] 2101 catch {unset ::fix_param($phase,$i,$coord)} 2102 } 2103 } 2104 } 2105 #puts "after operation: $::fix_list($coord,$phase)" 2106 } 2107 1968 2108 1969 2109 # transform the coordinates -
trunk/disagledit.tcl
r1025 r1166 1 1 proc DA_Initialize {} { 2 catch {unset ::da_ddrad}3 catch {unset ::da_darad}4 catch {unset ::da_drad}5 catch {unset ::da_arad}6 catch {unset ::da_acon}7 catch {unset ::da_dcon}2 catch {unset ::da_ddrad} 3 catch {unset ::da_darad} 4 catch {unset ::da_drad} 5 catch {unset ::da_arad} 6 catch {unset ::da_acon} 7 catch {unset ::da_dcon} 8 8 set ::da_quit 1 9 set ::da_phase $::expmap(phaselist)10 foreach j $::da_phase {9 set ::da_phase $::expmap(phaselist) 10 foreach j $::da_phase { 11 11 set ::da_dcon($j) [phaseinfo $j DistCalc] 12 12 set b [regexp -all {[0-9]} $::da_dcon($j)] 13 13 if {$b > 0} { 14 set ::da_dval($j) $::da_dcon($j)] 15 } else { 16 set ::da_dval$j "" 14 set ::da_dval($j) $::da_dcon($j)] 15 } else { 16 set ::da_dval$j "" 17 } 18 19 set ::da_acon($j) [phaseinfo $j AngCalc] 20 set c [regexp -all {[0-9]} $::da_acon($j)] 21 if {$c > 0} {set ::da_aval$j $::da_acon($j) 22 } else { 23 set ::da_aval$j ""} 24 25 } 26 27 } 28 29 proc DA_Read {} { 30 31 set ::da_list [AtmTypList] 32 set da_angrad [DefAtmTypInfo angrad] 33 set da_distrad [DefAtmTypInfo distrad] 34 35 #Build search arrays 36 #::da_darad array contains default angle search radii 37 #::da_ddrad array contains default distance search radii 38 #::da_arad array contains current angle search radii 39 #::da_drad array contains current distance search radii 40 41 foreach j $da_angrad { 42 set ::da_darad([lindex $j 0]) [lindex $j 1] 43 } 44 foreach k $da_distrad { 45 set ::da_ddrad([lindex $k 0]) [lindex $k 1] 46 } 47 foreach i $::da_list { 48 set ::da_drad($i) [AtmTypInfo distrad $i] 49 set ::da_arad($i) [AtmTypInfo angrad $i] 50 } 51 } 52 53 #**************** Build Disagl Control Panel **************************** 54 55 proc DA_Control_Panel {"launchdisagl 0"} { 56 DA_Initialize 57 DA_Read 58 destroy .disaglcon 59 set dcb .disaglcon 60 catch {toplevel $dcb} 61 eval destroy [winfo children $dcb] 62 63 #construct phase control box in phasecon frame 64 set phasecon $dcb.phasecon 65 frame $phasecon -bd 2 -relief groove 66 grid $phasecon -column 0 -row 0 67 68 label $phasecon.lbl1 -text "Bond Search \n Method" 69 label $phasecon.lbl2 -text "Angle Search \n Method" 70 grid $phasecon.lbl1 -column 1 -row 0 71 grid $phasecon.lbl2 -column 2 -row 0 72 73 74 foreach i $::da_phase { 75 label $phasecon.phase$i -text "Phase $i" -width 8 76 set tacon [regexp {[0-9]+.[0-9]+} $::da_acon($i)] 77 set tdcon [regexp {[0-9]+.[0-9]+} $::da_dcon($i)] 78 if {$tacon} {set alist {none radii $::da_acon($i)} 79 } else {set alist {none radii {fixed search range}}} 80 if {$tdcon} {set dlist {none radii $::da_dcon($i)} 81 } else {set dlist {none radii {fixed search range}}} 82 83 # set list {none radii {fixed search range}} 84 #if {[set ::da_dval$i] != ""} {lappend list [set ::da_dval$i]} 85 eval tk_optionMenu $phasecon.dist$i ::da_dcon($i) $dlist 86 $phasecon.dist$i config -width 10 87 eval tk_optionMenu $phasecon.ang$i ::da_acon($i) $alist 88 $phasecon.ang$i config -width 10 89 grid $phasecon.phase$i -row $i -column 0 -padx 10 90 grid $phasecon.dist$i -row $i -column 1 -padx 10 91 grid $phasecon.ang$i -row $i -column 2 -padx 10 92 } 93 94 trace var ::da_dcon w DA_Controls 95 trace var ::da_acon w DA_Controls 96 97 98 #save box 99 set dasave $dcb.dasave 100 frame $dasave -bd 2 -relief groove 101 grid $dasave -column 0 -row 2 102 103 if {$launchdisagl} { 104 wm title $dcb "DISAGL Control Panel" 105 grab release $dcb 106 checkbutton $dasave.option -text "DISAGL output in separate window" \ 107 -variable ::expgui(disaglSeparateBox) 108 grid $dasave.option -row 0 -column 0 109 button $dasave.sexit -text "Save and run DISAGL" -command DA_Save -bg LightGreen 110 grid $dasave.sexit -row 1 -column 0 111 } else { 112 wm title $dcb "Distance Search Parameters" 113 grab release $dcb 114 button $dasave.sexit -text "Save and Exit" -command DA_Save -bg LightGreen 115 grid $dasave.sexit -row 0 -column 0 116 } 117 button $dasave.quit -text "Cancel" -command "destroy $dcb" 118 grid $dasave.quit -row 2 -column 0 119 120 121 #construct control box 122 123 124 set dacon $dcb.dacon 125 frame $dacon -bd 2 -relief groove 126 grid $dacon -column 1 -row 2 127 128 button $dacon.default -text "Restore to Default Radii" -command { 129 foreach i $::da_list { 130 set ::da_drad($i) $::da_ddrad([lindex [split $i {+-}] 0]) 131 set ::da_arad($i) $::da_darad([lindex [split $i {+-}] 0]) 132 } 133 } 134 grid $dacon.default -row 3 -column 0 -columnspan 3 135 136 label $dacon.dradcon -text "Increment All Bond Search Radii (0.10 A)" 137 label $dacon.aradcon -text "Increment All Angle Search Radii (0.10 A)" 138 button $dacon.dradup -text "\u2191" -command DA_Inc_Drad 139 button $dacon.draddn -text "\u2193" -command DA_Dec_Drad 140 button $dacon.aradup -text "\u2191" -command DA_Inc_Arad 141 button $dacon.araddn -text "\u2193" -command DA_Dec_Arad 142 grid $dacon.dradcon -column 0 -row 0 -pady 5 143 grid $dacon.dradup -column 1 -row 0 -padx 5 144 grid $dacon.draddn -column 2 -row 0 -padx 5 145 grid $dacon.aradcon -column 0 -row 1 -pady 5 146 grid $dacon.aradup -column 1 -row 1 -padx 5 147 grid $dacon.araddn -column 2 -row 1 -padx 5 148 149 # button $dacon.radcon -text "Radii Editor" -command {DA_Radii_Box .disaglcon} 150 # grid $dacon.radcon -row 1 -column 0 151 152 DA_Radii_Box .disaglcon 153 putontop .disaglcon 154 tkwait window .disaglcon 155 afterputontop 156 return $::da_quit 157 158 } 159 160 proc DA_Controls {var phase junk } { 161 if {[set ${var}($phase)] == "none"} { 162 if {$var == "::da_acon"} { 163 set ::da_dcon($phase) "none" 164 #puts 1 165 } else { 166 set ::da_acon($phase) "none" 167 #puts 2 17 168 } 18 19 set ::da_acon($j) [phaseinfo $j AngCalc]20 set c [regexp -all {[0-9]} $::da_acon($j)]21 if {$c > 0} {set ::da_aval$j $::da_acon($j) 169 } 170 if {[set ${var}($phase)] != "none" && ($::da_dcon($phase) == "none" || $::da_acon($phase) == "none")} { 171 if {$var == "::da_acon"} { 172 set ::da_dcon($phase) "radii" 22 173 } else { 23 set ::da_aval$j ""} 24 25 } 26 27 } 28 29 proc DA_Read {} { 30 31 set ::da_list [AtmTypList] 32 set da_angrad [DefAtmTypInfo angrad] 33 set da_distrad [DefAtmTypInfo distrad] 34 35 #Build search arrays 36 #::da_darad array contains default angle search radii 37 #::da_ddrad array contains default distance search radii 38 #::da_arad array contains current angle search radii 39 #::da_drad array contains current distance search radii 40 41 foreach j $da_angrad { 42 set ::da_darad([lindex $j 0]) [lindex $j 1] 43 } 44 foreach k $da_distrad { 45 set ::da_ddrad([lindex $k 0]) [lindex $k 1] 46 } 47 foreach i $::da_list { 48 set ::da_drad($i) [AtmTypInfo distrad $i] 49 set ::da_arad($i) [AtmTypInfo angrad $i] 50 } 51 } 52 53 #**************** Build Disagl Control Panel **************************** 54 55 proc DA_Control_Panel {"launchdisagl 0"} { 56 DA_Initialize 57 DA_Read 58 destroy .disaglcon 59 set dcb .disaglcon 60 catch {toplevel $dcb} 61 eval destroy [winfo children $dcb] 62 63 #construct phase control box in phasecon frame 64 set phasecon $dcb.phasecon 65 frame $phasecon -bd 2 -relief groove 66 grid $phasecon -column 0 -row 0 67 68 label $phasecon.lbl1 -text "Bond Search \n Method" 69 label $phasecon.lbl2 -text "Angle Search \n Method" 70 grid $phasecon.lbl1 -column 1 -row 0 71 grid $phasecon.lbl2 -column 2 -row 0 72 73 74 foreach i $::da_phase { 75 label $phasecon.phase$i -text "Phase $i" -width 8 76 set tacon [regexp {[0-9]+.[0-9]+} $::da_acon($i)] 77 set tdcon [regexp {[0-9]+.[0-9]+} $::da_dcon($i)] 78 if {$tacon} {set alist {none radii $::da_acon($i)} 79 } else {set alist {none radii {fixed search range}}} 80 if {$tdcon} {set dlist {none radii $::da_dcon($i)} 81 } else {set dlist {none radii {fixed search range}}} 82 83 # set list {none radii {fixed search range}} 84 #if {[set ::da_dval$i] != ""} {lappend list [set ::da_dval$i]} 85 eval tk_optionMenu $phasecon.dist$i ::da_dcon($i) $dlist 86 $phasecon.dist$i config -width 10 87 eval tk_optionMenu $phasecon.ang$i ::da_acon($i) $alist 88 $phasecon.ang$i config -width 10 89 grid $phasecon.phase$i -row $i -column 0 -padx 10 90 grid $phasecon.dist$i -row $i -column 1 -padx 10 91 grid $phasecon.ang$i -row $i -column 2 -padx 10 92 } 93 94 trace var ::da_dcon w DA_Controls 95 trace var ::da_acon w DA_Controls 96 97 98 #save box 99 set dasave $dcb.dasave 100 frame $dasave -bd 2 -relief groove 101 grid $dasave -column 0 -row 2 102 103 if {$launchdisagl} { 104 wm title $dcb "DISAGL Control Panel" 105 grab release $dcb 106 checkbutton $dasave.option -text "DISAGL output in separate window" \ 107 -variable ::expgui(disaglSeparateBox) 108 grid $dasave.option -row 0 -column 0 109 button $dasave.sexit -text "Save and run DISAGL" -command DA_Save -bg LightGreen 110 grid $dasave.sexit -row 1 -column 0 111 } else { 112 wm title $dcb "Distance Search Parameters" 113 grab release $dcb 114 button $dasave.sexit -text "Save and Exit" -command DA_Save -bg LightGreen 115 grid $dasave.sexit -row 0 -column 0 116 } 117 button $dasave.quit -text "Cancel" -command "destroy $dcb" 118 grid $dasave.quit -row 2 -column 0 119 120 121 #construct control box 122 123 124 set dacon $dcb.dacon 125 frame $dacon -bd 2 -relief groove 126 grid $dacon -column 1 -row 2 127 128 button $dacon.default -text "Restore to Default Radii" -command { 129 foreach i $::da_list { 130 set ::da_drad($i) $::da_ddrad([lindex [split $i {+-}] 0]) 131 set ::da_arad($i) $::da_darad([lindex [split $i {+-}] 0]) 132 } 133 } 134 grid $dacon.default -row 3 -column 0 -columnspan 3 135 136 label $dacon.dradcon -text "Increment All Bond Search Radii (0.10 A)" 137 label $dacon.aradcon -text "Increment All Angle Search Radii (0.10 A)" 138 button $dacon.dradup -text "\u2191" -command DA_Inc_Drad 139 button $dacon.draddn -text "\u2193" -command DA_Dec_Drad 140 button $dacon.aradup -text "\u2191" -command DA_Inc_Arad 141 button $dacon.araddn -text "\u2193" -command DA_Dec_Arad 142 grid $dacon.dradcon -column 0 -row 0 -pady 5 143 grid $dacon.dradup -column 1 -row 0 -padx 5 144 grid $dacon.draddn -column 2 -row 0 -padx 5 145 grid $dacon.aradcon -column 0 -row 1 -pady 5 146 grid $dacon.aradup -column 1 -row 1 -padx 5 147 grid $dacon.araddn -column 2 -row 1 -padx 5 148 149 # button $dacon.radcon -text "Radii Editor" -command {DA_Radii_Box .disaglcon} 150 # grid $dacon.radcon -row 1 -column 0 151 152 DA_Radii_Box .disaglcon 153 putontop .disaglcon 154 tkwait window .disaglcon 155 afterputontop 156 return $::da_quit 157 158 } 159 160 proc DA_Controls {var phase junk } { 161 if {[set ${var}($phase)] == "none"} { 162 if {$var == "::da_acon"} { 163 set ::da_dcon($phase) "none" 164 puts 1 165 } else { 166 set ::da_acon($phase) "none" 167 puts 2 174 set ::da_acon($phase) "radii" 168 175 } 169 } 170 if {[set ${var}($phase)] != "none" && ($::da_dcon($phase) == "none" || $::da_acon($phase) == "none")} { 171 if {$var == "::da_acon"} { 172 set ::da_dcon($phase) "radii" 173 } else { 174 set ::da_acon($phase) "radii" 175 } 176 } 177 178 179 # if {[set ${var}($phase)] == "fixed search range"} {} 180 if {[set ${var}($phase)] != "none" && [set ${var}($phase)] != "radii" } { 181 catch {destroy .disaglcon.top} 182 set dedit .disaglcon.top 183 toplevel $dedit 184 bind $dedit <Return> "destroy $dedit" 185 # frame $dedit -bd 2 -relief groove 186 # pack $dedit -side top 187 set temp [regexp {[0-9]+.[0-9]+} [set ${var}($phase)]] 188 if {$temp == 0} {set ${var}($phase) 0.00} 189 if {$var == "::da_acon"} { 190 label $dedit.lbl1 -text "set angle fixed search range \n for phase $phase in angstroms" 191 # set ::da_acon($phase) 0 192 entry $dedit.entry1 -textvariable ::da_acon($phase) -takefocus 1 193 $dedit.entry1 selection range 0 end 194 grid $dedit.lbl1 -column 0 -row 0 195 grid $dedit.entry1 -column 0 -row 1 196 focus $dedit.entry1 197 } 198 if {$var == "::da_dcon"} { 199 # set ::da_dcon($phase) 0 200 label $dedit.lbl1 -text "set bond fixed search range \n for phase $phase in angstroms" 201 entry $dedit.entry1 -textvariable ::da_dcon($phase) -takefocus 1 202 $dedit.entry1 selection range 0 end 203 grid $dedit.lbl1 -column 0 -row 0 204 grid $dedit.entry1 -column 0 -row 1 205 focus $dedit.entry1 206 } 207 button $dedit.quit -text "Set" -command "destroy $dedit" 208 grid $dedit.quit -column 0 -row 2 209 putontop $dedit 210 tkwait window $dedit 211 afterputontop 212 } 213 214 215 216 217 # puts "phase = $phase" 218 # puts "var = $var" 219 # puts "new value = [set ${var}($phase)]" 176 } 177 178 179 # if {[set ${var}($phase)] == "fixed search range"} {} 180 if {[set ${var}($phase)] != "none" && [set ${var}($phase)] != "radii" } { 181 catch {destroy .disaglcon.top} 182 set dedit .disaglcon.top 183 toplevel $dedit 184 bind $dedit <Return> "destroy $dedit" 185 # frame $dedit -bd 2 -relief groove 186 # pack $dedit -side top 187 set temp [regexp {[0-9]+.[0-9]+} [set ${var}($phase)]] 188 if {$temp == 0} {set ${var}($phase) 0.00} 189 if {$var == "::da_acon"} { 190 label $dedit.lbl1 -text "set angle fixed search range \n for phase $phase in angstroms" 191 # set ::da_acon($phase) 0 192 entry $dedit.entry1 -textvariable ::da_acon($phase) -takefocus 1 193 $dedit.entry1 selection range 0 end 194 grid $dedit.lbl1 -column 0 -row 0 195 grid $dedit.entry1 -column 0 -row 1 196 focus $dedit.entry1 197 } 198 if {$var == "::da_dcon"} { 199 # set ::da_dcon($phase) 0 200 label $dedit.lbl1 -text "set bond fixed search range \n for phase $phase in angstroms" 201 entry $dedit.entry1 -textvariable ::da_dcon($phase) -takefocus 1 202 $dedit.entry1 selection range 0 end 203 grid $dedit.lbl1 -column 0 -row 0 204 grid $dedit.entry1 -column 0 -row 1 205 focus $dedit.entry1 206 } 207 button $dedit.quit -text "Set" -command "destroy $dedit" 208 grid $dedit.quit -column 0 -row 2 209 putontop $dedit 210 tkwait window $dedit 211 afterputontop 212 } 213 214 215 216 217 # puts "phase = $phase" 218 # puts "var = $var" 219 # puts "new value = [set ${var}($phase)]" 220 220 } 221 221 222 222 proc DA_Radii_Box {dcb args} { 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 223 #construct radii control box 224 catch {destory $dcb.radcon} 225 catch {destory $dcb.discon} 226 set radcon $dcb.radcon 227 frame $radcon -bd 2 -relief groove 228 grid $radcon -column 1 -row 0 -rowspan 2 229 230 label $radcon.lbl1 -text "Atom/Ion" 231 label $radcon.lbl2 -text "Bond \n Search Radii" 232 label $radcon.lbl3 -text "Angle \n Search Radii" 233 grid $radcon.lbl1 -row 0 -column 0 234 grid $radcon.lbl2 -row 0 -column 1 235 grid $radcon.lbl3 -row 0 -column 2 236 set count 1 237 foreach j [array names ::da_drad] { 238 label $radcon.atom$j -text "$j" -width 5 239 entry $radcon.drad$j -textvariable ::da_drad($j) -width 6 -takefocus 1 240 entry $radcon.arad$j -textvariable ::da_arad($j) -width 6 -takefocus 1 241 grid $radcon.atom$j -row $count -column 0 242 grid $radcon.drad$j -row $count -column 1 243 grid $radcon.arad$j -row $count -column 2 244 incr count 245 } 246 246 } 247 247 248 248 249 249 proc DA_Inc_Drad {args} { 250 251 252 250 foreach j [array names ::da_drad] { 251 set ::da_drad($j) [format %.1f [expr $::da_drad($j) + 0.1]] 252 } 253 253 } 254 254 255 255 proc DA_Dec_Drad {args} { 256 257 258 256 foreach j [array names ::da_drad] { 257 set ::da_drad($j) [format %.1f [expr $::da_drad($j) - 0.1]] 258 } 259 259 } 260 260 proc DA_Inc_Arad {args} { 261 262 263 261 foreach j [array names ::da_arad] { 262 set ::da_arad($j) [format %.1f [expr $::da_arad($j) + 0.1]] 263 } 264 264 } 265 265 proc DA_Dec_Arad {args} { 266 267 268 266 foreach j [array names ::da_drad] { 267 set ::da_arad($j) [format %.1f [expr $::da_arad($j) - 0.1]] 268 } 269 269 } 270 270 271 271 proc DA_Save {args} { 272 273 274 275 276 277 278 279 280 281 282 272 foreach i $::da_list { 273 if {$::da_drad($i) >= 0 && $::da_drad($i) <= 10000} { 274 AtmTypInfo distrad $i set $::da_drad($i) 275 } 276 puts 1 277 if {$::da_arad($i) >= 0 && $::da_arad($i) <= 10000} { 278 AtmTypInfo angrad $i set $::da_arad($i) 279 } 280 281 } 282 foreach j $::da_phase { 283 283 phaseinfo $j DistCalc set $::da_dcon($j) 284 284 phaseinfo $j AngCalc set $::da_acon($j) 285 286 287 288 289 290 } 285 } 286 # indicate a change to the .EXP file 287 incr ::expgui(changed) 288 set ::da_quit 0 289 destroy .disaglcon 290 } -
trunk/distrest.tcl
r1025 r1166 37 37 38 38 proc DisplayDistanceRestraints {args} { 39 #puts DisplayDistanceRestraints 39 40 global expcons 40 41 eval destroy [winfo children $expcons(distmaster)] … … 51 52 -sticky nsew 52 53 grid [frame $phasebox -bd 2 -relief groove] -column 0 -row 0 \ 53 54 -sticky new -columnspan 2 54 55 55 56 56 57 grid [frame $editorbox -bd 2 -relief groove] -column 0 -row 2 \ 57 58 -sticky sew -columnspan 2 58 59 59 60 … … 64 65 # Pick Phase to be Evaluated ********************************************** 65 66 label $phasebox.phlabel -text Phase 66 # set ::sr_phaselist $::expmap(phaselist)67 # set ::sr_phaselist $::expmap(phaselist) 67 68 68 69 eval tk_optionMenu $phasebox.phase ::sr_entryvar(softphase) $::expmap(phaselist) 69 # eval tk_optionMenu $phasebox.phase ::sr_entryvar(softphase) $::sr_phaselist70 # trace variable ::sr_entryvar(softphase) w DisplayDistanceRestraints71 # bind $phasebox.phase <ButtonRelease> {DisplayDistanceRestraints}70 # eval tk_optionMenu $phasebox.phase ::sr_entryvar(softphase) $::sr_phaselist 71 # trace variable ::sr_entryvar(softphase) w DisplayDistanceRestraints 72 # bind $phasebox.phase <ButtonRelease> {DisplayDistanceRestraints} 72 73 73 74 grid $phasebox.phlabel -column 0 -row 0 … … 78 79 grid [label $leftfr.lweight -text "Restraint Weight"] -column 0 -row 1 -sticky sw -pady 10 79 80 grid [entry $leftfr.weight -width 8 -textvariable entryvar(distrestweight)] -column 1 -row 1 -sticky sw \ 80 81 -padx 5 -pady 10 81 82 set ::entrycmd(distrestweight) "SoftConst weight" 82 83 set ::entrycmd(trace) 0 83 84 set ::entryvar(distrestweight) [SoftConst weight] 85 RecordMacroEntry "set ::entryvar(distrestweight) [SoftConst weight]" 0 84 86 set ::entrycmd(trace) 1 85 87 incr ::expgui(changed) 86 88 87 89 #Run Disagl Commands ***************************************************** … … 95 97 grid [button $editorbox.edit -text "Activate Restraint \n Editor" -command SR_TEST] -column 0 -row 4 \ 96 98 -columnspan 2 -pady 5 97 99 $editorbox.edit config -bg LightGreen -bd 6 98 100 99 101 grid [button $editorbox.search -text "Edit Search Distance \n Parameters" -command DA_Control_Panel] -column 0 -row 3 \ 100 102 -columnspan 2 101 103 $editorbox.edit config -bd 4 102 104 103 105 … … 114 116 115 117 label $top.rlabel1 -text "Restraint" -width 9 -anchor center 116 label $top.rlabel2 -text " esd"-width 9 -anchor center118 label $top.rlabel2 -text "Tolerance" -width 9 -anchor center 117 119 118 120 grid $top.alabel1 -column 1 -row 2 -padx 3 … … 139 141 SR_Show_RestraintsOnly $main $rightfr 140 142 foreach item [trace vinfo ::sr_entryvar(softphase)] { 141 143 eval trace vdelete ::sr_entryvar(softphase) $item 142 144 } 143 145 … … 148 150 SR_Fill_Display $main 149 151 ResizeScrollTable $rightfr 152 #puts $rightfr 150 153 } 151 154 … … 336 339 337 340 label $sr_top.rlabel1 -text "Restraint" 338 label $sr_top.rlabel2 -text " esd"341 label $sr_top.rlabel2 -text "Tolerance" 339 342 grid $sr_top.rlabel1 -column 4 -row 2 -padx 20 340 343 grid $sr_top.rlabel2 -column 5 -row 2 -padx 20 341 344 342 345 343 button $sr_top.rcon1 -text "Check All" -width 10-command "346 button $sr_top.rcon1 -text "Check\nAll" -width 4 -command " 344 347 set ::sr_checkall 1; 345 348 SR_Set_All_Check_Buttons; … … 348 351 " 349 352 350 button $sr_top.rcon2 -text "Clear All" -width 10-command "353 button $sr_top.rcon2 -text "Clear\nAll" -width 4 -command " 351 354 set ::sr_checkall 0; 352 355 SR_Set_All_Check_Buttons; … … 396 399 label $main.rdistance$i -text [lindex $rprint 8] -justify center -anchor center 397 400 entry $main.restraint$i -width 8 -textvariable ::sr_restraintdist([lindex $rprint 13]) -takefocus 1 398 401 $main.restraint$i selection range 0 end 399 402 bind $main.restraint$i <KeyRelease> {SR_Validate_Soft %W distance} 400 403 entry $main.restesd$i -width 8 -textvariable ::sr_restraintesd([lindex $rprint 13]) -takefocus 1 401 404 $main.restesd$i selection range 0 end 402 405 bind $main.restesd$i <KeyRelease> {SR_Validate_Soft %W esd} 403 406 checkbutton $main.sr_crestraint$i -variable ::sr_crestraint([lindex $rprint 13]) … … 458 461 # valid value 459 462 $win config -fg black 460 $::srcb3.rbutton3 config -bg LightGreen -text "Save Restraints to EXP File"463 $::srcb3.rbutton3 config -bg LightGreen -text "Save Changes" 461 464 set ::sr_error 0 462 465 } … … 515 518 set sr_write "" 516 519 set new_list "" 517 # set len [llength $::sr_bond_list]520 # set len [llength $::sr_bond_list] 518 521 set ::sr_key_list "" 519 522 foreach temp $::sr_bond_list { 520 puts $temp 521 # for {set i 0} {$i <= [expr $len-1]} {incr i} {} 522 # set temp [lindex $::sr_bond_list $i] 523 524 catch { 525 if {[string trim $::sr_restraintdist([lindex $temp 13])] != ""} { 526 set softrest "[lindex $temp 0] [lindex $temp 1] \ 523 # for {set i 0} {$i <= [expr $len-1]} {incr i} {} 524 # set temp [lindex $::sr_bond_list $i] 525 526 if {[catch { 527 if {[string trim $::sr_restraintdist([lindex $temp 13])] != ""} { 528 set softrest "[lindex $temp 0] [lindex $temp 1] \ 527 529 [lindex $temp 2] [lindex $temp 3] [lindex $temp 4] \ 528 530 [lindex $temp 5] [lindex $temp 6] [lindex $temp 7]\ 529 531 $::sr_restraintdist([lindex $temp 13])\ 530 532 $::sr_restraintesd([lindex $temp 13])" 531 lappend sr_write $softrest 532 puts $softrest 533 lappend new_list $temp 534 } 535 } 533 lappend sr_write $softrest 534 #lappend new_list $temp 535 } 536 } errmsg]} {puts "error: $errmsg"} 536 537 } 537 #538 # 538 539 #puts $sr_write 539 540 # put the entire restraint list back into the .EXP file 541 #puts "SoftConst restraintlist set $sr_write" 540 542 SoftConst restraintlist set $sr_write 541 set ::sr_bond_list $new_list 543 RecordMacroEntry "SoftConst restraintlist set $sr_write" 0 544 #set ::sr_bond_list $new_list 542 545 # indicate a change to the .EXP file 543 546 incr ::expgui(changed) … … 623 626 label $srcb1.dmaxlabel -text "Dmax" 624 627 label $srcb2.restlabel -text "Restraint Value" -width 16 -anchor w 625 label $srcb2.restlabelesd -text " esd"628 label $srcb2.restlabelesd -text "Tolerance" 626 629 627 630 eval tk_optionMenu $srcb1.atom1 ::sr_entryvar(softatom1) "[lsort [array names ::sr_lookuplist1${::sr_entryvar(softphase)}]] all" … … 630 633 631 634 entry $srcb1.sr_dminvalue -width 8 -textvariable ::sr_dminvalue -takefocus 1 632 635 $srcb1.sr_dminvalue selection range 0 end 633 636 entry $srcb1.sr_dmaxvalue -width 8 -textvariable ::sr_dmaxvalue -takefocus 1 634 637 $srcb1.sr_dmaxvalue selection range 0 end 635 638 entry $srcb2.sr_rvalue -width 8 -textvariable ::sr_rvalue -takefocus 1 636 639 $srcb2.sr_rvalue selection range 0 end 637 640 entry $srcb2.sr_resd -width 8 -textvariable ::sr_resd -takefocus 1 638 641 $srcb2.sr_resd selection range 0 end 639 642 640 643 bind $srcb1.sr_dminvalue <KeyRelease> {SR_Validate_Soft %W dmin} … … 644 647 645 648 button $srcb1.recalc -text "Filter" -bd 6 -command {SR_Display} 646 button $srcb2.rbutton1 -text "check update" -command {SR_Update_Restraints} 647 button $srcb2.rbutton2 -text "check delete" -command {SR_Delete_Restraints} 648 button $::srcb3.rbutton3 -text "Save Restraints to EXP File" -bd 6 -bg LightGreen -command {SR_Write_Restraints} 649 button $::srcb3.rbutton4 -text "Cancel" -command {destroy .mainrestraintbox 649 button $srcb2.rbutton1 -text "Set checked" -command {SR_Update_Restraints} 650 button $srcb2.rbutton2 -text "Delete checked" -command {SR_Delete_Restraints} 651 button $::srcb3.rbutton3 -text "Save changes" -bd 6 -bg LightGreen -command {SR_Write_Restraints} 652 button $::srcb3.rbutton4 -text "Cancel" -command { 653 destroy .mainrestraintbox 650 654 afterputontop 651 655 SR_Rest_Only 652 DisplayDistanceRestraints} 653 wm protocol .mainrestraintbox WM_DELETE_WINDOW {destroy .mainrestraintbox 656 DisplayDistanceRestraints 657 } 658 wm protocol .mainrestraintbox WM_DELETE_WINDOW { 659 destroy .mainrestraintbox 654 660 afterputontop 655 661 SR_Rest_Only 656 DisplayDistanceRestraints} 662 DisplayDistanceRestraints 663 } 657 664 658 665 grid $srcb1.atomlabel1 -column 1 -row 0 … … 725 732 set ::sr_distance_button 1 726 733 set ::sr_entryvar(choicenum) 0 727 # set ::sr_entryvar(softphase) "1"728 # set ::sr_phaselist $::expmap(phaselist)734 # set ::sr_entryvar(softphase) "1" 735 # set ::sr_phaselist $::expmap(phaselist) 729 736 set ::sr_entryvar(softatom1) "all" 730 737 set ::sr_entryvar(softatom2) "all" -
trunk/doc/excledt.html
r971 r1166 283 283 </TH></TR></TABLE> 284 284 285 <P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR>286 <font size=-1><? lastmod(); ?> </font>287 <br>$Revision$ $Date$288 285 </blockquote> 289 286 </body> -
trunk/doc/expgui.html
r973 r1166 16 16 EXPGUI<BR> 17 17 A Graphical User Interface for 18 <A Href="http ://www.ncnr.nist.gov/programs/crystallography/software/gsas.html">18 <A Href="https://subversion.xor.aps.anl.gov/trac/EXPGUI/wiki/GSASIntro"> 19 19 GSAS</A> 20 20 <HR noshade width="75%" size="2" align="center"> … … 34 34 <P><P> 35 35 EXPGUI is a graphical interface for the 36 Los Alamos 37 <A Href="http://www.ncnr.nist.gov/programs/crystallography/software/gsas.html"> 38 GSAS</A> package. 36 <A Href="https://subversion.xor.aps.anl.gov/trac/EXPGUI/wiki/GSASIntro">GSAS</A> 37 package, developed at Los Alamos and maintained now at Argonne. 39 38 EXPGUI does two things: 40 39 it can be used to directly modify the GSAS … … 60 59 <TH><A Href="expgui4.html">Scaling info</A></TH> 61 60 <TH><A Href="expgui5.html">Profile terms</A></TH> 62 <TH><A Href="expgui6.html">Constraints </A></TH>61 <TH><A Href="expgui6.html">Constraints & Restraints</A></TH> 63 62 </TR> 64 63 <TR> 64 <TH><A Href="expgui6A.html">Rigid Bodies</A></TH> 65 65 <TH><A Href="expgui7.html">Preferred Orientation</A></TH> 66 66 <TH><A Href="expguic.html">Menus</A></TH> … … 117 117 A.C. Larson and R.B. Von Dreele, "General Structure Analysis System (GSAS)", 118 118 Los Alamos National Laboratory Report LAUR 86-748 (2000). 119 <A HREF="http://www.ccp14.ac.uk/ccp/ccp14/ftp-mirror/gsas/public/gsas/manual/GSASManual.pdf"> 119 <A 120 HREF="https://subversion.xor.aps.anl.gov/EXPGUI/gsas/all/GSAS%20Manual.pdf"> 120 121 [link to PDF copy of manual] 121 122 </A> … … 154 155 are used. The File/Save operation is done automatically before any GSAS 155 156 programs, such as GENLES or EXPEDT, are run. 157 <P> 158 <A name="badexp"> 159 The GSAS refinement program, GENLES, will sometimes "blow up", where the 160 program changes varied parameters to values very far from their 161 correct values. This occurs when parameters are highly correlated, 162 are refining to values that are not allowed, or some of the refined parameters have 163 very little impact on the quality of the fit. When this happens, 164 invalid values are written to the GSAS experiment file that contain 165 either asterisks (****) or the string "NAN" (not a number). Such 166 files cannot be used for additional GENLES runs. 167 <P> 168 When EXPGUI reads a .EXP file it scans it for evidence of a previous 169 failure of a GENLES refinement and warns if a problem is 170 noted. Please note that this scan is not perfect and occasionally 171 you may be warned in cases where the file is fine (if possible, 172 please send such .EXP file to Brian Toby so this scan can be improved.) 173 When such a "bad" .EXP file is located, one can "revert" to an 174 archived copy of a previous experiment file (with suffix .Oxx). This 175 can be done with the Revert menu item in the File menu. Note that 176 clicking on a file in the file selection window causes it to be 177 scanned and shows the status of that refinement. Also note that 178 usually the last good archived file has settings that will produce the same bad 179 refinement, so it is necessary to either revert further back, or to 180 change the refinement options before running GENLES. 156 181 <P> 157 182 … … 475 500 476 501 The INSTEDIT utility is used to edit or create an instrument parameter file. 477 At this time it can only be used to edit files for 478 constant-wavelength data. The utility can be started from the "Edit File" 479 button in the 502 The utility can be started from the "Edit File" button in the 480 503 <A HREF="expgui3.html#AddHist">"Add New Histogram"</A> dialog, or from the 481 the "instedit" option in the Powder menu. In the latter case, the user 482 is given the chance to select an input file. If no file is selected, 483 a new, empty, file is created. An example INSTEDIT window appears below. 504 the "instedit" option in the Powder menu. Alternately, to create a new 505 instrument parameter file, choose Powder menu option "New InstParm 506 file". (It is also possible 507 to create a new file using the standard instedit by selecting 508 "Cancel" when asked for an input file.) 509 An example INSTEDIT window appears below. 484 510 <P> 485 511 <img SRC="instedit1.gif" align=RIGHT alt="EXPGUI Screen snapshot"> … … 593 619 records can slow the GSAS programs 594 620 (this is less of a problem on faster computers). For these reasons, it may be 595 a good idea to prune the older history records from the file. If more than 100 596 history records are found in an experiment file, EXPGUI suggests that the 597 older history entries be deleted. Alternately the File/EraseHistory command 598 can be used to invoke the this option. 621 a good idea to prune the older history records from the file. 622 The File/EraseHistory command can be used to invoke the this option. 599 623 <P> 600 624 On the dialog the number of history records to be retained is specified. … … 681 705 <A name=tcltk> 682 706 <H2> 683 <A Href="http://www. ncnr.nist.gov/programs/crystallography/software/tclpkgs.html">707 <A Href="http://www.tcl.tk"> 684 708 Tcl/Tk</A></H2> 685 709 The 686 <A Href="http://www. ncnr.nist.gov/programs/crystallography/software/tclpkgs.html">710 <A Href="http://www.tcl.tk"> 687 711 Tcl/Tk program</A> is a platform-independent scripting language that is 688 712 used to implement most of EXPGUI. This software is available for free 689 and must be loaded in order to use EXPGUI. See the 690 installation notes for 691 <A HREF="expgui_Win_readme.html">Windows</A>, 692 and for 693 <A HREF="expgui_Unix_readme.html">UNIX</A> for information on how to do this. 713 and must be loaded in order to use EXPGUI. A somewhat out of date 714 version of Tcl/Tk (8.4) is distributed with EXPGUI (ncnrpack.exe, etc.) but 715 more recent versions can be used, but note that the BLT package (see 716 below) is needed for all features of EXPGUI. 694 717 While learning Tcl/Tk is a great thing to do, it is not a requirement 695 718 for using or installing EXPGUI. 696 697 <A name=winexec>698 <H3>699 WINEXEC</H3>700 <UL>701 The WINEXEC package is needed under Windows-95 and its offspring702 (-98 and -ME). See the <A HREF="expgui_Win_readme.html">Windows installation703 notes</A> for more details.704 </UL>705 719 706 720 <A name=blt> … … 715 729 If this is the case, a message, 716 730 "BLT Setup Error: could not access a Blt_ routine...", will be displayed. 717 This is most common in UNIX and is discussed further in the 718 <A HREF="expgui_Unix_readme.html">UNIX installation notes</A>. Also see 719 <A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/tclpkgs.html"> 720 http://www.ncnr.nist.gov/programs/crystallography/software/tclpkgs.html 721 </A> for more information on installation of BLT. 731 Use of the ncnrpack file distributed with EXPGUI usually avoids this problem. 722 732 </UL> 723 733 … … 727 737 <UL> 728 738 The 729 <A HREF=" www.hume.com">Hume739 <A HREF="http://www.hume.com">Hume 730 740 </A> 731 741 Linear Algebra Tcl Package, 732 <A HREF=" www.hume.com">742 <A HREF="http://www.hume.com/la/la.html"> 733 743 La</A>, 734 744 is used by the BKGEDIT … … 739 749 should not happen, since the package is included with the EXPGUI files. 740 750 So if get this error you probably have an incomplete installation. 741 Note that the La package requires Tcl/Tk version 8.1 or higher, so that if 742 you are using an older version of Tcl/Tk, you will need to upgrade. 743 See the installation instructions for 744 <A HREF="expgui_Win_readme.html">Windows</A>, 745 and for 746 <A HREF="expgui_Unix_readme.html">UNIX</A> for more information on Tcl/Tk. 751 </UL> 752 753 <A name=winexec> 754 <H3> 755 WINEXEC</H3> 756 <UL> 757 The WINEXEC package was needed under Windows-95 and its offspring 758 (-98 and -ME). It was found in older versions of EXPGUI, but is no 759 longer included. 747 760 </UL> 748 761 … … 750 763 Acknowledgments</H2> 751 764 Praise to Larson and 752 Von Dreele for GSAS, <A HREF="http:// www.scriptics.com/">Ousterhout</A>765 Von Dreele for GSAS, <A HREF="http://home.pacbell.net/ouster/">John Ousterhout</A> 753 766 for Tcl/Tk, 754 Przemek Klosowski </A>767 Przemek Klosowski 755 768 for convincing me to learn Tcl/Tk 756 and Jonathan Wasserman for helping get this project started. 757 Thanks also to 769 and Jonathan Wasserman for helping me get this project started. 770 Thanks also to 771 Charles Lake of Indiana University of PA for working on many recent additions to EXPGUI, including the 772 bond-distance restraints module and the (soon to come) rigid body editor; 758 773 Pamela Whitfield of the NRC (Canada) for writing large 759 774 sections of the … … 763 778 code and to John Cowgill for the "Export to GRACE" code. 764 779 <P> 765 <A Href="http ://www.ncnr.nist.gov/programs/crystallography/software/gsas.html">780 <A Href="https://subversion.xor.aps.anl.gov/trac/EXPGUI/wiki/GSASIntro"> 766 781 GSAS</A> 767 782 is written by Allen C. Larson and Robert B. Von Dreele while at … … 770 785 <A HREF="MAILTO:vondreele@anl.gov">vondreele@anl.gov</A> 771 786 EXPGUI was written by Brian H. Toby while at the NIST Center for Neutron Research, 772 <A HREF="MAILTO:Brian.Toby@ANL.GOV">Brian.Toby@ANL.GOV</A> 773 with help from Jonathan Wasserman. 787 <A HREF="MAILTO:Brian.Toby@ANL.GOV">Brian.Toby@ANL.GOV</A>. 774 788 775 789 <P><hr><blockquote> … … 786 800 software. 787 801 788 <P> The author of EXPGUI is a U.S. Government employeewhich means that802 <P>EXPGUI was written by a U.S. Government employee, which means that 789 803 EXPGUI is not subject to copyright. Have fun with it. Modify it. Please write 790 804 new sections and make them available to the rest of the world. … … 793 807 expressed or implied, or assumes any liability or responsibility 794 808 for the use of this information or the software described 795 here. Brand names cited herein are used for 796 identification purposes and do not constitute an endorsement by NIST. 809 here. 797 810 </blockquote> 798 811 -
trunk/doc/expgui0.html
r971 r1166 44 44 </TH></TR></TABLE> 45 45 46 <P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR> 47 <font size=-1><? lastmod(); ?> </font> 48 <br>$Revision$ $Date$ 49 </blockquote> 46 /blockquote> 50 47 </body> 51 48 </html> -
trunk/doc/expgui1.html
r971 r1166 186 186 </TH></TR></TABLE> 187 187 188 <P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR>189 <font size=-1><? lastmod(); ?> </font>190 <br>$Revision$ $Date$191 188 </blockquote> 192 189 </body> -
trunk/doc/expgui2.html
r971 r1166 80 80 <P> 81 81 <a name="xform"></a> 82 <h4>A.2.2 Transform Coordinates</h4> 83 <DL><DL> 84 <img SRC="2a.gif" align=RIGHT alt="EXPGUI Screen snapshot"> 85 If one or more atoms have been selected 86 <A href="expgui.html#mouseactions">(see Mouse Actions)</A>, it is possible 87 to make changes to those atoms by pressing the "Xform atom(s)" button. 88 This raises the window shown to the right. 89 Note that no changes are actually made, until the 90 "Transform Coordinates", "Set Occupancies",... buttons are pressed. 91 <P> 92 This window can be used 93 to transform the coordinates coordinates of the selected atoms, 94 globally set occupancy or Uiso (Uequiv) 95 values for the selected atoms, or erase the selected atoms. by pressing the 96 It is also possible to transform the selected atoms 97 from isotropic to anisotropic, or the reverse. 98 <P> 99 <IMG SRC="new.gif" alt="New!"> 100 The "Xform Origin 1 to Origin 2" button is only available for those 82 <h4>A.2.2 Modify Atom</h4> 83 <DL><DL> 84 <img SRC="2a.jpg" align=RIGHT alt="EXPGUI Screen snapshot"> 85 The "Modify Atom" button ("Modify Atoms" when multiple atoms are 86 selected) provides access to additional options that can 87 transform or modify the selected atom(s) from the phase panel 88 <A href="expgui.html#mouseactions">(see Mouse Actions</A> for 89 information on selecting atoms); this opens the menu window shown to 90 the right. 91 Note that changes are made to the coordinates when the buttons on this 92 window (such as 93 "Transform Coordinates", "Set Occupancies",...) are pressed. 94 <P><B>Modify Coordinates:</B> 95 This is used 96 to transform the coordinates coordinates of the selected atoms using a 97 set of transformation relationships. 98 99 <P><B>Reset Multiplicities:</B> 100 When atom positions are edited in EXPGUI, they may be moved off from 101 or onto special positions in the cell, changing the site 102 multiplicity -- but this will not be reflected in the phase 103 display. When atoms are subsequently refined, GENLES will update the 104 multiplcities. Pressing the "Reset Multiplicities" button cases 105 this to be done right away (I think this may not work if there are no 106 histograms present). 107 108 <P><B>Xform Origin 1 to Origin 2:</B> This button is only available for those 101 109 orthorhombic, tetragonal and cubic space groups that are listed in the 102 110 International Tables with two origin settings. (These space groups have … … 106 114 of symmetry. GSAS only uses the origin 2 settings.) 107 115 If coordinates have been entered in the origin 1 setting, they may be 108 transformed to the origin 2 setting using this button. 116 transformed to the origin 2 setting using this button. It is important 117 to select all atoms in the asymmetric unit before using this button. 118 119 <P><B>Modify Occupancies:</B> 120 This allows the occupancy to be set for one or more atoms. It is 121 most convenient for when many atoms will have their occupancy 122 changed at one time. 123 124 <P><B>Modify Displacement Parameters:</B> 125 This allows one to set Uiso (or Uequiv) values for the selected 126 atoms (<B>Set U</B>). To change the flag that determines if the 127 selected atom(s) are represented as Isotropic or Anisotropic, press 128 the <B>Set Isotropic</B> or <B>Set Anisotropic</B> buttons. 129 130 <P><B>Erase Atoms:</B> 131 The "Erase Atoms" removes the selected atoms from the phase. I 132 usually set the occupancy to 0. instead. 133 134 <P><B>Fix Atom Coordinates:</B> 135 When an atom is refined in GSAS, only the coordinates that are not 136 defined by site symmetry are refined. However, in some space groups, 137 it is necessary to not refine additional coordinates. The most common 138 example are polar space groups (P1, P2, P2<sub>1</sub>, C2, P4, P4<sub>1</sub>, P 139 4<sub>2</sub>, P4<sub>3</sub>, I4, I4<sub>1</sub>, P3, P3<sub>1</sub>, P3<sub>2</sub>, R3, P6, P6<sub>1</sub>, P6<sub>5</sub>, P6<sub>2</sub>, P6<sub>4</sub> and 140 P6<sub>3</sub> - from 141 <a href="http://www.ruppweb.org/Xray/comp/space_instr.htm"> Bernard Rupp's 142 web site, http://www.ruppweb.org/Xray/comp/space_instr.htm</A>) where 143 one or more coordinates of the origin are not defined by symmetry. In 144 these space groups an appropriate number of coordinates must be fixed 145 to define the origin. As an example, in P1, one x, one y and one z 146 coordinate must not be refined; in space group P2<sub>1</sub>, the 147 2<sub>1</sub> screw axis defines the origin at (0,0,z) so one z 148 coordinate cannot be varied. 149 150 Occasionally, while symmetry may allow 151 atom coordinates to be varied, a crystallographer may choose to 152 simplify or constrain the representation to fix the atom in a 153 particular location and not refine with all allowed degrees of freedom. 154 155 <IMG SRC="new.gif" alt="New!"> 156 The "Fix Atom Coordinates" buttons allows a flag to be set (or 157 cleared) for an atom 158 to prevent refinement of selected coordinates, even when the X 159 refinement flag is set. Note the addition of an "F" for the x and z 160 coordinates of the first atom as shown in the phase panel, above. This 161 indicates that x & z have been fixed. When the atom position is 162 varied, only y will be optimized. 109 163 110 164 <br clear=all> … … 248 302 </TH></TR></TABLE> 249 303 250 <P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR>251 <font size=-1><? lastmod(); ?> </font>252 <br>$Revision$ $Date$253 304 </blockquote> 254 305 </body> -
trunk/doc/expgui3.html
r971 r1166 31 31 <HR noshade width="75%" size="2" align="center"> 32 32 </h1></center> 33 <h3>A.3 Histogrampanel</h3>34 <DL><DL> 35 The histogrampanel is used to edit background36 and diffractometer constants for a histogram, as well as33 <h3>A.3 Powder panel</h3> 34 <DL><DL> 35 The Powder (was histogram) panel is used to edit background 36 and diffractometer constants for powder histogram(s), as well as 37 37 set damping and refinement flags for these parameters. 38 38 <P> … … 288 288 </TH></TR></TABLE> 289 289 290 <P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR>291 <font size=-1><? lastmod(); ?> </font>292 <br>$Revision$ $Date$293 290 </blockquote> 294 291 </body> -
trunk/doc/expgui4.html
r971 r1166 60 60 </TH></TR></TABLE> 61 61 62 <P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR>63 <font size=-1><? lastmod(); ?> </font>64 <br>$Revision$ $Date$65 62 </blockquote> 66 63 </body> -
trunk/doc/expgui5.html
r971 r1166 118 118 </TH></TR></TABLE> 119 119 120 <P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR>121 <font size=-1><? lastmod(); ?> </font>122 <br>$Revision$ $Date$123 120 </blockquote> 124 121 </body> -
trunk/doc/expgui6.html
r971 r1166 22 22 <TABLE BORDER BGCOLOR="#FFFF40" ALIGN=RIGHT> 23 23 <TR><TH><A Href="expgui.html">EXPGUI top</A> 24 </TH><TH><A Href="expgui 7.html">Next page</A>24 </TH><TH><A Href="expgui6A.html">Next page</A> 25 25 </TH><TH><A Href="expgui5.html">Previous page</A> 26 26 </TH></TR></TABLE><BR CLEAR=ALL> … … 32 32 </h1></center> 33 33 34 <h3>A.6 Constraints panel</h3>34 <h3>A.6 Re/Constraints panel</h3> 35 35 <DL><DL> 36 36 GSAS offers two types of restraints that can be included in a model. … … 41 41 by grouping parameters so that a single shift (possibly scaled) is 42 42 applied to each parameter in the group. 43 The constraints panel is used to set these "hard constraints." 43 The Re/Constraints panel is used to set these "hard constraints" or in 44 the case of bond distances, "restraints". 44 45 At this time the only constraints that can be set in EXPGUI are on atomic 45 and profile profile (others can be set in EXPEDT). 46 and profile profile (others can be set in EXPEDT). EXPEDT offers many 47 other types of restraints as well. 46 48 <P> 47 49 Note that these constraints are only applied to shifts, but not to the … … 212 214 usually make sense and EXPGUI does not allow it. 213 215 </DL></DL> 216 <a name="DistanceRestraints"></a> 217 <H4>Distance Restraints</H4> 218 <DL><DL> 219 When the distance restraints tab is first selected, the active 220 distance restraints for the selected phase are shown. The <B>Atom 1</B> and 221 <B>Atom 2</B> buttons can be used to sort this list. 222 <P> 223 The <B>Restraint Weight</B> parameter is very important. As this 224 determines how strongly the distance restraints will be used in the 225 refinement relative to the diffraction data. This value is sometimes 226 set as high as 500,000 in the initial stages of a fit, but should be 227 lowered as much as is possible in the final stages of the fit, as 228 needed to obtain chemically plausible interatomic distances. For 229 some refinements, a value of 0.0 is possible for the Restraint 230 Weight in the final stages. This removes any restraint effect. 231 232 To see how restraints are affecting the refinement, one can look at 233 the ratio of the "Sum(w*d**2)" (shown in the .LST file) for the 234 diffraction histograms vs. the restraint histogram. 235 <P> 236 The <B>Active Restraints Editor</B> can be used to select distances 237 to be restrained or edit the restraints. If there are too many 238 distances shown, the options at the top of the window can be used to 239 select a distance range, or specific atoms to include. Likewise, 240 only restrained or unrestrained distances can be selected. The 241 changes are applied when the <B>Filter</B> button is pressed. 242 <P> 243 The bottom section of the window shows individual interatomic 244 distances. A <B>Restraint</B> and <B>Tolerance</B> value is needed to restrain 245 that distance. The quantity minimized is 246 <blockquote> 247 <blockquote> 248 "Restraint Weight" * SUM{ [ (Distance - Restraint) / Tolerance ]**2 } 249 </blockquote> 250 </blockquote> 251 thus the "Tolerance" provides individual weighting for each 252 restraint. 253 <P> 254 To set a large number of restraints at the same time, select the 255 check button next to the distance(s), or use the <B>Check 256 All</B>. Then use the section above to enter a global 257 <B>Restraint</B> and <B>Tolerance</B> value. These values are set 258 when the <B>Set Checked</B> button is used. The <B>Delete 259 Checked</B> button removes restraints from all selected distances. 260 <P> 261 The entered restraint information will be used onlt when the <B>Save 262 Changes</B> button is pressed. The <B>Cancel</B> button will reverse 263 any changes made while the window is open. Closing the window has 264 the same effect as "Cancel." 265 <P> 266 Note that the interatomic distances that are shown are determined by 267 the parameters to program DISAGL. These are controlled with the 268 <B>Edit Search Distance Parameters</B> button. 269 270 </DL></DL> 214 271 <hr> 215 272 <TABLE BORDER BGCOLOR="#FFFF40" ALIGN=RIGHT> 216 273 <TR><TH><A Href="expgui.html">EXPGUI top</A> 217 </TH><TH><A Href="expgui 7.html">Next page</A>274 </TH><TH><A Href="expgui6A.html">Next page</A> 218 275 </TH><TH><A Href="expgui5.html">Previous page</A> 219 276 </TH></TR></TABLE> 220 277 221 <P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR>222 <font size=-1><? lastmod(); ?> </font>223 <br>$Revision$ $Date$224 278 </blockquote> 225 279 </body> -
trunk/doc/expgui7.html
r971 r1166 23 23 <TR><TH><A Href="expgui.html">EXPGUI top</A> 24 24 </TH><TH><A Href="expguic.html">Next page (Menus)</A> 25 </TH><TH><A Href="expgui6 .html">Previous page</A>25 </TH><TH><A Href="expgui6A.html">Previous page</A> 26 26 </TH></TR></TABLE><BR CLEAR=ALL> 27 27 28 28 <center><h1> 29 29 <HR noshade width="75%" size="2" align="center"> 30 EXPGUI, part 730 EXPGUI, part 8 31 31 <HR noshade width="75%" size="2" align="center"> 32 32 </h1></center> 33 33 34 <h3>A. 7Preferential Orientation Panel</h3></a>34 <h3>A.8 Preferential Orientation Panel</h3></a> 35 35 <DL><DL> 36 36 The Preferential Orientation Panel is used to control parameters related … … 43 43 </DL></DL> 44 44 <a name="MD"></a> 45 <h4>A. 7.a March-Dollase</H4>45 <h4>A.8.a March-Dollase</H4> 46 46 <DL><DL> 47 47 In this model one or more axes are designated … … 67 67 </DL></DL> 68 68 <a name="ODF"></a> 69 <H4>A. 7.b Spherical harmonic</H4>69 <H4>A.8.b Spherical harmonic</H4> 70 70 <DL><DL> 71 71 The spherical harmonic formulation, also referred to as an "orientation … … 98 98 <TR><TH><A Href="expgui.html">EXPGUI top</A> 99 99 </TH><TH><A Href="expguic.html">Next page (Menus)</A> 100 </TH><TH><A Href="expgui6 .html">Previous page</A>100 </TH><TH><A Href="expgui6A.html">Previous page</A> 101 101 </TH></TR></TABLE> 102 102 103 <P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR>104 <font size=-1><? lastmod(); ?> </font>105 <br>$Revision$ $Date$106 103 </blockquote> 107 104 </body> -
trunk/doc/expgui_intro.html
r971 r1166 70 70 Customization notes</A> 71 71 <LI> 72 <A HREF=" tutorial3/index.html">72 <A HREF="https://subversion.xor.aps.anl.gov/EXPGUI/tutorials/tutorial3/index.html"> 73 73 A well-annotated CW neutron tutorial (Alumina).</A> 74 74 <B><I>A very good place to start!</I></B> 75 75 <LI> 76 <A HREF=" tutorial1/index.html">76 <A HREF="https://subversion.xor.aps.anl.gov/EXPGUI/tutorials/tutorial1/index.html"> 77 77 A TOF Tutorial Example (Nickel)</A> 78 78 <LI> 79 <A HREF=" tutorial2/index.html">79 <A HREF="https://subversion.xor.aps.anl.gov/EXPGUI/tutorials/tutorial2/index.html"> 80 80 A CW Neutron Tutorial Example (Garnet)</A> 81 81 </UL> … … 164 164 <p><br><B>Who is to blame for EXPGUI?</B> 165 165 <blockquote>The initial version of the GUI part of EXPGUI was created by 166 Jonathan Wasserman (thanks Jon!) <a href="http://www.ncnr.nist.gov/staff/toby/">Brian166 Jonathan Wasserman (thanks Jon!) Brian 167 167 Toby</a> is irresponsible for the rest.</blockquote> 168 168 … … 170 170 <blockquote>Gee, you want to add some features... Great! You have all the 171 171 EXPGUI sources and 172 <A Href="http://www.ncnr.nist.gov/programs/crystallography/software/tclpkgs.html">Tcl/Tk</A> 173 is free. Oh, you want me to do it. Well, please 172 Tcl/Tk is free. Oh, you want me to do it. Well, please 174 173 ask and I will try. In particular, I am looking for good ideas on 175 174 how to design GUI's for different aspects of experiment editing, … … 177 176 178 177 <p><br><B>Mailing List</B> 179 <blockquote>If you would like to get news about EXPGUI, please send 180 <a href="mailto:brian.toby@anl.gov?subject=EXPGUI Mailing List">Brian.Toby@ANL.GOV</a> e-mail. The mailing list is not active at present, but 181 I hope to use it again to provide 178 <blockquote>If you would like to get news about EXPGUI, please 179 <a href="http://www.aps.anl.gov/mailman/listinfo/expgui">see this 180 link</a>. 181 The mailing list is used only to provide 182 182 information about updates and bug fixes. 183 183 </blockquote> -
trunk/doc/expguic.html
r971 r1166 49 49 experiment file from scratch. 50 50 <DT>expnam<DD> 51 Equivalent to Open , included since this is the command used in other52 GSAS shells to select GSAS experiments. 51 Equivalent to Open (included for historical reasons.) 52 53 53 <DT>Save<DD>Saves modifications to the current experiment file to disk (shortcut Alt-S). 54 54 <DT>Save As<DD>Saves modifications to the current experiment file to disk … … 60 60 offers the program user the option to update these files. The update 61 61 will fail if the user does not have permission to change the EXPGUI 62 or GSAS files. In this case, a system administrator may be needed. 62 or GSAS files. In this case, a system administrator may be needed. 63 <DT>revert<DD>Used to load an <a href="#archive">archived</A> 64 (backup) version of the current .EXP file. 63 65 <DT>EraseHistory<DD>Deletes old history records to speed reading of the .EXP file. 64 <DT>convert<DD>Convert a standard ASCII file to the direct access format used by GSAS (and for UNIX, the reverse) 66 <DT>convert<DD>Convert a standard ASCII file to the direct access 67 format used by GSAS (and for UNIX, the reverse) -- this is not 68 likely to be needed, as GSAS now does most conversions automatically. 65 69 <DT>exit<DD>Exit EXPGUI (shortcut Alt-X or ^C) 66 70 </DL> … … 99 103 revised .EXP file, which means that you reject the last set of changes. 100 104 This is useful if 101 GENLES blows up or you have done something wrong. The advantage102 ofturning "autoload EXP" on is105 GENLES blows up or you have done something wrong. The reason to 106 turning "autoload EXP" on is 103 107 that there is one less thing to do when running GSAS programs. 104 108 Note that it is still possible to reverse changes, if 105 <a href="#archive">archive files</A>, but this may require more effort.106 109 <a href="#archive">archive files</A>, but this may require more 110 effort. See the File/revert menu entry. 107 111 <a name="execprompt"></a> 108 112 <DT>Prompt after GSAS run<DD> … … 121 125 screen cluttered with EXPGUI when it can't be used, 122 126 but this is an option so that the mode can be turned off by those people 123 who find this behavior annoying. 127 who find this behavior annoying. It appears this option causes 128 problems on Windows 7. 124 129 125 130 <a name="AutostartGRWND"></a> … … 225 230 <DT>rawplot<DD>Plot powder data 226 231 <DT>fitspec<DD>Fit a TOF vanadium scattering spectrum 227 <DT>tofnorm<DD>Normalize a TOF spectrum228 232 <DT><a HREF="liveplot.html#bkgedit">bkgedit</a> 229 233 <DD>Invokes the <a HREF="liveplot.html#bkgedit">BKGEDIT</a> program … … 233 237 to set the upper and lower limits for a histogram, as well as 234 238 edit excluded regions. 239 <DT>seqgsas<DD>Invokes the sequential GSAS refinement program to run 240 GENLES on a set of very similar data files. 241 <DT>mustrplot<DD>Plot microstrain results 242 <DT><a HREF="expgui.html#INSTEDIT">instedit</A><DD>Invokes the <a HREF="expgui.html#INSTEDIT">instedit</A> 243 to edit an instrument parameter file. 244 <DT>New InstParm file<DD>Creates a new instrument parameter file using 245 <a HREF="expgui.html#INSTEDIT">instedit</A>. 246 247 235 248 </DL> 236 249 <img SRC="m3.gif" BORDER=3 alt="EXPGUI Screen snapshot"> … … 238 251 239 252 <a name="4"></a> 240 <h3>C.4 Single CrystalMenu</h3>253 <h3>C.4 Xtal (Single Crystal) Menu</h3> 241 254 <BLOCKQUOTE> 242 255 This menu contains links to GSAS programs used for … … 268 281 <DT>fourier<DD>Generate Fourier map 269 282 <DT>forsrh<DD>Search Fourier map for peaks 283 <DT>gsas2map<DD>Exports a Fourier map in formats used by other 284 programs (for example Fox and DRAWxtl). 270 285 <DT><a HREF="liveplot.html#liveplot">liveplot</a> 271 286 <DD>Invokes the <a HREF="liveplot.html#liveplot">LIVEPLOT</a> program … … 274 289 <DT>vrstplot<DD>Create a VRML 3-D file for viewing with 3rd party software 275 290 <DT>widplt<DD>Displays the FWHM as a function of Q, 2Theta,... for UVWXY values input or read from an EXP file 291 <DT><a HREF="expgui.html#ABSPLT">absplt</A> 292 <DD>The <a HREF="expgui.html#ABSPLT">absplt</A> program displays the 293 absorption/reflectivity correction curve for values used in a histogram. 294 <DT>mustrplot<DD>Plot microstrain results 295 <DT>seqplot<DD>Plot results from seqgsas 276 296 </DL> 277 297 <img SRC="m5.gif" BORDER=3 alt="EXPGUI Screen snapshot"> … … 287 307 <DT>bijcalc<DD>Thermal parameter analysis 288 308 <DT>disagl<DD>Distance/angle calculations 309 <DT>disaglviewer<DD>Display results from distance/angle calculations 310 in a graphical browser. 289 311 <DT>reflist<DD>List reflection data 290 312 <DT>geometry<DD>Molecular geometry calculations … … 297 319 <DT>ramafit<DD>Fits torsion angle distributions, particularly in peptide 298 320 chains, for use in restraints. 321 <DT>seqplot<DD>Plot results from seqgsas 299 322 </DL> 300 323 <img SRC="m6.gif" BORDER=3 alt="EXPGUI Screen snapshot"> … … 307 330 <DL> 308 331 <DT>cllchg<DD>Transform unit cell 309 <DT>fprime<DD>Compute f, f', f'' and mu/rho for an element for a range of x-ray wavelengths 332 <DT>composition<DD>Computes the chemical composition of a unit cell 333 accounting for site multiplicies and occupancies 310 334 <DT>rducll<DD>Unit cell reduction 311 335 <DT>spcgroup<DD>Space group symbol interpreter 336 <DT>seqgsas<DD>Invokes the sequential GSAS refinement program to run 337 GENLES on a set of very similar data files. 338 <DT>seqplot<DD>Plot results from seqgsas 312 339 <DT>unimol<DD>Unique molecule assembler 313 340 </DL> … … 315 342 </BLOCKQUOTE> 316 343 317 <a name="8"></a>318 <h3>C.8 Import/Export Menu</h3>319 <BLOCKQUOTE>320 This menu contains utilities for importing information into GSAS and321 exporting.322 <DL>323 <DT>exp2xtl<DD>Prepare a .XTL format file of atomic positions. This324 file is used in MSI software such as Cerius and InsightII.325 <DT>gsas2cif<DD>Prepare IUCr crystallographic information (CIF) file326 <DT>hklsort<DD>Prepare HKL tables327 <DT>pubtable<DD>Prepare atom parameter tables328 <DT>convert<DD>Convert a standard ASCII file to the direct access format used by GSAS (and for UNIX, the reverse)329 <DT>cad4rd<DD>Prepare CAD4 single crystal data330 <DT>dbwscnv<DD>Convert a powder diffraction data file from DBWS format331 <DT>x17bcnv<DD>Convert an energy dispersive diffractogram data file from NSLS X17b332 <DT>p3r3data<DD>Prepare Siemens/Brucker P3R3 single crystal data333 <DT>sxtldata<DD>Prepare generic single crystal data334 <DT>gsas2pdb<DD>335 Import (using GSAS2PDB & EXPEDT) and export coordinates (for336 macromolecular phases) to/from Protein Data Base files337 <DT>ref2asc<DD>338 Exports a GSAS reflection file to ASCII for use in non-GSAS programs339 <DT>ref2bin<DD>340 Imports an ASCII reflection file to the GSAS binary format341 </DL>342 <img SRC="m8.gif" BORDER=3 alt="EXPGUI Screen snapshot">343 </BLOCKQUOTE>344 345 344 <a name="9"></a> 346 <h3>C. 9Macro Menu345 <h3>C.8 Macro Menu 347 346 <IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!"> 348 347 </h3> … … 402 401 </DL> 403 402 </BLOCKQUOTE> 403 404 <a name="8"></a> 405 <h3>C.9 Import/Export Menu</h3> 406 <BLOCKQUOTE> 407 This menu contains utilities for importing information into GSAS and 408 exporting it to other programs. 409 <DL> 410 <DT>Coord Export<DD>This provides a series of routines that are used 411 to write coordinates and possibly other information to files:<P> 412 <DL> 413 <DT>gsas2cif<DD>Prepares IUCr crystallographic information (CIF) file 414 that documents the current refinement. The CIF contains the 415 coordinates for all phases as well as the observed and computed 416 diffraction patterns. The templates used by GSAS2CIF can be customized 417 to provide a detailed description of the experimental measurements and 418 results for use in documenting analysis for publication or 419 deposition. 420 <DT>coords-only CIF<DD>For export of intermediate results to another 421 program, CIF can be a useful exchange format. This routine provides a 422 CIF with the current coordinates from one phase and not much else. 423 <DT>export to DRAWxtl<DD>This writes a .STR file used in the DRAWxtl 424 program and optionally launches DRAWxtl. 425 <DT>export to SHELX<DD>This writes coordinates for a selected phase in 426 the .INS format used by SHELX and several other programs. 427 <DT>export to PLATON<DD>This writes coordinates for a selected phase in 428 the .SPF format used by PLATON 429 <DT>export test format<DD>This demonstrates how a coordinate export 430 routine can be added to EXPGUI. See the <A 431 HREF="expgui_cfg.html#export">documentation on this</A> for further 432 information. 433 <DT>export to FOX<DD>This prepares a XML file with coordinates for use 434 in the FOX program 435 <DT>MSI .xtl<DD>Prepare a .XTL format file of atomic positions. This 436 file is used in older Accelrys software such as Cerius and 437 Insight-II. It may no longer be of value. 438 </DL> 439 440 <DT>CIF Export<DD>This provides a series of routines that are used 441 to prepare CIF files:<P> 442 <DL> 443 <DT>gsas2cif<DD>Prepares IUCr crystallographic information (CIF) file 444 that documents the current refinement. The CIF contains the 445 coordinates for all phases as well as the observed and computed 446 diffraction patterns. The templates used by GSAS2CIF can be customized 447 to provide a detailed description of the experimental measurements and 448 results for use in documenting analysis for publication or 449 deposition. 450 <DT>FillTemplate<DD>Used to edit the CIF template files used in GSAS2CIF 451 <DT>CIFselect<DD>Used to select interatomic distances and angles to be 452 included in the CIF created by GSAS2CIF. 453 </DL> 454 455 <DT>hklsort<DD>Prepare HKL tables 456 <DT>pubtable<DD>Prepare atom parameter tables 457 <DT>convert<DD>Convert a standard ASCII file to the direct access format used by GSAS (and for UNIX, the reverse) 458 <DT>cad4rd<DD>Prepare CAD4 single crystal data 459 <DT>dbwscnv<DD>Convert a powder diffraction data file from DBWS format 460 <DT>x17bcnv<DD>Convert an energy dispersive diffractogram data file from NSLS X17b 461 <DT>p3r3data<DD>Prepare Siemens/Brucker P3R3 single crystal data 462 <DT>sxtldata<DD>Prepare generic single crystal data 463 <DT>gsas2pdb<DD> 464 Import (using GSAS2PDB & EXPEDT) and export coordinates (for 465 macromolecular phases) to/from Protein Data Base files 466 <DT>ref2asc<DD> 467 Exports a GSAS reflection file to ASCII for use in non-GSAS programs 468 <DT>ref2bin<DD> 469 Imports an ASCII reflection file to the GSAS binary format 470 <DT>gsas2map<DD>Exports a Fourier map in formats used by other 471 programs (for example Fox and DRAWxtl). 472 </DL> 473 <img SRC="m8.gif" BORDER=3 alt="EXPGUI Screen snapshot"> 474 </BLOCKQUOTE> 475 404 476 <hr> 405 477 <TABLE BORDER BGCOLOR="#FFFF40" ALIGN=RIGHT> -
trunk/doc/gsas2cif.html
r971 r1166 33 33 <BR> 34 34 to export 35 <A Href="http://www.ncnr.nist.gov/programs/crystallography/software/gsas.html"> 36 GSAS</A> 35 <A Href="https://subversion.xor.aps.anl.gov/trac/EXPGUI/wiki/GSASIntro">GSAS</A> 37 36 results 38 37 <HR noshade width="75%" size="2" align="center"> … … 575 574 </BLOCKQUOTE> 576 575 577 <P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR>578 <font size=-1><? lastmod(); ?></font>579 $Revision$ $Date$580 576 </font> 581 577 </BLOCKQUOTE> -
trunk/doc/liveplot.html
r971 r1166 40 40 <P> 41 41 Both LIVEPLOT and BKGEDIT get the current diffraction information 42 by running the GSAS TCLDUMP program, if installed, or 43 the GSAS HSTDUMP otherwise. The TCLDUMP program has been optimized for use 44 with LIVEPLOT and allows LIVEPLOT to offer a number of extra 45 options that are not available when HSTDUMP is used. Since TCLDUMP has been 46 included in GSAS since April of 2000, the following documentation assumes 47 that TCLDUMP is installed. 42 by running the GSAS TCLDUMP program. (In GSAS/EXPGUI before 2001, the 43 GSAS HSTDUMP program was used, which was less powerful. This code has 44 not been removed, but will not be used if TCLDUMP is present.) 48 45 49 46 <a name="liveplot"></a> … … 54 51 Some of the features available in LIVEPLOT are: 55 52 <UL> 56 <LI>The plot is updated automatically after each refinement run 53 <LI><IMG SRC="new.gif" alt="New!"> 54 Regions of the plot can be magnified to show more detail, for example 55 in regions at high Q. 56 <LI><IMG SRC="new.gif" alt="New!"> 57 Plots can be <a href="#export">exported to obtain publication-quality 58 graphics </a> -- <B><I>now on all platforms</I></B>. 59 <LI><IMG SRC="new.gif" alt="New!"> Intensity can be displayed as I/sigma(I) 60 <LI>The plot is updated automatically after each refinement run 57 61 <LI>The plot can be "zoomed-in", by clicking on the corners of the 58 62 area to be magnified and "zoomed-out" using the … … 61 65 The units used for plotting histograms can be selected. Choices are: 62 66 native units (2Theta/TOF/KeV); d-space (A) or Q (A<sup>-1</sup>) 63 <LI>64 The background (fixed plus fitted) can be plotted or can be subtracted.67 <LI> 68 The background (fixed plus fitted) can be plotted or can be subtracted. 65 69 <LI> 66 70 Reflection tickmarks can be displayed in a variety of formats … … 73 77 <LI> 74 78 The cumulative chi<sup>2</sup> function or 75 <IMG SRC="new.gif" alt="New!">(obs-calc)/sigma can be plotted.79 (obs-calc)/sigma can be plotted. 76 80 <LI> 77 81 The cursor position can be displayed 78 <LI>79 Plots can be <a href="#export">exported to obtain publication-quality80 graphics.</a>81 82 </UL> 82 83 … … 285 286 <P> 286 287 <a name="zoomshift"></a> 287 <IMG SRC="new.gif" alt="New!">288 288 To shift the zoom region around, 289 289 the right and left arrow keys can be used to shift the … … 363 363 <br clear=all> 364 364 <P> 365 <a name="magnification"></a> 366 <B>Plot Magnification</B> 367 Sections of the plot can be magnified through use of options in the 368 Magnification menu or by using control-1 through control-9. 369 <img SRC="magreg.png" align=RIGHT alt="LIVEPLOT Screen snapshot"> 370 <UL> 371 <LI>The Magnification/Add region menu item requests a location in the 372 pattern (2Theta/TOF/KeV/d-space/Q) and a multiplier. Data where the 373 scan variable (2Theta...) is of that value or higher, up to the 374 next region or end of the pattern are multiplied by that factor. The 375 factor, must be >0. 376 <LI>Magnification/Edit regions brings up a menu (see below) where the previously 377 defined regions can be changed. The region boundaries can be moved 378 and the multiplier values can be changed. If a multiplier is set to 379 zero (or negative) that region is removed. 380 <LI>Magnification/Clear deletes all previously defined regions 381 <LI>Pressing control plus a positive digit (1,2,3,...9) also adds a 382 magnification region. The digit determines the magnification 383 multiplier. Data where the 384 scan variable (2Theta...) from the mouse position up to the 385 next region or end of the pattern are multiplied by that factor. 386 <img SRC="editreg.png" align=RIGHT alt="LIVEPLOT menu"> 387 </UL> 388 <br clear=all> 389 <P> 365 390 <a name="export"></a> 366 391 <B>Export plot options</B> 367 392 <UL><LI> 368 The plot can be exported to 393 <IMG SRC="new.gif" alt="New!"> 394 The LIVEPLOT program can export plots to to a <I>high quality</I> PDF 395 file for presentations or publications using <A 396 HREF="http://www.gnuplot.info/">gnuplot</A>. 397 The PDF will match what is is shown on fairly 398 closely with respect to colors, <A href="#plotfont">font sizes</a> 399 and <a href="#zoom">zoom</a>. The new <A href="#magnification">plot magnification</a> to show detail in 400 the fit and for publication increase the 401 <A href="#plotfont">plot font</a> so that the figure size can be 402 reduced to the standard Rietveld postage stamp, required by so many 403 Journals -- allowing the text to be discerned, even if the problems in the 404 fit cannot. 405 <P>Starting August 406 2011, windows and Mac versions of gnuplot are included with the GSAS 407 binaries; gnuplot is easily 408 installed on Linux with standard tools such as yum (Redhat), 409 apt-get (ubuntu) or zypper (openSuse). 410 411 <P><LI> The plot can be exported to 369 412 <A HREF="http://plasma-gate.weizmann.ac.il/Grace/">Grace</A>, WYSIWYG 2D plotting tool for X-Windows 370 that produces publication-quality graphics . Many UNIX users know371 this program under a previous name, xmgr. 372 The export is implemented 373 by producing an ASCII file with instructions that 374 creates a plot with similar formatting to what appears on the375 screen in LIVEPLOT/BKGEDIT. However, the output quality from 376 Grace is much higher quality. Further, Grace 377 can be used to enhanced and annotate the plot further.378 <LI>413 that produces publication-quality graphics that appear very similar to 414 what is seen in LIVEPLOT/BKGEDIT. Further, Grace 415 can be used to enhance the plot, for example by editing captions, 416 figure display options and even annotate the plot. 417 Grace runs well on Linux and Mac computers; Many UNIX users know 418 this program under a previous name, xmgr. 419 For Windows, 420 installation of <A HREF="http://cygwin.com/">Cygwin</A> is required. 421 <P><LI> 379 422 For use in many other graphics programs, LIVEPLOT will produce a 380 423 "comma separated variable" data file with the data displayed on the screen. … … 382 425 set line styles and scaling, etc., but this does provide an option for 383 426 generating high-quality graphics for presentations and publications. 384 < LI>LIVEPLOT will produce PostScript versions of the plot on the screen,427 <P><LI>LIVEPLOT will produce PostScript versions of the plot on the screen, 385 428 but the quality is rather low (this is a limitation of the BLT graphics 386 429 package). 430 <P><LI>LIVEPLOT/BKGFIT can also be used to prepare input for FOX (Free 431 Objects for Xtallography). 432 387 433 </UL> 388 434 … … 408 454 <DT><a href="#zoomshift">arrow keys</A> 409 455 <DD>Moves zoom region around in plot 456 <DT><a href="#mag">Control+1, 2,...</a> 457 <DD>Defines a <a href="#magnification">magnification region</A> at the 458 cursor location. 410 459 </DL> 411 460 … … 438 487 <DT>Export Plot 439 488 <DD>This offers options for exporting the plot in multiple formats. 440 I am hoping to add more export formats eventually. 441 <DL><DL> 489 <DL><DL> 490 <DT>to PDF 491 <IMG SRC="new.gif" alt="New!"> 492 <DD>Creates a <I>high quality</I> PDF file that may be useful for 493 presentations or publications. Note that you may wish to use 494 <A href="#magnification">plot magnification</a> to show detail in 495 the fit and for publication increase the 496 <A href="#plotfont">plot font</a> so that the figure size can be 497 reduced. 498 442 499 <DT>to PostScript 443 500 <DD>Creates a <I>low quality</I> PostScript file containing the LIVEPLOT … … 446 503 On Windows, a program such ghostview may be needed to translate the 447 504 PostScript to a format that can be viewed or printed. 448 <A name="grace"> 505 506 <A name="grace"> 449 507 <DT>to Grace 450 508 <IMG SRC="note.gif" alt="Note!"> … … 454 512 After the plot is exported, it can be further 455 513 enhanced and annotated in grace. 514 515 <DT>to .csv file 516 <DD>Creates a "comma separated variable" file. This contains all the 517 diffraction data shown in the plot. It can be used to produce a plot 518 in some other graphics program. 519 <DT>Fox XML 520 <DD>The Fox program provides structure solution capabilities. This 521 option can be used to write data in the XML format that Fox uses. 456 522 </DL></DL> 457 523 <DT>Quit … … 505 571 <DT>Y units 506 572 <DD>The intensity values can be normalized by the incident spectrum 507 (for energy dispersive methods). 573 (for energy dispersive methods) or 574 <IMG SRC="new.gif" alt="New!"> can be displayed as a ratio with the 575 experimental uncertainty [I<sub>obs</sub>/sigma(I<sub>obs</sub>), 576 I<sub>calc</sub>/sigma(I<sub>obs</sub>) and their difference]. 508 577 </DL></DL> 509 578 <br clear=all> … … 535 604 <DT>Set screen font 536 605 <DD>This option is used to control the font used for menus, graphics and 537 other aspects of windows. 606 other aspects of windows. This value can be saved as a default value. 607 <A name="plotfont"> 608 <DT>Set plot font 609 <DD>This option is used to change the font used in the plot 610 window. This has a similar effect to changing the screen font, but 611 can be changed over a wider range and only affects the 612 graph. Changing the font size either way will change the font used 613 in the exported .PDF. 538 614 <DT>Raise on update 539 615 <DD>This causes the plot to be placed on top of other windows, if partially … … 650 726 <P> 651 727 <hr><H2>Interfacing External Programs</H2> 652 <IMG SRC="new.gif" alt="New!">653 728 <B>Combining LIVEPLOT with CMPR & LOGIC</B> 654 729 If you have the 655 <A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/cmpr"> 656 CMPR/LOGIC</A> 657 programs installed on your computer, you can use superimpose on the 730 <A HREF="https://subversion.xor.aps.anl.gov/trac/CMPR">CMPR</A> 731 program installed on your computer, you can use superimpose on the 658 732 GSAS results the peaks for an arbitrary unit cell. 659 If you have an old version of the 660 <A HREF="http://www.icdd.com/products/overview.htm"> 661 ICDD-JCPDS PDF-2 powder diffraction database</a>, 662 (when distributed as an AIDS*83 format flat file) 663 you can also superimpose entries from this database on the 664 GSAS results displayed in LIVEPLOT. 665 <P> 666 When the CMPR/LOGIC program is installed in the same location 733 <P> 734 When the CMPR program is installed in the same location 667 735 as the GSAS package (<i>e.g.</i> 668 736 <font face="courier">/home/gsas</font> & … … 692 760 software is located. The 693 761 "Display a cell" option produces a window similar to the 694 <A href="http ://www.ncnr.nist.gov/xtal/software/cmpr/doc/cmprdoc.html#editcell">762 <A href="https://subversion.xor.aps.anl.gov/CMPR/trunk/doc/cmprdoc.html#editcell"> 695 763 Edit Cell feature in CMPR</A> 696 764 where allowed reflection positions are displayed for a set of unit cell 697 765 parameters and optionally a space group or extinction conditions. 698 The "Plot ICDD Entry" provides a window similar to the699 <A href="http://www.ncnr.nist.gov/xtal/software/cmpr/doc/cmprdoc.html#editcell">700 LOGIC interface in CMPR</A>701 where ICDD searches may be conducted. From the resulting list of matches,702 selected entries may be displayed.703 766 <P> 704 767 Note that these routines display peak positions in units of 2Theta, Q or … … 718 781 </TH></TR></TABLE> 719 782 720 <P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR>721 <font size=-1><? lastmod(); ?> </font>722 <br>723 $Revision$ $Date$724 783 </blockquote> 725 784 </body> -
trunk/doc/revlog.html
r971 r1166 32 32 </h1></center> 33 33 <P> 34 This page describes all revisions logged for changes to the EXPGUI source 34 This page has been superceeded by the Trac registry, see 35 <A HREF="https://subversion.xor.aps.anl.gov/trac/EXPGUI/timeline"> 36 https://subversion.xor.aps.anl.gov/trac/EXPGUI/timeline</A>. 37 <HR><HR> 38 Below is information on older revisions logged for changes to the EXPGUI source 35 39 files, sorted by date. 36 See the <A HREF="wishlist.html">EXPGUI Wish List</A> for a more 37 descriptive listing. 38 40 See the 41 <A HREF="https://subversion.xor.aps.anl.gov/trac/EXPGUI/report"> 42 View Tickets</A> section of the Trac site for active and closed 43 projects. There is some older information on the 44 <A HREF="wishlist.html">EXPGUI Wish List</A>. 45 39 46 <h2>since 1-Jun-2009</h2><DL><DL> 40 47 </DL></DL> … … 1633 1640 </TH><TH><A Href="wishlist.html">Past and Planned<BR>Updates</A> 1634 1641 </TH></TR></TABLE> 1635 <P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR> 1636 <font size=-1><? lastmod(); ?> </font> 1637 <br> 1638 </blockquote> 1642 </blockquote> 1639 1643 1640 1644 Created Fri Jul 03 20:35:34 CDT 2009 -
trunk/doc/win_old_notes.html
r971 r1166 43 43 Nonetheless, please report problems, including improvements on 44 44 these instructions to 45 <A HREF="mailto:brian.toby@ nist.gov">Brian Toby</A>.45 <A HREF="mailto:brian.toby@anl.gov">Brian Toby</A>. 46 46 Otherwise, Windows-specific issues are unlikely to be addressed or repaired. 47 47 </EM> … … 57 57 <P> 58 58 <LI>Get 59 <A Href="http ://www.ncnr.nist.gov/programs/crystallography/software/gsas.html">60 GSAS</A>from one of the following sites:59 <A Href="https://subversion.xor.aps.anl.gov/trac/EXPGUI/wiki/GSASIntro">GSAS</A> 60 from one of the following sites: 61 61 <DL><P> 62 62 <DT>UK<DD> … … 296 296 <A HREF="MAILTO:vondreele@anl.gov">vondreele@anl.gov</A> 297 297 <P>EXPGUI is written by Brian H. Toby of the NIST Center for Neutron Research, 298 <A HREF="MAILTO:Brian.Toby@ NIST.GOV">Brian.Toby@NIST.GOV</A>298 <A HREF="MAILTO:Brian.Toby@ANL.GOV">Brian.Toby@ANL.GOV</A> 299 299 with help from Jonathan Wasserman. 300 300 … … 325 325 </TH></TR></TABLE> 326 326 327 <P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR>328 <font size=-1><? lastmod(); ?> </font>329 <br>330 $Revision$ $Date$331 327 </blockquote> 332 328 </body> -
trunk/doc/wishlist.html
r971 r1166 31 31 <HR noshade width="75%" size="2" align="center"> 32 32 </h1></center> 33 <I><blockquote><blockquote> 34 Information on desired (and completed) development tasks for EXPGUI 35 are now captured as "Tickets" in the 36 <A HREF="https://subversion.xor.aps.anl.gov/trac/EXPGUI/"> 37 EXPGUI Trac system</A>. In particular, see the 38 <A HREF="https://subversion.xor.aps.anl.gov/trac/EXPGUI/timeline"> 39 timeline of changes</A> and the 40 <A HREF="https://subversion.xor.aps.anl.gov/trac/EXPGUI/report"> 41 reports on Tickets</A>. Any other information on this page is no 42 longer being updated -- though there are still some good ideas for 43 development here. 44 </blockquote></blockquote></I> 45 <P> 46 <hr><hr> 47 48 33 49 <P> 34 50 This page describes recent features added to EXPGUI or that are being -
trunk/expgui
r1161 r1166 327 327 file copy -force $expgui(expfile) $expnam.EXP 328 328 set expgui(expfile) $expnam.EXP 329 wm title . "EXPGUI interface to GSAS: [file tail $expgui(expfile)]" 330 set expgui(titleunchanged) 1 329 331 } else { 330 332 MyMessageBox -parent . -title "File not found" \ … … 334 336 } 335 337 } else { 336 SetEXPfile $expgui(expfile)338 set expgui(expfile) [SetEXPfile $expgui(expfile)] 337 339 } 338 340 } … … 349 351 # I am not sure it is still needed. 350 352 update 351 SetEXPfile [getExpFileName ""]353 set expgui(expfile) [SetEXPfile [getExpFileName ""]] 352 354 set expgui(resize) 1 353 355 } … … 361 363 proc loadexp {expfile} { 362 364 global expgui expmap entryvar entrycmd tcl_platform 363 set prevexp $expgui(expfile) 364 # is this a compressed archive file? 365 if {[string match {*.O[0-9A-F][0-9A-F]} $expfile]} { 366 set expnam [file rootname $expfile] 367 set ans [MyMessageBox -parent . -title "Load Archived File" \ 368 -message "Loading archived version of $expnam. Do you want to continue using the same experiment name or work with the archived version under a new name?" \ 369 -icon question -type "{Use New Name} {Continue with current}" \ 370 -default {Use New Name} \ 371 -helplink "expguierr.html LoadArchived" 372 ] 373 # archive the current .EXP file 374 if {$ans != "use new name" && [file exists $expfile]} { 375 # get the last archived version 376 set lastf [lindex [lsort [glob -nocomplain $expnam.{O\[0-9A-F\]\[0-9A-F\]}]] end] 377 if {$lastf == ""} { 378 set num 01 379 } else { 380 regexp {.*\.O([0-9A-F][0-9A-F])$} $lastf a num 381 scan $num %x num 382 if {$num >= 255} { 383 set num FF 384 } else { 385 set num [string toupper [format %.2x [incr num]]] 386 } 387 } 388 catch { 389 set newfile $expnam.O$num 390 file rename -force $expnam.EXP $newfile 391 set fp [open $expnam.LST a+] 392 puts $fp "\n----------------------------------------------" 393 puts $fp " Regressing to archive file [file tail $expfile]" 394 puts $fp " but first archiving [file tail $expnam.EXP] as [file tail $newfile]" 395 puts $fp "----------------------------------------------\n" 396 close $fp 397 } 398 file copy -force $expfile $expnam.EXP 399 set expfile $expnam.EXP 400 } 401 if {$ans == "use new name"} { 402 set newexpfile [getExpFileName new] 403 if {$newexpfile == ""} return 404 file copy -force $expfile $newexpfile 405 catch {cd [string trim [file dirname $expgui(expfile)]]} 406 set expfile [file tail $newexpfile] 407 set expgui(needpowpref) 2 408 set expgui(needpowpref_why) "\tA new .EXP file was created\n" 409 SetEXPfile $newexpfile 410 } else { 411 SetEXPfile $expfile 412 } 413 if {$expgui(expfile) == ""} { 414 set expgui(expfile) $prevexp 415 return 416 } 417 } 418 365 set expfile [SetEXPfile $expfile] 366 if {$expfile == ""} { 367 return 368 } 419 369 # change the icon and assign an app to this .EXP file 420 370 if {$tcl_platform(os) == "Darwin" && $expgui(MacAssignApp)} { 421 371 MacSetResourceFork $expfile 422 372 } 423 424 SetEXPfile $expfile425 if {$expgui(expfile) == ""} {426 set expgui(expfile) $prevexp427 return428 }429 373 # read in the .EXP file 430 374 set fmt [expload $expfile] 375 set expgui(expfile) $expfile 431 376 # if the file was not in the correct format, force a rewrite before use 432 377 if {$fmt < 0} { … … 453 398 set expgui(last_History) [string range [string trim [lindex [exphistory last] 1]] 0 50 ] 454 399 # set the window/icon title 455 wm title . "EXPGUI interface to GSAS: $expfile"400 wm title . "EXPGUI interface to GSAS: [file tail $expgui(expfile)]" 456 401 set expgui(titleunchanged) 1 457 402 wm iconname . [file tail $expfile] … … 462 407 # start checking for external changes 463 408 afterawhile 409 # check if the file seems corrupt 410 set warnings [ScanEXPforError] 411 if {$warnings != ""} { 412 ExplainEXPerror . $warnings $expfile 413 } 464 414 } 465 415 … … 547 497 global expgui 548 498 global tcl_platform 549 set prevexp $expgui(expfile) 550 set newexpfile [getExpFileName new] 551 if {$newexpfile == ""} return 552 SetEXPfile $newexpfile 1 553 if {$expgui(expfile) == ""} { 554 set expgui(expfile) $prevexp 555 return 556 } 499 set newexpfile [SetEXPfile [getExpFileName new] 1] 500 if {$newexpfile == ""} return 557 501 expwrite $newexpfile 502 set expgui(expfile) $newexpfile 558 503 # change the icon and assign an app to this .EXP file 559 504 if {$tcl_platform(os) == "Darwin" && $expgui(MacAssignApp)} { … … 574 519 575 520 # called to read a different .EXP file 576 proc readnewexp { } {521 proc readnewexp {"mode 0"} { 577 522 global expgui expmap 578 523 if $expgui(changed) { … … 586 531 } 587 532 } 588 set prevexp $expgui(expfile) 589 set newexpfile [getExpFileName old] 590 if {$newexpfile == ""} return 591 SetEXPfile $newexpfile 592 if {$expgui(expfile) == ""} { 593 set expgui(expfile) $prevexp 594 return 595 } 596 597 # switch to the 1st page 598 RaisePage lsFrame 533 if {$mode == 0} { 534 set newexpfile [getExpFileName old] 535 } else { 536 set newexpfile [RevertExpFile] 537 } 538 if {$newexpfile == ""} return 539 599 540 set expgui(globalmode) 0 600 loadexp $expgui(expfile) 541 loadexp $newexpfile 542 543 # switch to the appropriate 1st page 544 #StageTabUse 545 SetStartPanel 601 546 602 547 # reset the phase selection … … 609 554 set expgui(curhist) {} 610 555 } 611 if {[CountHistory] > 100} {612 DeleteHistoryRecords "This .EXP file has [CountHistory] history records\nErasing most will speed EXPGUI"613 }556 # if {[CountHistory] > 100} { 557 # DeleteHistoryRecords "This .EXP file has [CountHistory] history records\nErasing most will speed EXPGUI" 558 # } 614 559 } 615 560 … … 1058 1003 1059 1004 set crsPhase {} 1060 $expgui(atomxform) config -text " XformAtoms" -state disabled1005 $expgui(atomxform) config -text "Modify Atoms" -state disabled 1061 1006 foreach n $expmap(phaselist) type $expmap(phasetype) { 1062 1007 if {$n == $num} { … … 1099 1044 DisplayRefFlags 0 0 1100 1045 $expgui(atomlistbox) delete 0 end 1046 $expgui(AddAtomBut) config -state disabled 1101 1047 return 1102 1048 } 1103 1049 1104 1050 # don't reload the last displayed phase 1105 if {$expgui(curPhase) == $crsPhase} return 1051 if {$expgui(curPhase) == $crsPhase} { 1052 DisplayAllAtoms $crsPhase 1053 return 1054 } 1106 1055 1107 1056 ########################################################## … … 1127 1076 DisplayRefFlags 0 0 1128 1077 $expgui(EditingAtoms) config -text "" 1078 $expgui(AddAtomBut) config -state normal 1129 1079 1130 1080 DisplayAllAtoms $crsPhase … … 1308 1258 } else { 1309 1259 append refflag " [mmatominfo $phase $atom ${type}damp] " 1310 } 1260 } 1311 1261 } 1312 1262 set line [format \ … … 1323 1273 [mmatominfo $phase $atom z] \ 1324 1274 [mmatominfo $phase $atom frac] \ 1325 [mmatominfo $phase $atom Uiso] 1275 [mmatominfo $phase $atom Uiso] 1326 1276 ] 1327 1277 } elseif {[atominfo $phase $atom temptype] == "A"} { … … 1337 1287 set maxline A 1338 1288 # aniso 1339 set line [format "%3d %-6s %-6s %8s %10.6f%10.6f%10.6f%4d%9.4f" \ 1289 set fmt "%3d %-6s %-6s %8s %s%s%s%4d%9.4f" 1290 set line [format $fmt \ 1340 1291 $atom \ 1341 1292 [atominfo $phase $atom label] \ 1342 1293 [atominfo $phase $atom type] \ 1343 1294 $refflag \ 1344 [ atominfo$phase $atom x] \1345 [ atominfo$phase $atom y] \1346 [ atominfo$phase $atom z] \1295 [ShowFixAtom $phase $atom x] \ 1296 [ShowFixAtom $phase $atom y] \ 1297 [ShowFixAtom $phase $atom z] \ 1347 1298 [atominfo $phase $atom mult] \ 1348 [atominfo $phase $atom frac] 1299 [atominfo $phase $atom frac] 1349 1300 ] 1350 1301 append line [format " %9.5f%9.5f%9.5f%9.5f%9.5f%9.5f" \ … … 1354 1305 [atominfo $phase $atom U12] \ 1355 1306 [atominfo $phase $atom U23] \ 1356 [atominfo $phase $atom U13] 1307 [atominfo $phase $atom U13] 1357 1308 ] 1358 1309 } else { … … 1362 1313 } else { 1363 1314 append refflag " [atominfo $phase $atom ${type}damp] " 1364 } 1365 } 1366 set line [format \ 1367 "%3d %-6s %-6s %8s %10.6f%10.6f%10.6f%4d%9.4f %9.5f" \ 1315 } 1316 } 1317 #set fmt "%3d %-6s %-6s %8s %10.6f%10.6f%10.6f%4d%9.4f %9.5f" 1318 set fmt "%3d %-6s %-6s %8s %s%s%s%4d%9.4f %9.5f" 1319 set line [format $fmt \ 1368 1320 $atom \ 1369 1321 [atominfo $phase $atom label] \ 1370 1322 [atominfo $phase $atom type] \ 1371 1323 $refflag \ 1372 [ atominfo$phase $atom x] \1373 [ atominfo$phase $atom y] \1374 [ atominfo$phase $atom z] \1324 [ShowFixAtom $phase $atom x] \ 1325 [ShowFixAtom $phase $atom y] \ 1326 [ShowFixAtom $phase $atom z] \ 1375 1327 [atominfo $phase $atom mult] \ 1376 1328 [atominfo $phase $atom frac] \ 1377 [atominfo $phase $atom Uiso] 1329 [atominfo $phase $atom Uiso] 1378 1330 ] 1379 1331 } 1380 1332 return $line 1333 } 1334 1335 # format a coordinate from a non-mm phase as 10 chars; mark fixed coordinates differently 1336 proc ShowFixAtom {phase atom var} { 1337 # is this fixed? 1338 set param [string toupper $var] 1339 if {[array name ::fix_param "$phase,$atom,$param"] != ""} { 1340 return [format "%9.5fF" [atominfo $phase $atom $var]] 1341 } else { 1342 return [format "%10.6f" [atominfo $phase $atom $var]] 1343 } 1381 1344 } 1382 1345 … … 1442 1405 DisplayRefFlags $atomnum $p 1443 1406 $expgui(EditingAtoms) config -text "Editing atom #$atomnum -- [atominfo $p $atomnum label]" 1444 $expgui(atomxform) config -text " XformAtom" -state normal1407 $expgui(atomxform) config -text "Modify Atom" -state normal 1445 1408 } 1446 1409 … … 1467 1430 # this needs to track by phase 1468 1431 DisplayRefFlags $numberList $p 1469 $expgui(atomxform) config -text " XformAtoms" -state normal1432 $expgui(atomxform) config -text "Modify Atoms" -state normal 1470 1433 } 1471 1434 … … 1849 1812 set expgui(backtermlbl) "" 1850 1813 set expgui(backtypelbl) "" 1814 set expgui(abstypelbl) "" 1851 1815 foreach var {bref bdamp absref absdamp} { 1852 1816 set entrycmd($var) "" … … 1865 1829 set expgui(backtermlbl) "" 1866 1830 set expgui(backtypelbl) "" 1867 set expgui(abstypelbl) "" 1831 set expgui(abstypelbl) "" 1868 1832 foreach var {bref bdamp absref absdamp} { 1869 1833 set entrycmd($var) "histinfo [list $histlist] $var" … … 3349 3313 {SelectOnePhase $expgui(curPhase)} \ 3350 3314 0 expgui2.html ""} 3351 {histFrame Histogram\3315 {histFrame Powder \ 3352 3316 MakeHistPane \ 3353 3317 DisplayHistogram \ … … 3365 3329 DisplayConstraintsPane \ 3366 3330 0 expgui6.html ""} 3331 {rbFrame "Rigid Body" \ 3332 "source [file join $expgui(scriptdir) rigid.tcl]; MakeRBPane" \ 3333 DisplayRB \ 3334 1 expguiRB.html ""} 3367 3335 {orientFrame "MD Pref Orient" \ 3368 3336 MakeOrientPane \ … … 3374 3342 0 expgui7.html ODF} 3375 3343 } 3344 3345 # future expansion: single crystal panel goes here -- if present 3346 catch { 3347 source [file join $expgui(scriptdir) single.tcl] 3348 set expgui(notebookpagelist) [linsert $expgui(notebookpagelist) 3 \ 3349 {singFrame Single \ 3350 "MakeSinglePane" \ 3351 DisplaySingle \ 3352 1 expguiSing.html ""}] 3353 } err 3354 3376 3355 3377 3356 pack [NoteBook .n -bd 2] -expand yes -fill both … … 3396 3375 } 3397 3376 } 3377 3378 set expgui(startpanel) 2 3398 3379 # procedure to disable tabs when phases or histograms are not defined 3399 3380 proc StageTabUse {args} { 3400 3381 global expgui 3382 set expgui(startpanel) 2 3401 3383 # reset everything 3402 3384 foreach item [lrange $::expgui(notebookpagelist) 0 end] { … … 3423 3405 .n itemconfigure $frm -state disabled 3424 3406 } 3407 set expgui(startpanel) 0 3425 3408 return 3426 3409 } … … 3441 3424 .n itemconfigure $frm -state disabled 3442 3425 } 3426 set expgui(startpanel) 0 3443 3427 return 3444 3428 } … … 3450 3434 .n itemconfigure $frm -state disabled 3451 3435 } 3436 set expgui(startpanel) 1 3452 3437 return 3453 3438 } … … 3463 3448 .n see $nextpage 3464 3449 .n raise $nextpage 3450 } 3451 3452 proc SetStartPanel {} { 3453 global expgui 3454 if {$expgui(startpanel) == 0} { 3455 RaisePage phaseFrame 3456 } elseif {$expgui(startpanel) == 1} { 3457 RaisePage histFrame 3458 } else { 3459 RaisePage lsFrame 3460 } 3465 3461 } 3466 3462 … … 4307 4303 $expgui(fm).option.menu add checkbutton -label "Prompt after GSAS run" \ 4308 4304 -variable expgui(execprompt) 4309 $expgui(fm).option.menu add checkbutton -label "Iconify during GSAS" \ 4305 if {$tcl_platform(platform) == "windows" && \ 4306 $tcl_platform(osVersion) == 6.1} { 4307 set expgui(autoiconify) 0 4308 $expgui(fm).option.menu add checkbutton -label "Iconify during GSAS" \ 4309 -variable expgui(autoiconify) -state disabled 4310 } else { 4311 $expgui(fm).option.menu add checkbutton -label "Iconify during GSAS" \ 4310 4312 -variable expgui(autoiconify) 4313 } 4311 4314 if {$tcl_platform(platform) == "windows" && \ 4312 4315 $tcl_platform(os) == "Windows 95"} { … … 4453 4456 } 4454 4457 } 4458 $expgui(fm).powder.menu add command -label "New InstParm file" -command {EditInstFile (new)} 4455 4459 4456 4460 # Macro menu … … 4555 4559 LocateWindow "." $xpos $ypos $poscntr 4556 4560 update 4557 RaisePage lsFrame 4558 if {[CountHistory] > 200} {4559 DeleteHistoryRecords "This .EXP file has [CountHistory] history records\nErasing most will speed EXPGUI"4560 }4561 SetStartPanel 4562 #if {[CountHistory] > 200} { 4563 # DeleteHistoryRecords "This .EXP file has [CountHistory] history records\nErasing most will speed EXPGUI" 4564 #} -
trunk/graceexport.tcl
r930 r1166 241 241 set center 10 242 242 } elseif {[string range $just 0 0] == "e"} { 243 # is this correct? 243 # is this correct? 244 set center 1 245 } else { 244 246 set center 0 245 } else {246 set center 1247 247 } 248 248 set color_data 1 -
trunk/gsascmds.tcl
r1034 r1166 464 464 afterputontop 465 465 return $makenew(result) 466 } 467 468 # format numbers & errors in crystallographic notation 469 proc formatSU {num err} { 470 # errors less or equal to t are expressed as 2 digits 471 set T 19 472 set lnT [expr { log10($T) }] 473 # error is zero 474 if {$err == 0} { 475 # is this an integer? 476 if {int($num) == $num} { 477 return [format %d [expr int($num)]] 478 } 479 # allow six sig figs with a zero error (except for 0.0) 480 set dec [expr int(5.999999-log10( abs($num) ))] 481 if {$dec < -2 || $dec > 9} { 482 return [format %.5E $num] 483 } elseif {$dec <= 0} { 484 return [format %d [expr int($num)]] 485 } else { 486 return [format %.${dec}f $num] 487 } 488 } else { 489 #set sigfigs [expr log10( abs(10) / abs(.012/$T) ) + 1] 490 # should the number be expressed in scientific notation? 491 if {$err > $T || abs($num) < 0.0001} { 492 # get the exponent 493 set exp [lindex [split [format %E $num] E] end] 494 # strip leading zeros 495 regsub {([-\+])0+} $exp {\1} exp 496 # number of decimals in exponetial notation 497 set dec [expr int($lnT - log10( abs($err) ) + $exp)] 498 # should the error be displayed? 499 if {$err < 0} { 500 return [format "%.${dec}E" $num] 501 } else { 502 # scale the error into a decimal number 503 set serr [expr int(0.5 + $err * pow(10,$dec-$exp))] 504 return [format "%.${dec}E(%d)" $num $serr] 505 } 506 } else { 507 # number of digits 508 set dec [expr int($lnT - log10( abs($err) ))] 509 # should the error be displayed? 510 if {$err < 0} { 511 return [format "%.${dec}f" $num] 512 } else { 513 set serr [expr int(0.5 + $err * pow(10,$dec))] 514 return [format "%.${dec}f(%d)" $num $serr] 515 } 516 } 517 } 466 518 } 467 519 … … 974 1026 } 975 1027 } 976 # so sorry, have to use Internet Explorer1028 # so sorry, have to use Safari, even if not default 977 1029 set url [file nativename $url]; # replace ~/ if present 978 1030 if {[file pathtype $url] == "relative"} { 979 1031 set url [file join [pwd] $url] 980 1032 } 981 exec osascript -e "tell application \" Internet Explorer\"\rGetURL \"file://$url\"\rend tell"1033 exec osascript -e "tell application \"Safari\" to open location \"file://$url\"" 982 1034 } elseif {$tcl_platform(platform) == "unix"} { 983 1035 set browserlist {} … … 1959 2011 proc SetEXPfile {expfile "newOK 0"} { 1960 2012 global expgui tcl_platform 1961 set expgui(expfile) {}1962 2013 if {[string trim $expfile] == ""} return 1963 2014 … … 2015 2066 # force exp files to be upper case, set to force save if name changes 2016 2067 set origexp $expname 2017 if {$expname != [string toupper $expfile]} { 2018 set expname [string toupper [file tail $expfile]] 2019 if {$tcl_platform(platform) != "windows"} {set expgui(changed) 1} 2020 } 2021 if {[file extension $expname] != ".EXP"} { 2068 if {$expname != [file tail $expfile] && $tcl_platform(platform) != "windows"} { 2069 set expgui(changed) 1 2070 } 2071 #puts $expgui(expfile) 2072 if {[string match {.O[0-9A-F][0-9A-F]} [file extension $expname]]} { 2073 set expname [ArchiveChoice $expname] 2074 set dirname "" 2075 if {$expname == ""} return 2076 } elseif {[file extension $expname] != ".EXP"} { 2022 2077 append expname ".EXP" 2023 2078 } 2024 if {$dirname == "." } {2079 if {$dirname == "." || $dirname == ""} { 2025 2080 set newexpfile $expname 2026 2081 } else { … … 2081 2136 if {[string tolower $ans] == "create"} { 2082 2137 # you've been warned this .EXP does not exist! 2083 # create an "empty" exp file 2084 createexp $newexpfile \ 2085 [getstring "title for experiment $expname" 60 0] 2086 if {! [file exists [file join $dirname $expname]]} { 2087 update 2088 MyMessageBox -parent . -title "File Creation Error" \ 2089 -message "Experiment file name \"$expname\" was not created -- This is unexpected, please try a different name" \ 2090 -icon warning -type Continue -default continue 2091 set expgui(resize) 1 2092 return 2093 } 2138 if [CreateMTexpfile $newexpfile] return 2094 2139 } else { 2095 2140 return 2096 2141 } 2097 2142 } 2098 set expgui(expfile) $newexpfile 2099 catch {cd [string trim [file dirname $expgui(expfile)]]} 2143 catch {cd [string trim [file dirname $newexpfile]]} 2144 return $newexpfile 2145 } 2146 2147 proc ArchiveChoice {expfile} { 2148 set expnam [file rootname $expfile] 2149 set ans [MyMessageBox -parent . -title "Load Archived File" \ 2150 -message "Loading archived version of $expnam. Do you want to continue using the same experiment name or work with the archived version under a new name?" \ 2151 -icon question -type "{Use New Name} {Continue with current}" \ 2152 -default {Use New Name} \ 2153 -helplink "expguierr.html LoadArchived" 2154 ] 2155 # archive the current .EXP file 2156 if {$ans != "use new name" && [file exists $expfile]} { 2157 # get the last archived version 2158 set lastf [lindex [lsort [glob -nocomplain $expnam.{O\[0-9A-F\]\[0-9A-F\]}]] end] 2159 if {$lastf == ""} { 2160 set num 01 2161 } else { 2162 regexp {.*\.O([0-9A-F][0-9A-F])$} $lastf a num 2163 scan $num %x num 2164 if {$num >= 255} { 2165 set num FF 2166 } else { 2167 set num [string toupper [format %.2x [incr num]]] 2168 } 2169 } 2170 catch { 2171 set newfile $expnam.O$num 2172 file rename -force $expnam.EXP $newfile 2173 set fp [open $expnam.LST a+] 2174 puts $fp "\n----------------------------------------------" 2175 puts $fp " Regressing to archive file [file tail $expfile]" 2176 puts $fp " but first archiving [file tail $expnam.EXP] as [file tail $newfile]" 2177 puts $fp "----------------------------------------------\n" 2178 close $fp 2179 } 2180 file copy -force $expfile $expnam.EXP 2181 set expfile $expnam.EXP 2182 } 2183 if {$ans == "use new name"} { 2184 set newexpfile [getExpFileName new] 2185 if {$newexpfile == ""} { 2186 set expgui(FileMenuEXPNAM) "" 2187 return 2188 } 2189 file copy -force $expfile $newexpfile 2190 set expgui(needpowpref) 2 2191 set expgui(needpowpref_why) "\tA new .EXP file was created\n" 2192 return $newexpfile 2193 } else { 2194 return $expfile 2195 } 2196 } 2197 2198 # create an "empty" exp file 2199 proc CreateMTexpfile {newexpfile} { 2200 set expname [file tail $newexpfile] 2201 createexp $newexpfile \ 2202 [getstring "title for experiment $expname" 60 0] 2203 if {! [file exists $newexpfile]} { 2204 update 2205 MyMessageBox -parent . -title "File Creation Error" \ 2206 -message "Experiment file name \"$expname\" was not created -- This is unexpected, please try a different name" \ 2207 -icon warning -type Continue -default continue 2208 set ::expgui(resize) 1 2209 return 1 2210 } 2211 return 0 2100 2212 } 2101 2213 … … 2129 2241 -side top -fill both -expand yes -pady 5 2130 2242 } elseif {$mode != "new"} { 2131 # for initial read, don't accessarchived files2243 # for initial read, don't offer access to archived files 2132 2244 pack [frame $expgui(FileInfoBox) -bd 4 -relief groove \ 2133 2245 -class SmallFont] \ … … 2158 2270 afterputontop 2159 2271 if {$expgui(FileMenuEXPNAM) == ""} return 2160 # is there a space in the EXP name? 2161 # if {[string first " " [file tail $expgui(FileMenuEXPNAM)]] != -1} { 2162 # update 2163 # MyMessageBox -parent . -title "File Name Error" \ 2164 # -message "File name \"$expgui(FileMenuEXPNAM)\" is invalid -- EXPGUI can#not process experiment files with spaces in the name" \ 2165 # -icon warning -type Continue -default continue 2166 # -helplink "expguierr.html OpenErr" 2167 # return 2168 # } 2169 # if {[string first " " $expgui(FileMenuDir)] != -1} { 2170 # set warn 1 2171 # catch {set warn $expgui(warnonexpdirspace)} 2172 # if $warn { 2173 # update 2174 # MyMessageBox -parent . -title "Good luck..." \ 2175 # -message "You are using a directory with a space in the name ($expgui(FileMenuDir)) -- You may encounter bugs in EXPGUI. Please e-mail them to Brian.Toby@ANL.gov so they can be fixed." \ 2176 # -icon warning -type Continue -default continue 2177 # # -helplink "expguierr.html OpenErr" 2178 # set expgui(warnonexpdirspace) 0 2179 # } 2180 # } 2272 #puts "end getexp $expgui(expfile)" 2181 2273 return [file join $expgui(FileMenuDir) $expgui(FileMenuEXPNAM)] 2182 2274 } 2183 2275 2184 2276 # validation routine 2277 # called from getExpFileName, either from Read button or from SelectExpFil (see expfilebox) 2185 2278 proc valid_exp_file {frm mode} { 2186 2279 global expgui tcl_platform … … 2208 2301 return 2209 2302 } 2210 # append a .EXP if not present 2211 if {[file extension $expgui(FileMenuEXPNAM)] == ""} { 2303 set ext [string toupper [file extension $expgui(FileMenuEXPNAM)]] 2304 if {$ext == ""} { 2305 # append a .EXP if not present 2212 2306 append expgui(FileMenuEXPNAM) ".EXP" 2213 } 2214 # is there a space in the name? 2215 # if {[string first " " $expgui(FileMenuEXPNAM)] != -1} { 2216 # MyMessageBox -parent . -title "File Name Error" \ 2217 # -message "File name $expgui(FileMenuEXPNAM) is invalid -- EXPGUI cannot process experiment files with spaces in the name" \ 2218 # -icon warning -type Continue -default continue 2219 # -helplink "expguierr.html OpenErr" 2220 # return 2221 # } 2222 # check for archive files 2223 if {[string match {*.O[0-9A-F][0-9A-F]} $expgui(FileMenuEXPNAM)] && \ 2307 } elseif {[string match {*.O[0-9A-F][0-9A-F]} $ext] && \ 2224 2308 $mode == "old" && [file exists $expgui(FileMenuEXPNAM)]} { 2309 # check for archive files 2225 2310 destroy .file 2226 2311 return 2227 } elseif { [string toupper [file extension $expgui(FileMenuEXPNAM)]]!= ".EXP"} {2312 } elseif {$ext != ".EXP"} { 2228 2313 # check for files that end in something other than .EXP .exp or .Exp... 2229 2314 MyMessageBox -parent . -title "File Open Error" \ … … 2258 2343 -helplink "expguierr.html OpenErr" 2259 2344 ] 2260 if {[string tolower $ans] == "create"} {destroy .file} 2345 if {[string tolower $ans] == "create"} { 2346 if [CreateMTexpfile $file] return 2347 destroy .file 2348 } 2261 2349 return 2262 2350 } … … 2417 2505 - [winfo height $box.top] - [winfo height $box.scroll]-25] 2418 2506 } 2419 2507 proc RevertExpFile {} { 2508 global expgui tcl_platform 2509 set frm .file 2510 catch {destroy $frm} 2511 toplevel $frm 2512 wm title $frm "Experiment file" 2513 bind $frm <Key-F1> "MakeWWWHelp expguierr.html open" 2514 pack [frame [set frmA $frm.1] -bd 2 -relief groove] -padx 3 -pady 3 -side left 2515 pack [frame [set frmC $frm.3] ] -padx 3 -pady 3 -side left \ 2516 -fill y -expand yes 2517 pack [button $frmC.help -text Help -bg yellow \ 2518 -command "MakeWWWHelp expguierr.html open"] \ 2519 -side top -anchor e 2520 set expgui(filesort) 0 2521 set expgui(includearchived) 1 2522 set expgui(FileInfoBox) $frmC.info 2523 pack [label $frmC.ar -text "(Showing Archived Files Only)"] -side top -pady 10 2524 pack [frame $expgui(FileInfoBox) -bd 4 -relief groove \ 2525 -class SmallFont] \ 2526 -side top -fill both -expand yes -pady 5 2527 2528 pack [button $frmC.b -text Read \ 2529 -command "valid_exp_file $frmA old"] -side bottom 2530 pack [button $frmC.q -text Cancel \ 2531 -command "set expgui(FileMenuEXPNAM) {}; destroy $frm"] -side bottom 2532 bind $frm <Return> "$frmC.b invoke" 2533 2534 pack [label $frmA.0 -text "Select an archived experiment file to read"] \ 2535 -side top -anchor center 2536 set bx $frmA 2537 pack [frame $bx.top] -side top 2538 #pack [label $bx.top.a -text "Directory" ] -side left 2539 set expgui(FileDirButtonMenu) [tk_optionMenu $bx.top.d expgui(FileMenuDir) [pwd] ] 2540 #pack $bx.top.d -side left 2541 #set expgui(FileMenuDir) [pwd] 2542 # the icon below is from tk8.0/tkfbox.tcl 2543 pack [frame $bx.a -width 200 -height 75] -side top -expand yes -fill both 2544 listbox $bx.a.files -relief raised -bd 2 \ 2545 -yscrollcommand "sync2boxesY $bx.a.files $bx.a.dates $bx.a.scroll" \ 2546 -height 15 -width 0 -exportselection 0 2547 listbox $bx.a.dates -relief raised -bd 2 \ 2548 -yscrollcommand "sync2boxesY $bx.a.dates $bx.a.files $bx.a.scroll" \ 2549 -height 15 -width 0 -takefocus 0 -exportselection 0 2550 scrollbar $bx.a.scroll -command "move2boxesY \" $bx.a.files $bx.a.dates \" " 2551 ChooseExpFil $bx 1 2552 if {[llength [$bx.a.files get 0 end]] == 0} { 2553 destroy $frm 2554 MyMessageBox -parent . -title "No Archives" \ 2555 -message "Sorry no archived versions of $::expgui(expfile) are present" \ 2556 -icon warning -type ok -default ok 2557 return 2558 } 2559 bind $bx.a.files <ButtonRelease-1> "ReleaseExpFil $bx" 2560 bind $bx.a.dates <ButtonRelease-1> "ReleaseExpFil $bx" 2561 bind $bx.a.files <Double-1> "SelectExpFil $bx old" 2562 bind $bx.a.dates <Double-1> "SelectExpFil $bx old" 2563 pack $bx.a.scroll -side left -fill y 2564 pack $bx.a.files $bx.a.dates -side left -fill both -expand yes 2565 pack [entry $bx.c -textvariable expgui(FileMenuEXPNAM)] -side top 2566 # force the window to stay on top 2567 putontop $frm 2568 focus $frmC.b 2569 tkwait window $frm 2570 afterputontop 2571 if {$expgui(FileMenuEXPNAM) == ""} return 2572 return [file join $expgui(FileMenuDir) $expgui(FileMenuEXPNAM)] 2573 } 2420 2574 2421 2575 # support routine for SetHistUseFlags … … 2542 2696 return 2543 2697 } 2698 2699 proc ScanEXPforError {"ns {}"} { 2700 # record types to ignore 2701 set ignorelist {DESCR HSTRY PNAM HNAM "REFN STATS"} 2702 set warn {} 2703 set badkeylist {} 2704 # scan file for warnings 2705 foreach key [array names ${ns}::exparray] { 2706 if {[string first "***" [set ${ns}::exparray($key)]] != -1 || 2707 [string first "#IN" [set ${ns}::exparray($key)]] != -1 || 2708 [string first "nan" [set ${ns}::exparray($key)]] != -1 || 2709 [string first "NAN" [set ${ns}::exparray($key)]] != -1 2710 } { 2711 #puts [set ${ns}::exparray($key)] 2712 set OK 0 2713 foreach i $ignorelist { 2714 if {[string first $i $key] != -1} { 2715 set OK 1 2716 break 2717 } 2718 } 2719 # ignore atom name section of Atom records 2720 if {(! $OK) && [string match "CRS*AT*A" $key]} { 2721 foreach str [list [string range [set ${ns}::exparray($key)] 0 49] 2722 [string range [set ${ns}::exparray($key)] 58 end]] { 2723 if {[string first "***" $str] || 2724 [string first "#INF" $str] || 2725 [string first "nan" $str] || 2726 [string first "NAN" $str]} { 2727 append warn " Record \"$key\": [set ${ns}::exparray($key)]\n" 2728 lappend badkeylist $key 2729 break 2730 } 2731 } 2732 continue 2733 } 2734 if {! $OK} { 2735 append warn " Record \"$key\": [set ${ns}::exparray($key)]\n" 2736 lappend badkeylist $key 2737 } 2738 } 2739 } 2740 if {$warn == ""} return 2741 set hint "" 2742 set unknown "" 2743 foreach key $badkeylist { 2744 if {[string match "CRS*AT*" $key]} { 2745 if {[string first "atomic parameter" $hint] == -1} { 2746 append hint "\t* An atomic parameter (coordinate, occupancy or U) appears out of range\n" 2747 } 2748 } elseif {[string match "CRS*ABC*" $key] || 2749 [string match "CRS*ANGLES*" $key] || 2750 [string match "CRS*CELVOL*" $key]} { 2751 if {[string first "cell parameter" $hint] == -1} { 2752 append hint "\t* A unit cell parameter appears out of range\n" 2753 } 2754 } elseif {[string match "CRS*ODF*" $key]} { 2755 if {[string first "spherical harmonic" $hint] == -1} { 2756 append hint "\t* A spherical harmonic (ODF) parameter appears out of range\n" 2757 } 2758 } elseif {[string match "HST*ICONS" $key]} { 2759 if {[string first "diffractometer constant" $hint] == -1} { 2760 append hint "\t* A diffractometer constant (wave, DIFC,...) appears out of range\n" 2761 } 2762 } elseif {[string match "HST*TRNGE" $key]} { 2763 if {[string first "histogram data range" $hint] == -1} { 2764 append hint "\t* A histogram data range value appears out of range\n" 2765 } 2766 } elseif {[string match "*GNLS RUN*" $key] || 2767 [string match "*GNLS SHFTS" $key] || 2768 [string match "HST*RPOWD" $key] || 2769 [string match " REFN RPOWD " $key] || 2770 [string match " REFN GDNFT " $key] 2771 } { 2772 if {[string first "refinement statistics" $hint] == -1} { 2773 append hint "\t* The refinement statistics imply the last refinement diverged\n" 2774 } 2775 } else { 2776 lappend unknown $key 2777 } 2778 } 2779 if {$unknown != ""} { 2780 append hint "\t* The following less common problem record(s) appear out of range:\n\t\t" 2781 foreach key $unknown { 2782 append hint "\"" [string trim $key] "\" " 2783 } 2784 } 2785 return "Likely error(s) noted:\n$hint\nDetails of problem(s):\n$warn" 2786 } 2787 2788 proc ExplainEXPerror {parent message file} { 2789 if {$parent == "."} { 2790 set w .experr 2791 } else { 2792 set w $parent.experr 2793 } 2794 catch {destroy $w} 2795 toplevel $w -class Dialog 2796 wm title $w "Corrupt .EXP file" 2797 wm iconname $w Dialog 2798 wm protocol $w WM_DELETE_WINDOW { } 2799 # Make the message box transient if the parent is viewable. 2800 if {[winfo viewable [winfo toplevel $parent]] } { 2801 wm transient $w $parent 2802 } 2803 frame $w.bot 2804 pack $w.bot -side bottom -fill both 2805 frame $w.top 2806 pack $w.top -side top -fill both -expand 1 2807 frame $w.msg 2808 pack $w.msg -in $w.top -side right -expand 1 -fill both -padx 3m -pady 3m 2809 set txt {Likely errors were noted when reading this file} 2810 append txt " ([file tail $file]). " 2811 append txt "These problems probably\narose from the last refinement, " 2812 append txt "based on settings applied in the previous saved file.\n" 2813 append txt "It is probably not possible to continue with this file.\n" 2814 append txt "You likely need to revert at least two archived versions back." 2815 grid [label $w.msg.s -text $txt -justify left] -row 0 -column 0 -sticky nws 2816 grid [button $w.msg.1 -text Help -bg yellow \ 2817 -command "MakeWWWHelp expgui.html badexp"] -row 0 -column 1 -columnspan 2 -sticky ne 2818 bind $w <Key-F1> "MakeWWWHelp expgui.html badexp" 2819 set filelist [lsort -dictionary -decreasing \ 2820 [glob -nocomplain \ 2821 [file root $file.O* ]]] 2822 grid [text $w.msg.t -font {Times 12} \ 2823 -height 10 -width 90 -relief flat -wrap word \ 2824 -yscrollcommand "$w.msg.rscr set" \ 2825 ] -row 1 -column 0 -columnspan 2 -sticky news 2826 grid [scrollbar $w.msg.rscr -command "$w.msg.t yview" \ 2827 ] -row 1 -column 2 -sticky ns 2828 # give extra space to the text box 2829 grid columnconfigure $w.msg 0 -weight 1 2830 grid rowconfigure $w.msg 1 -weight 1 2831 $w.msg.t insert end $message 2832 button $w.ok -command [list destroy $w] -text OK -default active 2833 pack $w.ok -in $w.bot -side left -expand 1 -padx 3m -pady 2m 2834 putontop $w 2835 tkwait window $w 2836 afterputontop 2837 } 2838 2544 2839 proc UpdateInfoBox {} { 2545 2840 global expgui … … 2548 2843 set file [file join [set expgui(FileMenuDir)] $expgui(FileMenuEXPNAM)] 2549 2844 if [file isdirectory $file] return 2550 if [file exists $file] { 2845 if [file exists $file] { 2551 2846 pack [label $expgui(FileInfoBox).1 -text $expgui(FileMenuEXPNAM)] \ 2552 2847 -side top 2553 2848 catch { 2849 # load the EXP file into a namespace & scan for errors 2850 expload $file scan 2851 set warnings [ScanEXPforError scan] 2852 if {$warnings != ""} { 2853 pack [frame $expgui(FileInfoBox).1a -bg yellow -padx 4 -pady 4] -side top 2854 pack [label $expgui(FileInfoBox).1a.err -justify left \ 2855 -text "WARNING: Likely corrupt" -bg yellow] \ 2856 -side left -anchor w -fill both 2857 pack [button $expgui(FileInfoBox).1a.show \ 2858 -text "More..." -padx 0 \ 2859 -command "ExplainEXPerror $expgui(FileInfoBox) [list $warnings] $file"\ 2860 ] -side right -anchor w 2861 } 2554 2862 set fp [open $file r] 2555 2863 global testline … … 2562 2870 -text "last GENLES run:\n $last\n total cycles: $cycles"] \ 2563 2871 -side top -anchor w 2872 set chi2 ? 2873 set vars ? 2564 2874 regexp {REFN GDNFT.*= *([0-9]*\.[0-9]*) +for *([0-9]+) variables} \ 2565 2875 $testline a chi2 vars … … 2600 2910 -text $lbl] \ 2601 2911 -side top -anchor w 2602 } 2912 } err 2603 2913 } 2604 2914 } … … 2634 2944 # fill the files & dates & Directory selection box with current directory, 2635 2945 # also called when box is created to fill it 2636 proc ChooseExpFil {frm } {2946 proc ChooseExpFil {frm "archiveonly 0"} { 2637 2947 global expgui 2638 2948 set files $frm.a.files … … 2641 2951 $files delete 0 end 2642 2952 $dates delete 0 end 2643 $files insert end {<Parent>} 2644 $dates insert end {(Directory)} 2645 set filelist [glob -nocomplain \ 2646 [file join [set expgui(FileMenuDir)] *] ] 2647 foreach file [lsort -dictionary $filelist] { 2648 if {[file isdirectory $file]} { 2649 $files insert end [file tail $file] 2650 $dates insert end {(Directory)} 2651 } 2953 if {$archiveonly == 0} { 2954 $files insert end {<Parent>} 2955 $dates insert end {(Directory)} 2956 set filelist [glob -nocomplain \ 2957 [file join [set expgui(FileMenuDir)] *] ] 2958 foreach file [lsort -dictionary $filelist] { 2959 if {[file isdirectory $file]} { 2960 $files insert end [file tail $file] 2961 $dates insert end {(Directory)} 2962 } 2963 } 2964 } else { 2965 set filelist [glob -nocomplain \ 2966 [file root $expgui(expfile)].O* ] 2652 2967 } 2653 2968 set pairlist {} 2654 2969 foreach file [lsort -dictionary $filelist] { 2655 2970 if {![file isdirectory $file] && \ 2656 [string toupper [file extension $file]] == ".EXP"} { 2971 [string toupper [file extension $file]] == ".EXP" \ 2972 && $archiveonly == 0} { 2657 2973 set modified [file mtime $file] 2658 2974 lappend pairlist [list $file $modified] … … 2704 3020 if {$expgui(expfile) == [file join $expgui(FileMenuDir) $file]} { 2705 3021 $files selection set $i 3022 set expgui(FileMenuEXPNAM) $file 3023 UpdateInfoBox 2706 3024 } 2707 3025 } … … 3398 3716 global expgui 3399 3717 if {$expgui(MacroChanged)} { 3718 3400 3719 set ans [MyMessageBox -parent $txt -title "Save macro file?" \ 3401 3720 -message "Macro file has been changed, do you want to save it?" \ -
trunk/gsasmenu.tcl
r1025 r1166 9 9 array set expgui_menulist { 10 10 file { 11 revert 11 12 EraseHistory 12 13 convert … … 25 26 bkgedit 26 27 excledt 27 instedit28 28 seqgsas 29 29 mustrplot 30 instedit 30 31 } 31 32 xtal { … … 57 58 cllchg 58 59 composition 59 fprime60 60 hklgen 61 61 rducll … … 158 158 } 159 159 160 revert {{readnewexp archive} { 161 Select an old version of the current GSAS file} 162 } 163 160 164 {archive EXP} {- { 161 165 Toggles archiving of .EXP files. When on, files are … … 304 308 fitspec {{runGSASprog $cmd} { 305 309 Fit a TOF vanadium scattering spectrum} 306 }307 308 fprime {{runGSASprog $cmd} {309 Compute f, f', f'' and mu/rho for an element for a range of x-ray wavelengths}310 310 } 311 311 … … 363 363 instedit {{EditInstFile} { 364 364 Edit an instrument parameter file} 365 } 366 {New InstParm file} {- { 367 Create a new instrument parameter file} 365 368 } 366 369 -
trunk/instedit.tcl
r991 r1166 78 78 # loop over banks 79 79 set msg {} 80 for {set i 1} {$i <= $instdat(lastbank)} {incr i} { 81 instbankinfo rad $i set $instdat(rad$i) 82 instbankinfo head $i set $instdat(head$i) 83 if {[string trim $instdat(name$i)] == ""} { 84 append msg "\n The instrument name may not be blank" 85 } 86 instbankinfo name $i set $instdat(name$i) 87 set l {} 88 foreach var {difc difa zero pola ipola kratio} { 89 lappend l $instdat(${var}$i) 90 } 91 if {[instbankinfo icons $i set $l] != 1} { 92 append msg "\n There is an error in values for:\n the wavelength, zero or polarization" 93 } 94 # loop over the profile terms 95 96 for {set j 1} {$j <= $instparms(proftypes${i})} {incr j} { 97 set l {} 98 for {set k 1} {$k <= $instparms(profterms${i}_$j)} {incr k} { 99 lappend l $instdat(prof${i}_${j}_$k) 100 } 101 if {[instprofinfo $i $j set [list \ 102 $instdat(proftype${i}_$j) $instdat(profcut${i}_$j) $l]\ 103 ] != 1} { 104 append msg "\n There is an error in the values for profile set $j." 105 } 106 } 107 if {$msg != ""} { 108 MyMessageBox -parent . -title "No save" \ 80 if {[catch { 81 for {set i 1} {$i <= $instdat(lastbank)} {incr i} { 82 instbankinfo rad $i set $instdat(rad$i) 83 instbankinfo head $i set $instdat(head$i) 84 if {[string trim $instdat(name$i)] == ""} { 85 append msg "\n The instrument name may not be blank" 86 } 87 instbankinfo name $i set $instdat(name$i) 88 set l {} 89 foreach var {difc difa zero pola ipola kratio} { 90 lappend l $instdat(${var}$i) 91 } 92 if {[instbankinfo icons $i set $l] != 1} { 93 append msg "\n There is an error in values for:\n the wavelength, zero or polarization" 94 } 95 # loop over the profile terms 96 97 for {set j 1} {$j <= $instparms(proftypes${i})} {incr j} { 98 set l {} 99 for {set k 1} {$k <= $instparms(profterms${i}_$j)} {incr k} { 100 lappend l $instdat(prof${i}_${j}_$k) 101 } 102 if {[instprofinfo $i $j set [list \ 103 $instdat(proftype${i}_$j) $instdat(profcut${i}_$j) $l]\ 104 ] != 1} { 105 append msg "\n There is an error in the values for profile set $j." 106 } 107 } 108 if {$msg != ""} { 109 MyMessageBox -parent . -title "No save" \ 109 110 -message "Error in input for bank $i:$msg" -icon warning \ 110 111 -type Sorry -default sorry 111 return 112 } 112 return 113 } 114 } 115 } errmsg]} { 116 if {$errmsg == ""} return 117 MyMessageBox -parent . -title "No save" \ 118 -message "Error in input (did you define data type, profile type, etc?):\n$errmsg" -icon warning \ 119 -type Sorry -default sorry 120 return 113 121 } 114 122 if {$filename == ""} { … … 150 158 proc instShowBank {box} { 151 159 global instdat instparms 160 set instparms(profileframe) {} 161 152 162 set topfr $box.a 153 163 if {$instparms(bank) == 0} return … … 159 169 } 160 170 if {$instparms(banklabel) == ""} { 161 puts starting162 171 return 163 172 } … … 562 571 proc AddInstProfile {box b} { 563 572 global instparms instdat 564 set frame $instparms(profileframe)565 573 incr instparms(proftypes${b}) 566 574 instShowBank $box … … 759 767 -parent $instparms(top) -defaultextension .ins \ 760 768 -filetypes {{"Instrument parameters file" ".ins .inst .prm"} {All *.*}}] 769 } elseif {$filename == "(new)"} { 770 set instparms(filename) "" 761 771 } else { 762 772 set instparms(filename) $filename -
trunk/liveplot
r993 r1166 14 14 # process command line arguments 15 15 set exitstat 0 16 set expnam [ lindex $argv 0]16 set expnam [file root [lindex $argv 0]] 17 17 if {$expnam == ""} {catch {puts "error -- no experiment name"}; set exitstat 1} 18 18 if $exitstat { … … 20 20 exit 21 21 } 22 22 # work in .EXP directory (in case files will be exported). 23 catch { 24 cd [file dirname $expnam] 25 } 23 26 # get name of script 24 27 set expgui(script) [info script] … … 42 45 set graph(legend) [lindex $argv 2] 43 46 } 47 set plot_title "(None)" 44 48 45 49 set graph(backsub) 0 … … 79 83 set expgui(fadetime) 10 80 84 set expgui(hklbox) 1 81 set expgui(autotick) 085 set expgui(autotick) 1 82 86 set expgui(phaselabel) 0 83 87 set expgui(pixelregion) 5 … … 174 178 source [file join $expgui(scriptdir) readexp.tcl] 175 179 source [file join $expgui(scriptdir) opts.tcl] 180 #---------------------------------------------------------------- 181 # use EXPGUI directory for packages 182 lappend auto_path $expgui(scriptdir) 176 183 177 184 if {$program == "bkgedit"} { … … 357 364 catch {$vec variable $vec} 358 365 } 359 set maxdiff [set diffvec(max)] 360 set cmin [set calcvec(min)] 361 set omin [set obsvec(min)] 362 set cmax [set calcvec(max)] 363 set omax [set obsvec(max)] 364 set expgui(min) [expr {$omin < $cmin ? $omin : $cmin}] 365 set expgui(max) [expr {$omax > $cmax ? $omax : $cmax}] 366 set ymin1 [expr {$cmin - 1.1*$maxdiff}] 367 set ymin2 [expr {$omin - 1.1*$maxdiff}] 368 if {$ymin1 < $ymin2} { 369 diffvec set [diffvec + $ymin1] 370 } { 371 diffvec set [diffvec + $ymin2] 372 } 366 ApplyMag 373 367 plotdata 374 368 } … … 441 435 wifdvec set $sumlist 442 436 wifdvec set [wifdvec / [wifdvec length]] 443 } 444 if {$graph(OmCoS)} { 437 } elseif {$graph(OmCoS)} { 445 438 wifdvec set $WGT 446 439 wifdvec expr sqrt(wifdvec) 447 440 wifdvec set [wifdvec * diffvec] 441 } else { 442 wifdvec length 0 448 443 } 449 444 if $graph(backsub) { … … 451 446 calcvec set [calcvec - bckvec] 452 447 } 453 global obsvec calcvec diffvec 454 set maxdiff [set diffvec(max)] 455 set cmin [set calcvec(min)] 456 set omin [set obsvec(min)] 457 set cmax [set calcvec(max)] 458 set omax [set obsvec(max)] 459 set expgui(min) [expr {$omin < $cmin ? $omin : $cmin}] 460 set expgui(max) [expr {$omax > $cmax ? $omax : $cmax}] 461 set ymin1 [expr {$cmin - 1.1*$maxdiff}] 462 set ymin2 [expr {$omin - 1.1*$maxdiff}] 463 if {$ymin1 < $ymin2} { 464 diffvec set [diffvec + $ymin1] 465 } { 466 diffvec set [diffvec + $ymin2] 467 } 468 448 ApplyMag 449 plotdata 450 } 451 452 proc SetTitle {} { 453 set bx .title 454 toplevel $bx 455 wm title $bx "Edit plot title" 456 wm iconname $bx "Edit plot title" 457 grid [label $bx.txt -text "Enter plot title below"] -row 1 -column 1 458 grid [entry $bx.title -width 70] -row 2 -column 1 459 grid [frame $bx.a] -row 3 -column 1 460 grid [button $bx.a.save -text "Save" \ 461 -command "set plot_title \"\[$bx.title get\]\"; destroy $bx" \ 462 ] -row 1 -column 1 463 grid [button $bx.a.quit -text "Quit" \ 464 -command "destroy $bx" \ 465 ] -row 1 -column 2 466 putontop $bx 467 tkwait window $bx 468 afterputontop 469 469 plotdata 470 470 } … … 572 572 global expnam hst peakinfo xunits yunits cycle reflns modtime 573 573 global lasthst graph expgui box 574 global obsvec calcvec diffvec 575 576 if {$graph(yunits) == 2} { 577 set yunits {Intensity/sigma(I)} 578 wifdvec set $::weightlist 579 wifdvec expr sqrt(wifdvec) 580 obsvec set [obsvec * wifdvec] 581 calcvec set [calcvec * wifdvec] 582 bckvec set {} 583 diffvec set [obsvec - calcvec] 584 wifdvec set {} 585 $box element config 1 -label {} -line 0 -hide 1 586 } else { 587 $box element config 1 -label bckgr -line 1 -hide 0 588 } 589 590 set cmin [set calcvec(min)] 591 set omin [set obsvec(min)] 592 set cmax [set calcvec(max)] 593 set omax [set obsvec(max)] 594 set expgui(min) [expr {$omin < $cmin ? $omin : $cmin}] 595 set expgui(max) [expr {$omax > $cmax ? $omax : $cmax}] 574 596 575 597 foreach p $::expmap(phaselist) { … … 592 614 return 593 615 } 594 $box config -title "$expnam cycle $cycle Hist $hst" 616 if {$::plot_title == "(None)"} { 617 $box config -title "$expnam cycle $cycle Hist $hst" 618 } else { 619 $box config -title $::plot_title 620 } 595 621 $box xaxis config -title $xunits 596 622 $box yaxis config -title $yunits … … 622 648 calcvec notify now 623 649 bckvec notify now 624 diffvec notify now625 650 wifdvec notify now 626 651 # now deal with peaks 627 for {set i 1} {$i < 10} {incr i} { 628 if {$expgui(autotick)} { 629 set div [expr {( $expgui(max) - $expgui(min) )/40.}] 630 set ymin [expr {$expgui(min) - ($i+1) * $div}] 631 set ymax [expr {$expgui(min) - $i * $div}] 632 } else { 633 set ymin $peakinfo(min$i) 634 set ymax $peakinfo(max$i) 635 } 636 set j 0 637 if [set peakinfo(flag$i)] { 638 foreach X $reflns($i) { 639 incr j 640 catch { 641 $box marker create line -name peaks${i}_$j 642 } 643 $box marker config peaks${i}_$j -under 1 \ 644 -coords "$X $ymin $X $ymax" 645 catch { 646 $box marker config peaks${i}_$j \ 647 $graph(MarkerColorOpt) [list $peakinfo(color$i)] 648 if {$peakinfo(dashes$i) && ! $expgui(autotick)} { 649 $box marker config peaks${i}_$j -dashes "5 5" 650 } 651 } 652 #for {set i 1} {$i < 10} {incr i} 653 set k 0 654 set cmin $expgui(min) 655 foreach i $::expmap(phaselist) { 656 if {[set peakinfo(flag$i)]} { 657 incr k 658 if {$expgui(autotick)} { 659 set div [expr {( $expgui(max) - $expgui(min) )/40.}] 660 set ymin [expr {$expgui(min) - ($k+1) * $div}] 661 set ymax [expr {$expgui(min) - $k * $div}] 662 if {$cmin > $ymin} {set cmin $ymin} 663 } else { 664 set ymin $peakinfo(min$i) 665 set ymax $peakinfo(max$i) 666 } 667 set j 0 668 foreach X $reflns($i) { 669 incr j 670 catch { 671 $box marker create line -name peaks${i}_$j 672 } 673 $box marker config peaks${i}_$j -under 1 \ 674 -coords "$X $ymin $X $ymax" 675 catch { 676 $box marker config peaks${i}_$j \ 677 $graph(MarkerColorOpt) [list $peakinfo(color$i)] 678 if {$peakinfo(dashes$i) && ! $expgui(autotick)} { 679 $box marker config peaks${i}_$j -dashes "5 5" 680 } 681 } 652 682 } 653 683 catch {$box element create phase$i} 654 684 catch { 655 685 $box element config phase$i -color $peakinfo(color$i) \ 656 686 -label $graph(label$i) 657 687 } 658 688 } else { … … 661 691 } 662 692 } 693 # offset the difference pattern 694 set maxdiff [set diffvec(max)] 695 if {$expgui(autotick)} { 696 diffvec set [diffvec + [expr {$cmin - $maxdiff}]] 697 } else { 698 diffvec set [diffvec + [expr {$cmin - 1.1*$maxdiff}]] 699 } 700 diffvec notify now 701 663 702 # force an update of the plot as BLT may not 664 703 $box config -title [$box cget -title] … … 1122 1161 eval $box y2axis config $graph(ElementHideOption) 1123 1162 $box element config 0 -label "" 1163 # clear the vector 1164 wifdvec set {} 1165 wifdvec notify now 1124 1166 } 1125 1167 } … … 2046 2088 setlegend $box $graph(legend) 2047 2089 2090 set ps2pdfcmd {} 2091 set gnuplotpath {} 2092 # find gnuplot 2093 if {$::tcl_platform(platform) == "windows"} { 2094 set gnuplotpath [file join $::expgui(gsasexe) "gnuplot/gnuplot.exe"] 2095 if {![file exists $gnuplotpath]} { 2096 set gnuplotpath [auto_execok gnuplot.exe] 2097 } 2098 } else { 2099 set ::env(PATH) "${::expgui(gsasexe)}:${::env(PATH)}" 2100 auto_reset 2101 set gnuplotpath [auto_execok gnuplot] 2102 } 2103 # find postscript conversion routine 2104 if {$::tcl_platform(platform) == "windows"} { 2105 set gspath [file join $::expgui(gsasexe) "gs/bin/gswin32c.exe"] 2106 if {![file exists $gspath]} { 2107 set gspath [auto_execok gswin32c.exe] 2108 } 2109 if {[file exists $gspath]} { 2110 set ps2pdfcmd "$gspath -q -P- -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=\$pdfoutname -c save pop -f \$psoutname" 2111 } 2112 } else { 2113 # look for ghostscript 2114 set gspath [auto_execok gs] 2115 if {[file exists $gspath]} { 2116 set ps2pdfcmd "$gspath -q -P- -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=\$pdfoutname -c save pop -f \$psoutname" 2117 } else { 2118 set gspath [auto_execok pstopdf]; # this is on Mac only 2119 if {[file exists $gspath]} { 2120 set ps2pdfcmd "$gspath \$psoutname -o \$pdfoutname" 2121 } 2122 } 2123 } 2124 set gnuplotexport {} 2125 catch { 2126 source [file join $expgui(scriptdir) gnuplot.tcl] 2127 } 2128 2129 #====================================================================== 2130 # make menus 2048 2131 frame .a -bd 3 -relief groove 2049 2132 pack [menubutton .a.file -text File -underline 0 -menu .a.file.menu] -side left … … 2054 2137 .a.file.menu add command -label "Update Plot" \ 2055 2138 -command {set cycle [getcycle];readdata .g} 2139 .a.file.menu add command -label "Set Plot Title" \ 2140 -command SetTitle 2056 2141 .a.file.menu add cascade -label "Export plot" -menu .a.file.menu.export 2057 2142 menu .a.file.menu.export … … 2062 2147 .a.file.menu.export add command -label "to Grace" -command exportgrace 2063 2148 } 2149 if {$gnuplotpath == {}} { 2150 .a.file.menu.export add cascade -label "gnuplot program not found" 2151 } elseif {$gnuplotexport == ""} { 2152 .a.file.menu.export add cascade -label "file gnuplot.tcl not found" 2153 } elseif {$ps2pdfcmd == ""} { 2154 .a.file.menu.export add cascade -label "gs or pstopdf program not found" 2155 } else { 2156 .a.file.menu.export add command -label "to PDF" -command ExportPDF 2157 } 2158 2064 2159 .a.file.menu add command -label Quit -command "destroy ." 2065 2160 .a.file.menu.export add command -label "as .csv file" \ … … 2089 2184 .a.options.menu.tick add separator 2090 2185 2186 pack [menubutton .a.mag -text Magnification -underline 0 -menu .a.mag.menu] \ 2187 -side left 2188 menu .a.mag.menu 2189 set maglist {} 2190 set mag0 1.0 2191 # display magnification routines 2192 proc ShowMag {} { 2193 global blt_version tcl_platform peakinfo expgui 2194 set bx .opt 2195 catch {destroy $bx} 2196 toplevel $bx 2197 putontop $bx 2198 wm iconname $bx "Mag Regs" 2199 wm title $bx "Plot Magnification Regions" 2200 pack [label $bx.0 -text "Magnification Regions:"] -side top 2201 if {[llength $::maglist] == 0} { 2202 set lbl "None" 2203 } else { 2204 set lbl "" 2205 set xm $::xvec(min) 2206 set ym $::mag0 2207 set ::maglist [lsort -real -index 0 $::maglist] 2208 foreach pair $::maglist { 2209 foreach {xh ymh} $pair {} 2210 append lbl "\tfrom $xm to $xh: times $ym\n" 2211 set xm $xh 2212 set ym $ymh 2213 } 2214 set xh $::xvec(max) 2215 append lbl "\tfrom $xm to $xh: times $ym" 2216 } 2217 pack [label $bx.1 -text $lbl -justify left] -side top 2218 pack [button $bx.2 -text "Close" -command "destroy $bx"] -side top 2219 tkwait window $bx 2220 afterputontop 2221 } 2222 2223 # edit magnification regions 2224 proc EditMag {} { 2225 set ::multrow 1 2226 set bx .opt 2227 catch {destroy $bx} 2228 toplevel $bx 2229 putontop $bx 2230 wm iconname $bx "Mag Regs" 2231 wm title $bx "Edit Magnification Regions" 2232 pack [label $bx.0 -text "Vertical Magnification Regions:"] -side top 2233 if {[llength $::maglist] == 0} { 2234 set lbl "None" 2235 pack [label $bx.1 -text $lbl -justify left] -side top 2236 pack [button $bx.2 -text "Close" -command "destroy $bx"] -side top 2237 tkwait window $bx 2238 afterputontop 2239 return 2240 } else { 2241 pack [frame $bx.1] -side top 2242 set ::maglist [lsort -real -index 0 $::maglist] 2243 set row 0 2244 foreach pair $::maglist { 2245 foreach {xh ymh} $pair {} 2246 set row1 [expr {$row + 1}] 2247 set ::xmag($row1) $xh 2248 set ::mag($row1) $ymh 2249 if {$row == 0} { 2250 grid [label $bx.1.a$row -text "From "] -column 1 -row $row 2251 grid [label $bx.1.b$row -text $::xvec(min)] -column 2 -row $row 2252 grid [label $bx.1.c$row -text " to "] -column 3 -row $row 2253 grid [entry $bx.1.d$row -textvariable xmag(1) -width 6] -column 4 -row $row 2254 grid [label $bx.1.e$row -text " times "] -column 5 -row $row 2255 grid [entry $bx.1.f$row -textvariable mag0 -width 4] -column 6 -row $row 2256 } else { 2257 grid [label $bx.1.a$row -text "From "] -column 1 -row $row 2258 grid [entry $bx.1.b$row -textvariable xmag($row) -width 6] -column 2 -row $row 2259 grid [label $bx.1.c$row -text " to "] -column 3 -row $row 2260 grid [entry $bx.1.d$row -textvariable xmag($row1) -width 6] -column 4 -row $row 2261 grid [label $bx.1.e$row -text " times "] -column 5 -row $row 2262 grid [entry $bx.1.f$row -textvariable mag($row) -width 4] -column 6 -row $row 2263 } 2264 incr row 2265 } 2266 grid [label $bx.1.a$row -text "From "] -column 1 -row $row 2267 grid [entry $bx.1.b$row -textvariable xmag($row) -width 6] -column 2 -row $row 2268 grid [label $bx.1.c$row -text " to "] -column 3 -row $row 2269 grid [label $bx.1.d$row -text $::xvec(max)] -column 4 -row $row 2270 grid [label $bx.1.e$row -text " times "] -column 5 -row $row 2271 grid [entry $bx.1.f$row -textvariable mag($row) -width 4] -column 6 -row $row 2272 set ::multrow $row 2273 } 2274 pack [label $bx.l -text "\nSet the multiplier to zero to delete a region"] -side top 2275 pack [frame $bx.2] -side top 2276 pack [button $bx.2.a -text "Edit" -command "destroy $bx"] -side left 2277 pack [button $bx.2.b -text "Cancel" -command "set multrow 0; destroy $bx"] -side left 2278 tkwait window $bx 2279 afterputontop 2280 if {$::multrow == 0} return 2281 set newmaglist {} 2282 set xp $::xvec(min) 2283 for {set i 1} {$i <= $::multrow} {incr i} { 2284 if {$::mag($i) > 0} { 2285 lappend newmaglist [list $::xmag($i) $::mag($i)] 2286 } 2287 set xp $::xmag($i) 2288 } 2289 set ::maglist $newmaglist 2290 readdata .g 2291 } 2292 2293 # show a menu to add a magnification region 2294 proc AddMag {} { 2295 set bx .opt 2296 catch {destroy $bx} 2297 toplevel $bx 2298 putontop $bx 2299 wm iconname $bx "Add Regs" 2300 wm title $bx "Add Plot Magnification Region" 2301 pack [frame $bx.0] -side top 2302 pack [label $bx.0.a -text "Magnify from "] -side left 2303 pack [entry $bx.0.b -textvariable xmin -width 6] -side left 2304 pack [label $bx.0.c -text " to next region. Multiply by "] -side left 2305 pack [entry $bx.0.d -textvariable mult -width 4] -side left 2306 pack [frame $bx.2] -side top 2307 pack [button $bx.2.a -text "Add" -command "destroy $bx"] -side left 2308 pack [button $bx.2.b -text "Cancel" -command "set mult {}; destroy $bx"] -side left 2309 if {[catch {expr $::mult}]} {set ::mult 1.0} 2310 if {$::mult <= 0} {set ::mult 1.0} 2311 tkwait window $bx 2312 afterputontop 2313 catch { 2314 if {$::xmin < $::xvec(min)} {set ::xmin $::xvec(min)} 2315 if {$::xmin > $::xvec(max)} {set ::xmin $::xvec(max)} 2316 if {$::mult > 0} { 2317 lappend ::maglist [list $::xmin $::mult] 2318 readdata .g 2319 } else { 2320 MyMessageBox -parent . -title "Invalid" \ 2321 -message "Invalid input, try again" \ 2322 -icon error -type Continue -default continue 2323 } 2324 } 2325 } 2326 proc AddCursorMag {p m} { 2327 set x [.g xaxis invtransform $p] 2328 if {$x < $::xvec(min) || $x > $::xvec(max) } { 2329 bell 2330 return 2331 } 2332 lappend ::maglist [list $x $m] 2333 readdata .g 2334 } 2335 2336 # scale the data with magnification regions 2337 proc ApplyMag {} { 2338 foreach mrk [.g marker names mag*] { 2339 .g marker delete $mrk 2340 } 2341 if {[llength $::maglist] == 0} return 2342 global xvec 2343 vector create ymult([xvec length]) 2344 set xl $xvec(min) 2345 set ym $::mag0 2346 set i 0 2347 set ::maglist [lsort -real -index 0 $::maglist] 2348 foreach pair $::maglist { 2349 foreach {xh ymh} $pair {} 2350 set xr [xvec search $xl $xh] 2351 #puts "$xl $xh [lindex $xr 0]:[lindex $xr end] $ym" 2352 if {[lindex $xr 0] != [lindex $xr end]} { 2353 set ymult([lindex $xr 0]:[lindex $xr end]) $ym 2354 if {$xl != $xvec(min)} { 2355 .g marker create line -coords "$xl -Inf $xl Inf" -name mag[incr i] 2356 } 2357 .g marker create text -coords "$xl Inf" -name mag[incr i] -text "x$ym" -anchor w 2358 } 2359 set xl $xh 2360 set ym $ymh 2361 } 2362 set xh $xvec(max) 2363 set xr [xvec search $xl $xh] 2364 set ymult([lindex $xr 0]:[lindex $xr end]) $ym 2365 #puts "$xl $xh [lindex $xr 0]:[lindex $xr end] $ym" 2366 .g marker create line -coords "$xl -Inf $xl Inf" -name mag[incr i] 2367 .g marker create text -coords "$xl Inf" -name mag[incr i] -text "x$ym" -anchor w 2368 foreach vec {obsvec calcvec bckvec diffvec} { 2369 global $vec 2370 $vec expr {$vec * ymult} 2371 } 2372 } 2373 2374 # create a PDF using GNUPLOT & GhostScript 2375 proc ExportPDF {} { 2376 set msg {} 2377 if {$::gnuplotpath == {}} { 2378 append msg "\n\tThe gnuplot program was not found" 2379 } 2380 if {$::gnuplotexport == ""} { 2381 append msg "\n\tfile gnuplot.tcl not found in $::expgui(scriptdir)" 2382 } 2383 if {$::ps2pdfcmd == ""} { 2384 append msg "\n\tNo PDF conversion routine (ghostscript or pstopdf on Mac was found" 2385 } 2386 if {$msg != ""} { 2387 MyMessageBox -parent . -title "Gnuplot/GS Error" \ 2388 -message $msg \ 2389 -icon error -type OK -default OK 2390 return 0 2391 } 2392 2393 set pdfoutname [tk_getSaveFile -title "Select output file" -parent . \ 2394 -defaultextension ".pdf" \ 2395 -initialdir [pwd] \ 2396 -initialfile "[file rootname $::expnam].pdf"] 2397 if { $pdfoutname == "" } { return } 2398 cd [file dirname $pdfoutname] 2399 set pdfoutname [regsub -all " " [file tail $pdfoutname] "_"] 2400 set rootname [file root $pdfoutname] 2401 set csvoutname "$rootname.csv" 2402 set gplotname "$rootname.gplot" 2403 set psoutname "$rootname.ps" 2404 foreach filename [list $pdfoutname $csvoutname $gplotname $psoutname] { 2405 catch {file -force delete $filename} 2406 } 2407 waitmsg "running gnuplot, Please wait" 2408 Graph2Gnuplot .g $gplotname $psoutname $csvoutname 2409 if {![file exists $gplotname]} { 2410 set msg "\n Output file for gnuplot not created! ($gplotname)" 2411 } 2412 if {![file exists $csvoutname]} { 2413 append msg "\n Output file for gnuplot not created! ($csvoutname)" 2414 } 2415 if {$msg == ""} { 2416 if {[catch { exec $::gnuplotpath $gplotname } err]} { 2417 if {[string first "Warning" $err] == -1} { 2418 append msg "Error in running gnuplot: $err" 2419 } 2420 } 2421 if {![file exists $psoutname]} { 2422 append msg "\n Output file from gnuplot not created! ($psoutname)" 2423 } 2424 } 2425 if {$msg == ""} { 2426 if {[catch { eval exec [subst $::ps2pdfcmd]} err]} { 2427 append msg "Error in PDF conversion: $err" 2428 } 2429 if {![file exists $pdfoutname]} { 2430 append msg "\n PDF file not created! ($pdfoutname)" 2431 } 2432 } 2433 donewaitmsg 2434 if {$msg == ""} { 2435 # clean up 2436 foreach filename [list $csvoutname $gplotname $psoutname] { 2437 catch {file -force delete $filename} 2438 } 2439 MyMessageBox -parent . -title "PDF created" \ 2440 -message "Success: PDF file created ($pdfoutname)" \ 2441 -type OK -default OK 2442 return 1 2443 } else { 2444 # something failed 2445 MyMessageBox -parent . -title "Gnuplot/GS Error" \ 2446 -message "Error: $msg" \ 2447 -icon error -type OK -default OK 2448 return 0 2449 } 2450 } 2451 2452 # resize graph font only 2453 proc ResizeGraphFont {graph font} { 2454 foreach w {legend xaxis yaxis xaxis yaxis \ 2455 x2axis y2axis x2axis y2axis} \ 2456 o {-font -tickfont -tickfont -titlefont -titlefont \ 2457 -tickfont -tickfont -titlefont -titlefont} { 2458 catch { 2459 $graph $w configure $o $font 2460 } 2461 } 2462 catch { 2463 set curfont [$graph cget -font] 2464 if {[string tolower [lindex $curfont 0]] == "symbol"} { 2465 $graph configure -font "Symbol [lrange $font 1 end]" 2466 } else { 2467 $graph configure -font $font 2468 } 2469 } 2470 } 2471 2091 2472 if {$program == "liveplot"} { 2473 .a.mag.menu add command -label "Add region" -command "AddMag" 2474 .a.mag.menu add command -label "Edit Regions" -command "EditMag" 2475 .a.mag.menu add separator 2476 .a.mag.menu add command -label "Clear" \ 2477 -command "set maglist {}; readdata .g" 2092 2478 .a.options.menu add command -label "Obs symbol" -command getsymopts 2479 foreach i {1 2 3 4 5 6 7 8 9} { 2480 bind . <Control-Key-$i> "AddCursorMag %x $i" 2481 } 2093 2482 } else { 2094 2483 .a.options.menu add cascade -label "Symbol Type" -menu .a.options.menu.sym … … 2131 2520 -variable graph(yunits) -value 1 \ 2132 2521 -command {set cycle [getcycle];readdata .g} 2522 .a.options.menu.yunits add radiobutton -label "I/Sigma(I)" \ 2523 -variable graph(yunits) -value 2 \ 2524 -command {set cycle [getcycle];readdata .g} 2133 2525 .a.options.menu add command -label "HKL labeling" -command setlblopts 2134 2526 .a.options.menu add checkbutton -label "Subtract background" \ … … 2155 2547 } 2156 2548 if {$program == "liveplot"} { 2549 .a.options.menu add cascade -menu .a.options.menu.gfont \ 2550 -label "Graph font" 2551 menu .a.options.menu.gfont 2552 foreach f {12 14 16 18 20 22 24 26 28 32 36 40} { 2553 .a.options.menu.gfont add radiobutton \ 2554 -command "ResizeGraphFont .g \[list Helvetica -$f\]" \ 2555 -label $f -font "Helvetica -$f" 2556 } 2157 2557 .a.options.menu add checkbutton -label "Raise on update" \ 2158 2558 -variable graph(autoraise) … … 2314 2714 expload $expnam.EXP 2315 2715 mapexp 2316 2716 if {$expgui(autotick)} { 2717 foreach i $::expmap(phaselist) { 2718 set peakinfo(flag$i) 1 2719 } 2720 } 2721 2317 2722 # fill the histogram menu 2318 2723 if {[llength $expmap(powderlist)] > 15} { -
trunk/readexp.tcl
r1033 r1166 9 9 # returns 1 if the file is 80 char/line + cr/lf 10 10 # returns 2 if the file is sequential but not fixed-record length 11 proc expload {expfile} { 12 global exparray tcl_platform 13 # $expfile is the path to the data file. 14 11 proc expload {expfile "ns {}"} { 12 # expfile is the path to the data file. 13 # ns is the namespace to place the output array (default is global) 14 if {$ns != ""} { 15 namespace eval $ns {} 16 } 15 17 if [catch {set fil [open "$expfile" r]}] { 16 18 tk_dialog .expFileErrorMsg "File Open Error" \ … … 27 29 } 28 30 catch { 29 unset exparray31 unset ${ns}::exparray 30 32 } 31 33 if {$len > 160} { … … 39 41 incr i2 80 40 42 set key [string range $nline 0 11] 41 set exparray($key) [string range $nline 12 end]43 set ${ns}::exparray($key) [string range $nline 12 end] 42 44 } 43 45 } else { … … 45 47 while {$len > 0} { 46 48 set key [string range $line 0 11] 47 set exparray($key) [string range $line 12 79]49 set ${ns}::exparray($key) [string range $line 12 79] 48 50 if {$len != 81 || [string range $line end end] != "\r"} {set fmt 2} 49 51 set len [gets $fil line] … … 187 189 } 188 190 } 191 # load the constrained parameters 192 atom_constraint_load 189 193 set expgui(mapstat) 1 190 194 } … … 294 298 set digits 1 295 299 } 300 if {$digits <= 0} {set digits 1} 296 301 if {$digits + $sign >= $length} { 297 302 # the number is much too big -- use exponential notation … … 307 312 set decimal [expr {$length - $digits - $sign - 1}] 308 313 set tmp [format "%#.${decimal}f" $value] 309 } elseif {abs($value) < pow(10,2-$decimal) && $length > 6 } {314 } elseif {abs($value) < pow(10,2-$decimal) && $length > 6 && $value != 0} { 310 315 # for small values, switch to exponential notation (2-$decimal -> three sig figs.) 311 316 set decimal [expr {$length - 6 - $sign}] … … 1388 1393 # absdamp -- damping for absorption refinement (*) 1389 1394 # absref -- refinement damping for absorption refinement (*) 1390 # proftbl -- returns number of profile table termns 1395 # proftbl -- returns number of profile table terms 1396 # anomff -- returns a list of elements, f' and f" 1391 1397 # parameters transferred from the instrument parameter file: 1392 1398 # ITYP -- returns the contents of the ITYP record … … 1977 1983 return $val 1978 1984 } 1985 anomff-get { 1986 set l {} 1987 foreach i {1 2 3 4 5 6 7 8 9} { 1988 if {![existsexp "${key}FFANS$i"]} continue 1989 set line [readexp "${key}FFANS$i"] 1990 set elem [string trim [string range $line 2 9]] 1991 set fp [string trim [string range $line 10 19]] 1992 set fpp [string trim [string range $line 20 29]] 1993 lappend l [list $elem $fp $fpp] 1994 } 1995 return $l 1996 } 1997 anomff-set { 1998 # match up input against elements in list. 1999 # change elements included, return any elements that are 2000 # not found. 2001 set errorlist {} 2002 foreach triplet $value { 2003 foreach {e fp fpp} $triplet {} 2004 foreach i {1 2 3 4 5 6 7 8 9} { 2005 if {![existsexp "${key}FFANS$i"]} continue 2006 # note that the element name is not used or validated 2007 set elem [string trim [string range \ 2008 [readexp "${key}FFANS$i"] 2 9]] 2009 if {[string match -nocase $e $elem]} { 2010 if ![validreal fp 10 3] {return 0} 2011 setexp "${key}FFANS$i" $fp 11 10 2012 if ![validreal fpp 10 3] {return 0} 2013 setexp "${key}FFANS$i" $fpp 21 10 2014 set e {} 2015 break 2016 } 2017 } 2018 if {$e != ""} { 2019 # oops, no match 2020 lappend errorlist $e 2021 } 2022 } 2023 if {$errorlist != ""} {return [list 0 $errorlist]} 2024 } 1979 2025 default { 1980 2026 set msg "Unsupported histinfo access: parm=$parm action=$action" … … 2173 2219 return 1 2174 2220 } 2221 2222 # read fixed constraints 2223 2224 proc atom_constraint_read {phase} { 2225 set fix_list "" 2226 foreach k {1 2 3 4 5 6 7 8 9} { 2227 set key [format "LEQV HOLD%1d%2d" $phase $k] 2228 set line [readexp $key] 2229 foreach j {2 10 18 26 34 42 50 58} { 2230 set fix_param [string range $line $j [expr $j+7]] 2231 if {[string trim $fix_param] == ""} {return $fix_list} 2232 lappend fix_list $fix_param 2233 } 2234 } 2235 } 2236 2237 # load all atom constraints into global array fix_param 2238 proc atom_constraint_load { } { 2239 catch {unset ::fix_param} 2240 foreach i $::expmap(phaselist) { 2241 set temp [atom_constraint_read $i] 2242 foreach j $temp { 2243 set atomnum [string trim [string range $j 2 3]] 2244 set param [string trim [string range $j 4 6]] 2245 set ::fix_param($i,$atomnum,$param) 1 2246 } 2247 } 2248 } 2249 2250 proc atom_constraint_write {phase fix_list} { 2251 foreach key [array names ::exparray "LEQV HOLD$phase*"] { 2252 delexp $key 2253 } 2254 set k 0 2255 set j 1 2256 set line "" 2257 foreach fix $fix_list { 2258 incr k 2259 append line $fix 2260 if {$k == 8} { 2261 set key [format "LEQV HOLD%1d%2d" $phase $j] 2262 makeexprec $key 2263 setexp $key $line 3 [expr ($k * 8) + 2] 2264 set k 0 2265 incr j 2266 set line "" 2267 } 2268 } 2269 if {$line != ""} { 2270 set key [format "LEQV HOLD%1d%2d" $phase $j] 2271 makeexprec $key 2272 setexp $key $line 3 [expr ($k * 8) + 2] 2273 } 2274 } 2275 2175 2276 2176 2277 # get a logical constraint … … 3099 3200 } 3100 3201 } 3101 if {$HST == ""} {return "1"}3102 3202 if {$HST <=9} { 3103 3203 set key "HST $HST" … … 3119 3219 makeexprec $key 3120 3220 } 3121 setexp $key "RSN " [expr 3 + 5*(($HST-1) % 12)] 53221 setexp $key "RSN " [expr 3 + 5*(($HST-1) % 12)] 5 3122 3222 # create other HST xx recs 3123 3223 if {$HST <=9} { … … 3130 3230 makeexprec "$key FACTR" 3131 3231 makeexprec "$key NBNDS" 3232 mapexp 3233 } elseif {$HST == ""} { 3234 if $::expgui(debug) {puts "no restraints"} 3235 return "1" 3132 3236 } 3133 3237 … … 3449 3553 } 3450 3554 } 3555 #============================================================================ 3556 # rigid body EXP editing routines (to move into readexp.tcl) 3557 # RigidBodyList -- returns a list of the defined rigid body types 3558 # SetRigidBodyVar -- set variables and damping for rigid body type multipliers 3559 # ReadRigidBody -- # of times a body is mapped, scaling factors, var #s & coordinates 3560 # RigidBodyMappingList - return a list instances where a RB is mapped in phase 3561 # RigidBodyEnableTLS -- Enable or Disable TLS use for a rigid body mapping 3562 # RigidBodySetTLS -- change the TLS values for a rigid body mapping 3563 # RigidBodySetDamp -- change the damping values for a rigid body mapping 3564 # RigidBodyVary -- set refinement variable numbers for a rigid body mapping 3565 # RigidBodyTLSVary -- set TLS refinement variable nums for a rigid body mapping 3566 # AddRigidBody -- defines a new rigid body type 3567 # DeleteRigidBody -- remove a rigid body definition 3568 # ReplaceRigidBody -- replaces a previous rigid body type 3569 # ReadRigidBodyMapping -- get parameters for a rigid body mapping 3570 # MapRigidBody -- map a rigid body type into a phase 3571 # EditRigidBodyMapping -- change the parameters in a rigid body mapping 3572 # UnMapRigidBody --remove a rigid body constraint by removing a RB "instance" 3573 #----- note that these older routines should not be used ------ 3574 # RigidBodyCount -- returns the number of defined rigid bodies (body types) 3575 # use RigidBodyList instead 3576 # RigidBodyMappingCount -- # of times a rigid body is mapped in phase 3577 # use RigidBodyMappingList instead 3578 #============================================================================ 3579 # returns the number of defined rigid bodies 3580 proc RigidBodyCount {} { 3581 set n [string trim [readexp "RGBD NRBDS"]] 3582 if {$n == ""} { 3583 set n 0 3584 } 3585 return $n 3586 } 3587 3588 # returns a list of the defined rigid body types 3589 proc RigidBodyList {} { 3590 set n [string trim [readexp "RGBD NRBDS"]] 3591 if {$n == ""} { 3592 set n 0 3593 } 3594 set rblist {} 3595 foreach rbnum {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15} { 3596 set value $rbnum 3597 validint value 2 3598 set key "RGBD${value}" 3599 if {[existsexp "$key NATR "]} { 3600 lappend rblist $rbnum 3601 } 3602 if {[llength $rblist] == $n} break 3603 } 3604 return $rblist 3605 } 3606 3607 # ReadRigidBody provides all information associated with a rigid body type 3608 # rbnum is the rigid body type number 3609 # it returns two items: 3610 # the number of times the rigid body is mapped 3611 # a list containing an element for each scaling factor in rigid body #rbnum. 3612 # in each element there are four items: 3613 # a multiplier value for the rigid body coordinates 3614 # a damping value (0-9) for the refinement of the multiplier 3615 # a variable number if the multiplier will be refined 3616 # a list of cartesian coordinates coordinates 3617 # each cartesian coordinate contains 4 items: x,y,z and a label 3618 # note that the label is present only when the RB is created in EXPGUI and is 3619 # not used in GSAS. 3620 proc ReadRigidBody {rbnum} { 3621 if {[lsearch [RigidBodyList] $rbnum] == -1} { 3622 return "" 3623 } 3624 set value $rbnum 3625 validint value 2 3626 set key "RGBD${value}" 3627 set n [string trim [string range [readexp "$key NATR"] 0 4]] 3628 set used [string trim [string range [readexp "$key NBDS"] 0 4]] 3629 set nmult [string trim [string range [readexp "$key NSMP"] 0 4]] 3630 set out {} 3631 for {set i 1} {$i <= $nmult} {incr i} { 3632 set line [readexp "${key}${i}PARM"] 3633 set mult [string trim [string range $line 0 9]] 3634 set var [string trim [string range $line 10 14]] 3635 set damp [string trim [string range $line 15 19]] 3636 set coordlist {} 3637 for {set j 1} {$j <= $n} {incr j} { 3638 set value $j 3639 validint value 3 3640 set line [readexp "${key}${i}SC$value"] 3641 set x [string trim [string range $line 0 9]] 3642 set y [string trim [string range $line 10 19]] 3643 set z [string trim [string range $line 20 29]] 3644 set lbl [string trim [string range $line 30 39]] 3645 lappend coordlist [list $x $y $z $lbl] 3646 } 3647 lappend out [list $mult $damp $var $coordlist] 3648 } 3649 return [list $used $out] 3650 } 3651 3652 # SetRigidBodyVar 3653 # rbnum is the rigid body type number 3654 # varnumlist is a list of variable numbers 3655 # note that if this list is shorter than the number of actual multipliers 3656 # for the body, the unspecified variable will not be changed 3657 # damplist is a list of damping values (0-9) 3658 # note that if the damplist is shorter than the number of actual multipliers 3659 # the unspecified values are not changed 3660 # SetRigidBodVar 2 {1 2 3} {} 3661 # will vary the (first 3) translations in body #3 and will not change the 3662 # damping values 3663 # SetRigidBodVar 3 {} {0 0 0} 3664 # will not change variable settings but will change the (first 3) damping values 3665 # SetRigidBodVar 4 {11 11} {8 8} 3666 # changes both variable numbers and damping at the same time 3667 # Nothing is returned 3668 proc SetRigidBodyVar {rbnum varnumlist damplist} { 3669 if {[lsearch [RigidBodyList] $rbnum] == -1} { 3670 return "" 3671 } 3672 set value $rbnum 3673 validint value 2 3674 set key "RGBD${value}" 3675 set nmult [string trim [string range [readexp "$key NSMP"] 0 4]] 3676 for {set i 1} {$i <= $nmult} {incr i} { 3677 set j $i 3678 incr j -1 3679 set var [lindex $varnumlist $j] 3680 if {$var != ""} { 3681 validint var 5 3682 setexp "${key}${i}PARM" $var 11 15 3683 } 3684 set damp [lindex $damplist $j] 3685 if {$damp != ""} { 3686 if {$damp > 9} {set damp 9} 3687 if {$damp < 0} {set damp 0} 3688 validint damp 5 3689 } 3690 setexp "${key}${i}PARM" $damp 16 20 3691 } 3692 } 3693 3694 3695 # return the number of times rigid body $bodytyp is mapped in phase $phase 3696 proc RigidBodyMappingCount {phase bodytyp} { 3697 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1]" 3698 if {! [existsexp "$key NBDS"]} {return 0} 3699 set n [string trim [readexp "$key NBDS"]] 3700 if {$n == ""} { 3701 set n 0 3702 } 3703 return $n 3704 } 3705 # return a list of the instances where rigid body $bodytyp is mapped in phase $phase 3706 proc RigidBodyMappingList {phase bodytyp} { 3707 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1]" 3708 if {! [existsexp "$key NBDS"]} {return {}} 3709 set n [string trim [readexp "$key NBDS"]] 3710 if {$n == ""} { 3711 set n 0 3712 } 3713 set rblist {} 3714 foreach rbnum {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15} { 3715 set value $rbnum 3716 validint value 2 3717 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1][ToHex $rbnum 1]" 3718 if {[existsexp "$key NDA"]} { 3719 lappend rblist $rbnum 3720 } 3721 if {[llength $rblist] == $n} break 3722 } 3723 return $rblist 3724 } 3725 3726 3727 3728 # reads rigid body mapping parameters for phase ($phase), body type # ($bodytyp) and instance # ($num) 3729 # returns a list of items (most lists) as follows: 3730 # 1) sequence # of first atom in body 3731 # 2) origin of body in fractional coordinates (3 elements) 3732 # 3) Euler angles as 6 pairs of numbers (see below) 3733 # 4) variable numbers for the 9 position variables (origin followed by rotations) 3734 # 5) damping vals for the 9 position variables (origin followed by rotations) 3735 # 6) the TLS values, in order below (empty list if TLS is not in use) 3736 # 7) the variable numbers for each TLS values, in order below (or empty) 3737 # 8) three damping values for the T, L and S terms. 3738 # returns an empty list if no such body exists. 3739 # 3740 # Euler angles are a list of axes and angles to rotate: 3741 # { {axis1 angle1} {axis2 angle2} ...} 3742 # where axis1,... can be 1, 2 or 3 corresponding to the cartesian X, Y or Z axes 3743 # 3744 # The 20 TLS terms are ordered: 3745 # T11, T22, T33, T12, T13, T23 3746 # L11, L22, L33, L12, L13, L23 3747 # S12, S13, S21, S23, S31, S32, SAA, SBB 3748 # 3749 proc ReadRigidBodyMapping {phase bodytyp num} { 3750 if {[lsearch [RigidBodyMappingList $phase $bodytyp] $num] == -1} { 3751 return "" 3752 } 3753 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1][ToHex $num 1]" 3754 set first [string trim [string range [readexp "$key NDA"] 0 4]] 3755 set line [readexp "$key BDFL"] 3756 set varlist {} 3757 set damplist {} 3758 foreach i {0 1 2 3 4 5 6 7 8} { 3759 lappend varlist [string trim [string range $line [expr {5*$i}] [expr {4 + 5*$i}] ]] 3760 lappend damplist [string trim [string range $line [expr {45 + $i}] [expr {45 + $i}] ]] 3761 } 3762 set TLSdamplist {} 3763 foreach i {54 55 56} { 3764 lappend TLSdamplist [string trim [string range $line $i $i ]] 3765 } 3766 set line [readexp "${key} BDLC"] 3767 set x [string trim [string range $line 0 9]] 3768 set y [string trim [string range $line 10 19]] 3769 set z [string trim [string range $line 20 29]] 3770 set origin [list $x $y $z] 3771 set line [readexp "${key} BDOR"] 3772 set rotations {} 3773 foreach i {0 10 20 30 40 50} { 3774 set angle [string trim [string range $line $i [expr {$i+7}]]] 3775 set axis [string trim [string range $line [expr {$i+8}] [expr {$i+9}]]] 3776 lappend rotations [list $angle $axis] 3777 } 3778 set TLS [string trim [string range [readexp "${key} LSTF"] 0 4]] 3779 set tlsvars {} 3780 set tlsvals {} 3781 if {$TLS != 0} { 3782 set line [readexp "${key}TLSF1"] 3783 for {set j 0} {$j < 20} {incr j} { 3784 set var [string trim [string range $line [expr {3*$j}] [expr {3*$j+2}]]] 3785 if {$var == ""} {set var 0} 3786 lappend tlsvars $var 3787 } 3788 for {set j 0} {$j < 20} {incr j} { 3789 set i 0 3790 if {$j == 0} { 3791 set i 1 3792 } elseif {$j == 8} { 3793 set i 2 3794 } elseif {$j == 16} { 3795 set i 3 3796 } 3797 if {$i != 0} { 3798 set line [readexp "${key}TLSP$i"] 3799 set i 0 3800 set j1 0 3801 set j2 7 3802 } else { 3803 incr j1 8 3804 incr j2 8 3805 } 3806 set val [string trim [string range $line $j1 $j2]] 3807 if {$val == ""} {set val 0} 3808 lappend tlsvals $val 3809 } 3810 } 3811 return [list $first $origin $rotations $varlist $damplist $tlsvals $tlsvars $TLSdamplist] 3812 } 3813 3814 # Control TLS representation for phase, body # and instance number of a Rigid body mapping 3815 # for mapping with phase ($phase), body type # ($bodytyp) and instance # ($num) 3816 # Enable TLS use if TLS is non-zero (true). Disable if zero 3817 proc RigidBodyEnableTLS {phase bodytyp num TLS} { 3818 if {[lsearch [RigidBodyMappingList $phase $bodytyp] $num] == -1} { 3819 return "" 3820 } 3821 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1][ToHex $num 1]" 3822 if {$TLS} { 3823 setexp "${key} LSTF" [format "%5d" 1] 1 5 3824 if {![existsexp "${key}TLSF1"]} {makeexprec "${key}TLSF1"} 3825 if {![existsexp "${key}TLSP1"]} { 3826 makeexprec "${key}TLSP1" 3827 set str {} 3828 foreach v {.01 .01 .01 0 0 0 0 0} d {4 4 4 4 4 4 2 2} { 3829 validreal v 8 $d 3830 append str $v 3831 } 3832 setexp "${key}TLSP1" $str 1 64 3833 } 3834 if {![existsexp "${key}TLSP2"]} { 3835 makeexprec "${key}TLSP2" 3836 set str {} 3837 set v 0 3838 foreach d {2 2 2 2 4 4 4 4} { 3839 validreal v 8 $d 3840 append str $v 3841 } 3842 setexp "${key}TLSP2" $str 1 64 3843 } 3844 if {![existsexp "${key}TLSP3"]} { 3845 makeexprec "${key}TLSP3" 3846 set str {} 3847 set v 0 3848 foreach d {4 4 4 4} { 3849 validreal v 8 $d 3850 append str $v 3851 } 3852 setexp "${key}TLSP3" $str 1 64 3853 } 3854 } else { 3855 setexp "${key} LSTF" [format "%5d" 0] 1 5 3856 } 3857 return 1 3858 } 3859 3860 # Control the TLS values for Rigid body mapping for mapping with 3861 # phase ($phase), body type # ($bodytyp) and instance # ($num) 3862 # set the 20 TLS values to the values in TLSvals 3863 # There must be exactly 20 TLS terms, which are ordered: 3864 # T11, T22, T33, T12, T13, T23 3865 # L11, L22, L33, L12, L13, L23 3866 # S12, S13, S21, S23, S31, S32, SAA, SBB 3867 proc RigidBodySetTLS {phase bodytyp num TLSvals} { 3868 if {[lsearch [RigidBodyMappingList $phase $bodytyp] $num] == -1} { 3869 return "" 3870 } 3871 if {[llength $TLSvals] != 20} {return ""} 3872 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1][ToHex $num 1]" 3873 set TLS [string trim [string range [readexp "${key} LSTF"] 0 4]] 3874 if {$TLS == 0} {return ""} 3875 if {![existsexp "${key}TLSF1"]} {makeexprec "${key}TLSF1"} 3876 foreach n {1 2 3} { 3877 if {![existsexp "${key}TLSP$n"]} {makeexprec "${key}TLSP$n"} 3878 } 3879 set str {} 3880 set n 1 3881 set i 0 3882 foreach v $TLSvals d {4 4 4 4 4 4 2 2 2 2 2 2 4 4 4 4 4 4 4 4} { 3883 incr i 3884 validreal v 8 $d 3885 append str $v 3886 if {$i == 8} { 3887 set i 0 3888 setexp "${key}TLSP$n" $str 1 64 3889 incr n 3890 set str {} 3891 } 3892 } 3893 setexp "${key}TLSP$n" $str 1 64 3894 return 1 3895 } 3896 3897 # set damping values for a Rigid body mapping 3898 # for mapping with phase ($phase), body type # ($bodytyp) and instance # ($num) 3899 # there must be 9 damping values in RBdamp for the 9 position variables (origin followed by rotations) 3900 # Use of TLSdamp is optional, but to be used, TLS representation must be enabled and there must be 3901 # three damping terms (for all T terms; for all L terms and for all S terms) 3902 proc RigidBodySetDamp {phase bodytyp num RBdamp "TLSdamp {}"} { 3903 if {[lsearch [RigidBodyMappingList $phase $bodytyp] $num] == -1} { 3904 return "" 3905 } 3906 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1][ToHex $num 1]" 3907 if {[llength $RBdamp] != 9} {return ""} 3908 set str {} 3909 foreach v $RBdamp { 3910 if {[validint v 1] != 1} {set v " "} 3911 append str $v 3912 } 3913 setexp "$key BDFL" $str 46 9 3914 set TLS [string trim [string range [readexp "${key} LSTF"] 0 4]] 3915 if {$TLS != 0 && [llength $TLSdamp] == 3} { 3916 set str {} 3917 foreach v $TLSdamp { 3918 if {[validint v 1] != 1} {set v " "} 3919 append str $v 3920 } 3921 setexp "$key BDFL" $str 55 3 3922 } 3923 return 1 3924 } 3925 3926 # set refinement variable numbers for a Rigid body mapping 3927 # for mapping with phase ($phase), body type # ($bodytyp) and instance # ($num) 3928 # there must be 9 variable values in RBvar for the 9 position variables (origin followed by rotations) 3929 # note that the variable values should be unique integers 3930 proc RigidBodyVary {phase bodytyp num RBvar} { 3931 if {[lsearch [RigidBodyMappingList $phase $bodytyp] $num] == -1} { 3932 return "" 3933 } 3934 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1][ToHex $num 1]" 3935 if {[llength $RBvar] != 9} {return ""} 3936 set str {} 3937 foreach v $RBvar { 3938 if {[validint v 5] != 1} {set v " "} 3939 append str $v 3940 } 3941 setexp "$key BDFL" $str 1 45 3942 } 3943 3944 # set TLS refinement variable numbers for a Rigid body mapping 3945 # for mapping with phase ($phase), body type # ($bodytyp) and instance # ($num) 3946 # there must be 20 variable values in TLSvar for the 20 parameters: 3947 # T11, T22, T33, T12, T13, T23 3948 # L11, L22, L33, L12, L13, L23 3949 # S12, S13, S21, S23, S31, S32, SAA, SBB 3950 # note that the variable values should be unique integers 3951 proc RigidBodyTLSVary {phase bodytyp num TLSvar} { 3952 if {[lsearch [RigidBodyMappingList $phase $bodytyp] $num] == -1} { 3953 return "" 3954 } 3955 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1][ToHex $num 1]" 3956 if {[llength $TLSvar] != 20} {return ""} 3957 set TLS [string trim [string range [readexp "${key} LSTF"] 0 4]] 3958 if {$TLS == 0} {return ""} 3959 set str {} 3960 foreach v $TLSvar { 3961 if {[validint v 3] != 1} {set v " "} 3962 append str $v 3963 } 3964 setexp "${key}TLSF1" $str 1 60 3965 3966 # AddRigidBody: add a new rigid body definition into the .EXP file 3967 # arguments are: 3968 # multlist: defines a list of multipliers for each set of coordinates. In the 3969 # simplest case this will be {1} 3970 # coordlist: a nested list of coordinates such as { { {0 0 0} {.1 .1 .1} {.2 .2 .2} } } 3971 # note that when the length of multlist > 1 then coordlist must have the same length. 3972 # for input where 3973 # multlist = {s1 s2} and 3974 # coordlist = { { {0 0 0} {1 1 0} {.0 .0 .0} ...} 3975 # {0 0 0} {1 1 0} {2 1 2} ...} 3976 # } 3977 # the cartesian coordinates are defined from the input as 3978 # atom 1 = s1 * (0,0,0) + s2*(0,0,0) [ = (0,0,0)] 3979 # atom 2 = s1 * (1,1,0) + s2*(1,1,0) [ = (s1+s2) * (1,1,0)] 3980 # atom 3 = s1 * (0,0,0) + s2*(2,1,2) [ = s2 * (2,1,2)] 3981 # ... 3982 # Returns the number of the rigid body that has been created 3983 proc AddRigidBody {multlist coordlist} { 3984 # find the first unused body # 3985 foreach rbnum {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} { 3986 set value $rbnum 3987 validint value 2 3988 set key "RGBD${value}" 3989 if {! [existsexp "$key NATR "]} {break} 3990 } 3991 # did we go too far? 3992 if {$rbnum == 16} {return ""} 3993 # increment the RB counter 3994 set n [string trim [readexp "RGBD NRBDS"]] 3995 if {$n == ""} { 3996 makeexprec "RGBD NRBDS" 3997 set n 0 3998 } 3999 incr n 4000 validint n 5 4001 setexp "RGBD NRBDS" $n 1 5 4002 SetRigidBody $rbnum $multlist $coordlist 4003 return $rbnum 4004 } 4005 4006 # DeleteRigidBody: remove a rigid body definition from the .EXP file 4007 # The body may not be mapped. I am not sure if GSAS allows more than 9 bodies, 4008 # but if it does, the simplifed approach used here will fail, so this 4009 # is not allowed. 4010 # Input: 4011 # Rigid body number 4012 # Returns: 4013 # 1 on success 4014 # -1 if the body number is 11 or greater 4015 # -2 if the body is mapped 4016 # -3 if the body is not defined 4017 proc DeleteRigidBody {rbnum} { 4018 # can't delete bodies with numbers higher than 10, since the key prefix 4019 # (RGBD11... will overlap with rigid body instance records, which would be 4020 # deleted below 4021 if {$rbnum > 10} { 4022 return -1 4023 } 4024 set value $rbnum 4025 validint value 2 4026 set key "RGBD${value}" 4027 if {![existsexp "$key NATR "]} { 4028 return -2 4029 } 4030 # make sure the body is not mapped 4031 if {[string trim [string range [readexp "$key NBDS"] 0 4]] != 0} { 4032 return -3 4033 } 4034 # delete the records starting with "RGBD x" or "RGBD10" 4035 foreach key [array names ::exparray "${key}*"] { 4036 #puts $key 4037 delexp $key 4038 } 4039 # decrement the RB counter 4040 set n [string trim [readexp "RGBD NRBDS"]] 4041 if {$n == ""} { 4042 set n 0 4043 } 4044 incr n -1 4045 validint n 5 4046 if {$n > 0} { 4047 setexp "RGBD NRBDS" $n 1 5 4048 } else { 4049 delexp "RGBD NRBDS" 4050 } 4051 return 1 4052 } 4053 4054 # ReplaceRigidBody: replace all the information for rigid body #rbnum 4055 # Works the sames as AddRigidBody (see above) except that the rigid body is replaced rather 4056 # than added. 4057 # Note that count of the # of times the body is used is preserved 4058 proc ReplaceRigidBody {rbnum multlist coordlist {varlist ""} {damplist ""}} { 4059 set value $rbnum 4060 validint value 2 4061 set key "RGBD${value}" 4062 set line [readexp "$key NBDS"] 4063 foreach key [array names ::exparray "${key}*"] { 4064 #puts $key 4065 delexp $key 4066 } 4067 SetRigidBody $rbnum $multlist $coordlist $varlist $damplist 4068 setexp "$key NBDS" $line 1 68 4069 } 4070 4071 # Edit the parameters for rigid body #rbnum 4072 # (normally called from ReplaceRigidBody or AddRigidBody) 4073 proc SetRigidBody {rbnum multlist coordlist {varlist ""} {damplist ""}} { 4074 set value $rbnum 4075 validint value 2 4076 set key "RGBD${value}" 4077 # number of atoms 4078 set value [llength [lindex $coordlist 0]] 4079 validint value 5 4080 makeexprec "$key NATR" 4081 setexp "$key NATR" $value 1 5 4082 # number of times used 4083 set value 0 4084 validint value 5 4085 makeexprec "$key NBDS" 4086 setexp "$key NBDS" $value 1 5 4087 # number of coordinate matrices 4088 set value [llength $multlist] 4089 validint value 5 4090 makeexprec "$key NSMP" 4091 setexp "$key NSMP" $value 1 5 4092 set i 0 4093 foreach mult $multlist coords $coordlist { 4094 set var [lindex $varlist $i] 4095 if {$var == ""} {set var 0} 4096 set damp [lindex $damplist $i] 4097 if {$damp == ""} {set damp 0} 4098 incr i 4099 makeexprec "${key}${i}PARM" 4100 setexp "${key}${i}PARM" [format "%10.5f%5d%5d" $mult $var $damp] 1 20 4101 set j 0 4102 foreach item $coords { 4103 #puts $item 4104 incr j 4105 set value $j 4106 validint value 3 4107 makeexprec "${key}${i}SC$value" 4108 if {[llength $item] == 4} { 4109 setexp "${key}${i}SC$value" [eval format "%10.6f%10.6f%10.6f%10s" $item] 1 40 4110 } elseif {[llength $item] == 3} { 4111 setexp "${key}${i}SC$value" [eval format "%10.6f%10.6f%10.6f" $item] 1 30 4112 } else { 4113 return -code 3 "Invalid number of coordinates" 4114 } 4115 } 4116 } 4117 } 4118 4119 # convert a decimal to the GSAS hex encoding with a field $digits long. 4120 proc ToHex {num digits} { 4121 return [string toupper [format "%${digits}x" $num]] 4122 } 4123 4124 # convert a GSAS hex encoding to a decimal integer 4125 proc FromHex {hex} { 4126 return [scan $hex "%x"] 4127 } 4128 4129 # MapRigidBody: define an "instance" of a rigid body: meaning that the coordinates 4130 # (and optionally U values) for a set of atoms will be generated from the rigid body 4131 # arguments: 4132 # phase: phase number (1-9) 4133 # bodytyp: number of rigid body (1-15) as returned from AddRigidBody 4134 # firstatom: sequence number of the first atom in phase (note that atoms may 4135 # not be numbered sequentially) 4136 # position: list of three fractional coordinates for the origin of the rigid body coordinates 4137 # angles: list of 3 angles to rotate the rigid body coordinates around x, y, z of the 4138 # cartesian system before the body is translated to position. 4139 # returns the instance # (number of times body $bodytyp has been used in phase $phase) 4140 proc MapRigidBody {phase bodytyp firstatom position angles} { 4141 # find the first unused body # for this phase & type 4142 foreach rbnum {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} { 4143 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1][ToHex $rbnum 1]" 4144 if {! [existsexp "$key NDA"]} {break} 4145 } 4146 # did we go too far? 4147 if {$rbnum == 16} {return ""} 4148 # increment number of mapped bodies of this type overall 4149 set value $bodytyp 4150 validint value 2 4151 set key "RGBD${value}" 4152 set used [string trim [string range [readexp "$key NBDS"] 0 4]] 4153 incr used 4154 set value $used 4155 validint value 5 4156 setexp "$key NBDS" $value 1 5 4157 # increment number of mapped bodies of this type in this phase 4158 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1]" 4159 if {[existsexp "$key NBDS"]} { 4160 set used [string trim [string range [readexp "$key NBDS"] 0 4]] 4161 } else { 4162 makeexprec "$key NBDS" 4163 set used 0 4164 } 4165 incr used 4166 set value $used 4167 validint value 5 4168 setexp "$key NBDS" $value 1 5 4169 # now write the mapping parameters 4170 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1][ToHex $rbnum 1]" 4171 set value $firstatom 4172 validint value 5 4173 makeexprec "$key NDA" 4174 setexp "$key NDA" $value 1 5 4175 set l1 {} 4176 set l2 {} 4177 for {set i 0} {$i < 9} {incr i} { 4178 append l1 [format %5d 0] 4179 append l2 [format %1d 0] 4180 } 4181 makeexprec "$key BDFL" 4182 setexp "$key BDFL" $l1$l2 1 54 4183 makeexprec "${key} BDLC" 4184 setexp "${key} BDLC" [eval format "%10.6f%10.6f%10.6f" $position] 1 30 4185 makeexprec "${key} BDOR" 4186 set l1 {} 4187 foreach val "$angles 0 0 0" dir "1 2 3 1 1 1" { 4188 append l1 [format "%8.2f%2d" $val $dir] 4189 } 4190 setexp "${key} BDOR" $l1 1 60 4191 makeexprec "${key} LSTF" 4192 setexp "${key} LSTF" [format "%5d" 0] 1 5 4193 return $rbnum 4194 } 4195 4196 # EditRigidBodyMapping: edit parameters that define an "instance" of a rigid body (see MapRigidBody) 4197 # arguments: 4198 # phase: phase number (1-9) 4199 # bodytyp: number of rigid body (1-15) as returned from AddRigidBody 4200 # bodynum: instance number, as returned by MapRigidBody 4201 # position: list of three fractional coordinates for the origin of the rigid body coordinates 4202 # angles: list of 3 angles to rotate the rigid body coordinates around x, y, z of the 4203 # cartesian system before the body is translated to position. 4204 # 4205 proc EditRigidBodyMapping {phase bodytyp bodynum position angles} { 4206 # number of bodies of this type in this phase 4207 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1][ToHex $bodynum 1]" 4208 setexp "${key} BDLC" [eval format "%10.6f%10.6f%10.6f" $position] 1 30 4209 set l1 {} 4210 foreach val "$angles 0 0 0" dir "1 2 3 1 1 1" { 4211 append l1 [format "%8.2f%2d" $val $dir] 4212 } 4213 setexp "${key} BDOR" $l1 1 60 4214 } 4215 4216 # UnMapRigidBody: remove a rigid body constraint by removing a RB "instance" 4217 # (undoes MapRigidBody) 4218 # arguments: 4219 # phase: phase number (1-9) 4220 # bodytyp: number of rigid body (1-15) as returned from AddRigidBody 4221 # bodynum: instance number, as returned by MapRigidBody 4222 proc UnMapRigidBody {phase bodytyp mapnum} { 4223 if {[lsearch [RigidBodyMappingList $phase $bodytyp] $mapnum] == -1} { 4224 return "" 4225 } 4226 # decrement number of mapped bodies of this type overall 4227 set value $bodytyp 4228 validint value 2 4229 set key "RGBD${value}" 4230 set used [string trim [string range [readexp "$key NBDS"] 0 4]] 4231 incr used -1 4232 set value $used 4233 validint value 5 4234 setexp "$key NBDS" $value 1 5 4235 # decrement number of mapped bodies of this type in this phase 4236 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1]" 4237 if {[existsexp "$key NBDS"]} { 4238 set used [string trim [string range [readexp "$key NBDS"] 0 4]] 4239 } else { 4240 set used 0 4241 } 4242 incr used -1 4243 set value $used 4244 validint value 5 4245 if {$used > 0} { 4246 setexp "$key NBDS" $value 1 5 4247 } else { 4248 delexp "$key NBDS" 4249 } 4250 # now delete the mapping parameter records 4251 set key "RGBD[ToHex $phase 1][ToHex $bodytyp 1][ToHex $mapnum 1]" 4252 foreach key [array names ::exparray "${key}*"] { 4253 delexp $key 4254 } 4255 return $used 4256 } 4257 -
trunk/widplt
r1028 r1166 11 11 package require Tk 12 12 bind all <Control-KeyPress-c> {destroy .} 13 13 14 set expnam [lindex $argv 0] 14 15 if {$expnam != ""} { … … 442 443 global UVWP XY wave lblarr WidSetList WidDisplay ttrange 443 444 global ABS absSetList AbsDisplay 445 if {$program == "absplt"} { 446 $top yaxis config -title {Abs. Corr.} 447 } else { 448 $top yaxis config -title {FWHM} 449 } 444 450 if {$graph(plotunits) == "d"} { 445 451 $top xaxis configure -title "d (A)" 452 } elseif {$graph(plotunits) == "deltad"} { 453 $top xaxis configure -title "d (A)" 454 $top yaxis configure -title "delta-d/d" 446 455 } elseif {$graph(plotunits) == "q"} { 447 456 $top xaxis configure -title "Q (A-1)" … … 450 459 } else { 451 460 $top xaxis configure -title "2Theta @ $graph(equivwave)" 452 }453 if {$program == "absplt"} {454 $top yaxis config -title {Abs. Corr.}455 } else {456 $top yaxis config -title {FWHM}457 461 } 458 462 $top yaxis configure -min 0 … … 492 496 if {$graph(plotunits) == "d"} { 493 497 set ttlist [tod $ttlist $item] 498 } elseif {$graph(plotunits) == "deltad"} { 499 set ttlist [tod $ttlist $item] 494 500 } elseif {$graph(plotunits) == "q"} { 495 501 set ttlist [toQ $ttlist $item] … … 530 536 [eval LFWHM $tt $XY($item)]] 531 537 lappend lfwhmlist $lfwhm 538 } 539 } elseif {$graph(plotunits) == "deltad"} { 540 set d [tt2d $wave($item) $tt ] 541 lappend ttlist $d 542 set gfwhm [deltad $wave($item) $tt \ 543 [eval FWHM $tt $UVWP($item)]] 544 lappend fwhmlist [expr {$gfwhm/$d}] 545 if $lflag { 546 set lfwhm [deltad $wave($item) $tt \ 547 [eval LFWHM $tt $XY($item)]] 548 lappend lfwhmlist [expr {$lfwhm/$d}] 532 549 } 533 550 } elseif {$graph(plotunits) == "q"} { … … 982 999 } 983 1000 1001 proc BLTmanualZoom {} { 1002 global graph box 1003 catch {toplevel .zoom} 1004 eval destroy [grid slaves .zoom] 1005 raise .zoom 1006 wm title .zoom {Manual Scaling} 1007 grid [label .zoom.l1 -text minimum] -row 1 -column 2 1008 grid [label .zoom.l2 -text maximum] -row 1 -column 3 1009 grid [label .zoom.l3 -text x] -row 2 -column 1 1010 grid [label .zoom.l4 -text y] -row 3 -column 1 1011 grid [entry .zoom.xmin -textvariable graph(xmin) -width 10] -row 2 -column 2 1012 grid [entry .zoom.xmax -textvariable graph(xmax) -width 10] -row 2 -column 3 1013 grid [entry .zoom.ymin -textvariable graph(ymin) -width 10] -row 3 -column 2 1014 grid [entry .zoom.ymax -textvariable graph(ymax) -width 10] -row 3 -column 3 1015 grid [frame .zoom.b] -row 4 -column 1 -columnspan 3 1016 grid [button .zoom.b.1 -text "Set Scaling" \ 1017 -command "SetManualZoom set"] -row 4 -column 1 -columnspan 2 1018 grid [button .zoom.b.2 -text Reset \ 1019 -command "SetManualZoom clear"] -row 4 -column 3 1020 grid [button .zoom.b.3 -text Close -command "destroy .zoom"] -row 4 -column 4 1021 grid rowconfigure .zoom 1 -weight 1 -pad 5 1022 grid rowconfigure .zoom 2 -weight 1 -pad 5 1023 grid rowconfigure .zoom 3 -weight 1 -pad 5 1024 grid rowconfigure .zoom 4 -weight 0 -pad 5 1025 grid columnconfigure .zoom 1 -weight 1 -pad 20 1026 grid columnconfigure .zoom 1 -weight 1 1027 grid columnconfigure .zoom 3 -weight 1 -pad 10 1028 foreach item {min min max max} \ 1029 format {3 2 3 2} \ 1030 axis {x y x y} { 1031 set val [$box ${axis}axis cget -${item}] 1032 set graph(${axis}${item}) {(auto)} 1033 catch {set graph(${axis}${item}) [format %.${format}f $val]} 1034 } 1035 bind .zoom <Return> "SetManualZoom set" 1036 } 1037 1038 proc SetManualZoom {mode} { 1039 global graph box 1040 if {$mode == "clear"} { 1041 foreach item {xmin ymin xmax ymax} { 1042 set graph($item) {(auto)} 1043 } 1044 } 1045 foreach item {xmin ymin xmax ymax} { 1046 if {[catch {expr $graph($item)}]} { 1047 set $item "" 1048 } else { 1049 set $item $graph($item) 1050 } 1051 } 1052 # reset the zoomstack 1053 catch {Blt_ZoomStack $box} 1054 catch {$box xaxis config -min $xmin -max $xmax} 1055 catch {$box yaxis config -min $ymin -max $ymax} 1056 #global program 1057 #if {$program == "bkgedit"} {bkgEditMode ""} 1058 } 1059 984 1060 #------------------------------------------------------------------------- 985 1061 # export current plot to Grace … … 1242 1318 -variable graph(plotunits) \ 1243 1319 -command "plotdata $box" 1320 .a.options.menu add radiobutton -label "delta-d/d" -value deltad \ 1321 -variable graph(plotunits) \ 1322 -command "plotdata $box" 1244 1323 .a.options.menu add checkbutton -label "Include legend" \ 1245 1324 -variable graph(legend) \ … … 1274 1353 #---------------------------------------------------------------- 1275 1354 1276 trace variable newmenu(opt) w setoptmsg 1355 trace variable newmenu(opt) w setoptmsg 1356 1357 bind . <Key-z> {BLTmanualZoom} 1358 bind . <Key-Z> {BLTmanualZoom} 1277 1359 1278 1360 proc setoptmsg {args} {
Note: See TracChangeset
for help on using the changeset viewer.