Changeset 252
- Timestamp:
- Dec 4, 2009 5:02:56 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/readexp.tcl
- Property rcs:date changed from 2000/07/20 22:09:56 to 2000/08/04 18:19:37
- Property rcs:lines changed from +344 -5 to +139 -23
- Property rcs:rev changed from 1.17 to 1.18
r236 r252 122 122 if {$line == ""} { 123 123 set msg "No HTYP$n entry for Histogram $ihist. This is an invalid .EXP file" 124 tk_dialog .badexp "Error in EXP" $msg error 0 Exit 125 destroy . 124 tk_dialog .badexp "Error in readexp" $msg error 0 Exit 126 125 } 127 126 set j 0 … … 148 147 if {$line == ""} { 149 148 set msg "No NPHAS entry for Histogram $ihist. This is an invalid .EXP file" 150 tk_dialog .badexp "Error in EXP" $msg error 0 Exit 151 destroy . 149 tk_dialog .badexp "Error in readexp" $msg error 0 Exit 152 150 } 153 151 set expmap(phaselist_$ihist) {} … … 321 319 default { 322 320 set msg "Unsupported expinfo access: parm=$parm action=$action" 323 tk_dialog .badexp "Error in EXP" $msg error 0 Exit 324 destroy . 321 tk_dialog .badexp "Error in readexp" $msg error 0 Exit 325 322 } 326 323 } … … 382 379 # parm: 383 380 # name -- phase name 384 # natoms -- number of atoms 381 # natoms -- number of atoms (*) 385 382 # a b c alpha beta gamma -- cell parameters (*) 386 383 # cellref -- refinement flag for the unit cell(*) 387 384 # celldamp -- damping for the unit cell refinement (*) 388 # spacegroup -- space group symbol 385 # spacegroup -- space group symbol (*) 389 386 # ODForder -- spherical harmonic order (*) 390 387 # ODFsym -- sample symmetry (0-3) (*) … … 410 407 } 411 408 409 name-set { 410 setexp "CRS$phase PNAM" " $value" 2 68 411 } 412 412 413 spacegroup-get { 413 414 return [string trim [readexp "CRS$phase SG SYM"]] 414 415 } 415 416 416 name-set {417 setexp "CRS$phase PNAM" " $value" 2 68417 spacegroup-set { 418 setexp "CRS$phase SG SYM" " $value" 2 68 418 419 } 419 420 420 421 natoms-get { 421 422 return [string trim [readexp "CRS$phase NATOM"]] 423 } 424 425 natoms-set { 426 if ![validint value 5] {return 0} 427 setexp "CRS$phase NATOM" $value 1 5 422 428 } 423 429 … … 687 693 default { 688 694 set msg "Unsupported phaseinfo access: parm=$parm action=$action" 689 tk_dialog .badexp "Error in EXP" $msg error 0 Exit 690 # destroy . 695 tk_dialog .badexp "Error in readexp" $msg error 0 Exit 691 696 } 692 697 } … … 751 756 return [string trim [string range [readexp ${key}B] 62 62] ] 752 757 } 758 temptype-set { 759 if {$value == "A"} { 760 setexp ${key}B A 63 1 761 # copy the Uiso to the diagonal terms 762 set value [string range [readexp ${key}B] 0 9] 763 setexp ${key}B $value 11 10 764 setexp ${key}B $value 21 10 765 set value 0.0 766 validreal value 10 6 767 setexp ${key}B $value 31 10 768 setexp ${key}B $value 41 10 769 setexp ${key}B $value 51 10 770 } else { 771 setexp ${key}B I 63 1 772 set value 0.0 773 catch { 774 # get the trace 775 set value [expr ( \ 776 [string range [readexp ${key}B] 0 9] + \ 777 [string range [readexp ${key}B] 10 19] + \ 778 [string range [readexp ${key}B] 20 29])/3.] 779 } 780 validreal value 10 6 781 setexp ${key}B $value 1 10 782 # blank out the remaining terms 783 set value " " 784 setexp ${key}B $value 11 10 785 setexp ${key}B $value 21 10 786 setexp ${key}B $value 31 10 787 setexp ${key}B $value 41 10 788 setexp ${key}B $value 51 10 789 } 790 } 753 791 x-get { 754 792 return [string trim [string range [readexp ${key}A] 10 19] ] … … 878 916 default { 879 917 set msg "Unsupported atominfo access: parm=$parm action=$action" 880 tk_dialog .badexp "Error in EXP" $msg error 0 Exit 881 destroy . 918 tk_dialog .badexp "Error in readexp" $msg error 0 Exit 882 919 } 883 920 } … … 1222 1259 default { 1223 1260 set msg "Unsupported histinfo access: parm=$parm action=$action" 1224 tk_dialog .badexp "Error in EXP" $msg error 0 Exit 1225 destroy . 1261 tk_dialog .badexp "Error in readexp" $msg error 0 Exit 1226 1262 } 1227 1263 } … … 1375 1411 default { 1376 1412 set msg "Unsupported hapinfo access: parm=$parm action=$action" 1377 tk_dialog .badexp "Error in EXP" $msg error 0 Exit 1378 destroy . 1413 tk_dialog .badexp "Error in readexp" $msg error 0 Exit 1379 1414 } 1380 1415 } … … 1763 1798 default { 1764 1799 set msg "Unsupported constrinfo access: type=$type action=$action" 1765 tk_dialog .badexp "Error in EXPaccess" $msg error 0 OK1800 tk_dialog .badexp "Error in readexp access" $msg error 0 OK 1766 1801 } 1767 1802 … … 1947 1982 default { 1948 1983 set msg "Unsupported MDprefinfo access: parm=$parm action=$action" 1949 tk_dialog .badexp "Error in EXP" $msg error 0 Exit 1950 destroy . 1984 tk_dialog .badexp "Error in readexp" $msg error 0 Exit 1951 1985 } 1952 1986 … … 2005 2039 return [llength [array names exparray { HSTRY*}]] 2006 2040 } 2041 2042 # set the phase flags for histogram $hist to $plist 2043 proc SetPhaseFlag {hist plist} { 2044 # make a 2 digit key -- hh 2045 if {$hist < 10} { 2046 set hh " $hist" 2047 } else { 2048 set hh $hist 2049 } 2050 set key "HST $hh NPHAS" 2051 set str {} 2052 foreach iph {1 2 3 4 5 6 7 8 9} { 2053 if {[lsearch $plist $iph] != -1} { 2054 append str { 1} 2055 } else { 2056 append str { 0} 2057 } 2058 } 2059 setexp $key $str 1 68 2060 } 2061 2062 # erase atom $atom from phase $phase 2063 # update the list of atom types, erasing the record if not needed. 2064 proc EraseAtom {atom phase} { 2065 set type [atominfo $phase $atom type] 2066 if {$type == ""} return 2067 if {$atom < 10} { 2068 set key "CRS$phase AT $atom" 2069 } elseif {$atom < 100} { 2070 set key "CRS$phase AT $atom" 2071 } else { 2072 set key "CRS$phase AT$atom" 2073 } 2074 # delete the records for the atom 2075 global exparray 2076 foreach k [array names exparray ${key}*] { 2077 delexp $k 2078 } 2079 # change the number of atoms in the phase 2080 phaseinfo $phase natoms set [expr [phaseinfo $phase natoms] -1] 2081 2082 # now adjust numbers in "EXPR ATYP" records and delete, if needed. 2083 set natypes [readexp " EXPR NATYP"] 2084 if {$natypes == ""} return 2085 set j 0 2086 for {set i 1} {$i <= $natypes} {incr i} { 2087 incr j 2088 if {$j <10} { 2089 set key " EXPR ATYP $j" 2090 } else { 2091 set key " EXPR ATYP$j" 2092 } 2093 while {![existsexp $key]} { 2094 incr j 2095 if {$j > 99} { 2096 return 2097 } elseif {$j <10} { 2098 set key " EXPR ATYP $j" 2099 } else { 2100 set key " EXPR ATYP$j" 2101 } 2102 } 2103 set keytype [string trim [string range $exparray($key) 2 9]] 2104 if {$type == $keytype} { 2105 # found the type record 2106 set val [string trim [string range $exparray($key) 10 14]] 2107 incr val -1 2108 # if this is the last reference, remove the record, 2109 # otherwise, decrement the counter 2110 if {$val <= 0} { 2111 incr natypes -1 2112 validint natypes 5 2113 setexp " EXPR NATYP" $natypes 1 5 2114 delexp $key 2115 } else { 2116 validint val 5 2117 setexp $key $val 11 5 2118 } 2119 return 2120 } 2121 } 2122 }
Note: See TracChangeset
for help on using the changeset viewer.