- Timestamp:
- Mar 2, 2011 9:29:09 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/addcmds.tcl
r1025 r1116 197 197 # validate the input 198 198 set err {} 199 set warn {} 199 200 set title [$np.t1 get] 200 201 if {[string trim $title] == ""} { … … 231 232 append spg " R" 232 233 if {$err == ""} { 233 # no need to warn on error 234 MyMessageBox -parent $np -title "Space Group Fix" \ 235 -message "Adding a final 'R' to the space group for rhombohedral space group set in rhombohedral cell, as required in GSAS" \ 236 -icon warning 234 append warn "Note that a rhombohedral setting was used, the space group symbol ($spg) as been flagged accordingly\n" 237 235 } 238 236 } … … 315 313 } 316 314 # now select the new phase 317 SelectOnePhase [lindex $expmap(phaselist) end] 315 set phase [lindex $expmap(phaselist) end] 316 SelectOnePhase $phase 317 SpaceGroupWarnings $warn $phase $spg 318 318 } 319 319 … … 379 379 } 380 380 } 381 set newhist(LimitMode) 1 381 382 trace variable newhist(setnum) w LabelInstParm 382 383 trace variable newhist(LimitMode) w ClearHistLimit … … 415 416 -column 0 -row 0 -sticky ew -columnspan 7 416 417 grid [checkbutton $np.d0 -text "Dummy Histogram" -variable newhist(dummy) \ 417 -command "Post DummyOpts $np" \418 -command "PostInstBankopts $np" \ 418 419 ] -column 2 -row 0 -columnspan 99 -sticky e 419 420 grid [label $np.l1 -text "Data file:"] -column 0 -row 2 … … 510 511 } 511 512 512 Post DummyOpts $np513 PostInstBankopts $np 513 514 # set grab, etc. 514 515 putontop $np … … 676 677 incr row 677 678 } 678 grid [radiobutton $np.bank.$i -text $i -command Set Tmax\679 grid [radiobutton $np.bank.$i -text $i -command SetDefaultBank \ 679 680 -variable newhist(banknum) -value $i] \ 680 681 -column [incr col] -row $row -sticky w 681 # only 1 choice, so set it 682 if {[llength $newhist(banklist)] == 1} { 683 set newhist(banknum) $i 684 SetTmax685 } else {686 set flag 1 687 }682 } 683 # if only 1 choice, set it 684 if {[llength $newhist(banklist)] == 1} { 685 set newhist(banknum) $i 686 SetDefaultBank 687 } else { 688 set flag 1 688 689 } 689 690 if {$flag} { 690 691 set newhist(2tLimit) {} 691 set newhist(LimitMode) {}692 692 } 693 693 SetMultipleAdd $np 694 694 } 695 695 696 proc SetDefaultBank {} { 697 # set the default instrument parameter set to follow the bank # when the 698 # numbers of banks in each place agree. Do this when the data bank # is set 699 global newhist 700 if {[llength $newhist(banklist)] == $newhist(instbanks)} { 701 set newhist(setnum) $newhist(banknum) 702 } 703 SetTmax 704 } 705 696 706 proc SetTmax {} { 707 # set the default data range when the data or instrument parameter set is changed 697 708 global newhist 709 # mode must be t-max or 2theta, at least for now 710 if {$newhist(LimitMode) != 1} return 711 # is a instrument parameter file loaded? If not, try again later 712 if {[string trim $newhist(instfile)] == ""} return 713 # get data bank number, test if valid 698 714 set num $newhist(banknum) 715 if {[catch {expr $num}]} {return} 699 716 if {$newhist(insttype) == "TOF"} { 700 717 set newhist(2tLimit) [expr {$newhist(tmin$num) / 10.}] 701 if {[llength $newhist(banklist)] == $newhist(instbanks)} { 702 set newhist(setnum) $newhist(banknum) 703 # at Ashfia's request, override the bank header # with the 704 # value from the instrument parameter file. 705 catch { 706 set s $newhist(setnum) 707 foreach {x tmin tmax x} $newhist(inst${s}ITYP) {} 708 if {$tmin > 0} {set newhist(2tLimit) $tmin} 709 } 718 # at Ashfia's request, override the bank header # with the 719 # value from the instrument parameter file. 720 catch { 721 set s $newhist(setnum) 722 foreach {x tmin tmax x} $newhist(inst${s}ITYP) {} 723 if {$tmin > 0} {set newhist(2tLimit) $tmin} 710 724 } 711 725 } else { 712 726 set newhist(2tLimit) $newhist(tmax$num) 713 727 } 714 set newhist(LimitMode) 1715 716 728 } 717 729 … … 819 831 } 820 832 grid [radiobutton $np.set.$i -text $i \ 821 -command "Post DummyOpts $np; ValidateDummyHist $np" \833 -command "PostInstBankopts $np; ValidateDummyHist $np" \ 822 834 -variable newhist(setnum) -value $i] \ 823 835 -column [incr col] -row $row -sticky w 824 836 if {$newhist(instbanks) == 1} {set newhist(setnum) $i} 825 837 } 826 if {$newhist(dummy)} {Post DummyOpts $np; ValidateDummyHist $np}838 if {$newhist(dummy)} {PostInstBankopts $np; ValidateDummyHist $np} 827 839 LabelInstParm 828 840 SetMultipleAdd $np … … 1023 1035 update 1024 1036 } 1025 #--- Dummy histogram stuff1026 proc Post DummyOpts {np} {1037 #--- Respond to the setting of the bank # for the Instrument parameter file. 1038 proc PostInstBankopts {np} { 1027 1039 global newhist 1028 1040 if {$newhist(dummy)} { … … 1084 1096 grid $np.cb4 -column 2 -row 20 -sticky w 1085 1097 grid $np.cb5 -column 2 -row 19 -sticky w 1086 } 1098 SetTmax 1099 } 1087 1100 } 1088 1101 … … 1337 1350 grid [radiobutton $top.vartyp.cb5 -text "Q-max\n(A-1)" -variable newhist(LimitMode) \ 1338 1351 -value 2] -column 2 -row 1 -sticky w 1339 set newhist(LimitMode) 11340 1352 1341 1353 grid [button $top.add -text Add -command "destroy $np"] -column 0 -row 3 … … 2519 2531 incr expgui(changed) 2520 2532 } 2533 set expmap(atomlist_$phase) {} 2521 2534 RecordMacroEntry "incr expgui(changed)" 0 2522 2535 # write new atoms from table as input to exptool 2523 2536 set errmsg [runAddAtoms $phase $atomlist] 2524 2537 RecordMacroEntry "runAddAtoms $phase [list $atomlist]" 0 2538 SpaceGroupWarnings "" $phase $spg 2525 2539 return $errmsg 2540 } 2541 2542 proc SpaceGroupWarnings {warn phase spg} { 2543 # warning on possible origin 1 setting 2544 set shift [GetOrigin1Shift $phase] 2545 if {$shift != ""} { 2546 append warn "Note that this space group ($spg) has both Origin 1 and Origin 2 settings. Origin 2 must be used in GSAS. Please check atom multiplicities (or use the Results/composition command) to verify you have the correct origin setting. Note that the Xform Atoms/Xform Origin 1 to Origin 2 button can be used to correct this.\n" 2547 } 2548 if {$warn != ""} { 2549 MyMessageBox -parent . -title "Space Group Note" \ 2550 -message $warn -icon warning 2551 } 2526 2552 } 2527 2553 … … 2716 2742 set newhist(dummy) 0 2717 2743 set newhist(instfiletext) {} 2744 set newhist(instbanks) {}
Note: See TracChangeset
for help on using the changeset viewer.