Changeset 999
- Timestamp:
- Sep 8, 2010 5:04:39 PM (10 years ago)
- Location:
- branches/sandbox
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/sandbox/atomcons.tcl
r930 r999 11 11 grid [NoteBook $expgui(consFrame).n -bd 2 -side bottom] -sticky news 12 12 source [file join $expgui(scriptdir) profcons.tcl] 13 source [file join $expgui(scriptdir) distrest.tcl] 13 14 } 14 15 … … 20 21 catch {$expgui(consFrame).n delete macro} 21 22 catch {$expgui(consFrame).n delete profile} 23 catch {$expgui(consFrame).n delete distrest} 22 24 set atom normal 23 25 set mm disabled … … 31 33 } 32 34 set expcons(atommaster) [\ 33 $expgui(consFrame).n insert end atomic -text Atomic\35 $expgui(consFrame).n insert end atomic -text "Atom Constraints" \ 34 36 -state $atom \ 35 37 -createcmd "MakeAtomsConstraintsPane" \ … … 42 44 # profile constraints page 43 45 set expcons(profilemaster) [\ 44 $expgui(consFrame).n insert end profile -text Profile\46 $expgui(consFrame).n insert end profile -text "Profile Constraints" \ 45 47 -createcmd "MakeProfileConstraintsPane" \ 46 48 -raisecmd "DisplayProfileConstraints"] 49 set expcons(distmaster) [\ 50 $expgui(consFrame).n insert end distrest -text "Distance Restraints" \ 51 -state $atom \ 52 -createcmd "" \ 53 -raisecmd "DisplayDistanceRestraints"] 54 47 55 set page [$expgui(consFrame).n raise] 48 56 # open the atom constraints page if no page is open -
branches/sandbox/readexp.tcl
r997 r999 2831 2831 } 2832 2832 2833 proc GetSoftConst {} { 2834 set HST {} 2835 # look for RSN record 2836 #set n 0 2837 for {set i 0} {$i < $::expmap(nhst)} {incr i} { 2838 set ihist [expr {$i + 1}] 2839 if {[expr {$i % 12}] == 0} { 2840 incr n 2841 set line [readexp " EXPR HTYP$n"] 2842 if {$line == ""} { 2843 set msg "No HTYP$n entry for Histogram $ihist. This is an invalid .EXP file" 2844 tk_dialog .badexp "Error in readexp" $msg error 0 Exit 2845 } 2846 set j 0 2847 } else { 2848 incr j 2849 } 2850 if {[string range $line [expr 2+5*$j] [expr 5*($j+1)]] == "RSN "} { 2851 set HST $ihist 2852 } 2853 } 2854 if {$HST == ""} {return "" ""} 2855 if {$HST <=9} { 2856 set key "HST $HST" 2857 } else { 2858 set key "HST $HST" 2859 } 2860 set factr [string trim [string range [readexp "$key FACTR"] 0 14]] 2861 set ncons [string trim [string range [readexp "$key NBNDS"] 0 4]] 2862 set conslist {} 2863 for {set i 1} {$i <= $ncons} {incr i} { 2864 set fi [string toupper [format %.4x $i]] 2865 lappend conslist [string trim [readexp "${key}BD$fi"]] 2866 } 2867 return [list $factr $conslist] 2868 } 2869 2870 proc SetSoftCons {factr conslist} { 2833 # read/edit soft (distance) restraint info 2834 # parm: 2835 # weight -- histogram weight (factr) * 2836 # restraintlist -- list of restraints * 2837 # action: get (default) or set 2838 # value: used only with set 2839 # * => read+write supported 2840 proc SoftConst {parm "action get" "value {}"} { 2871 2841 set HST {} 2872 2842 # look for RSN record … … 2889 2859 } 2890 2860 } 2891 if {$HST == ""} { 2861 if {$HST == ""} {return "1"} 2862 if {$HST <=9} { 2863 set key "HST $HST" 2864 } else { 2865 set key "HST $HST" 2866 } 2867 if {$HST == "" && $action == "set"} { 2892 2868 # no RSN found need to add the soft constr. histogram 2893 2869 # increment number of histograms … … 2915 2891 makeexprec "$key NBNDS" 2916 2892 } 2917 # update histogram 2918 if {$HST <=9} { 2919 set key "HST $HST" 2920 } else { 2921 set key "HST $HST" 2922 } 2923 # update FACTR 2924 if ![validreal factr 15 6] {return 0} 2925 setexp "$key FACTR" $factr 1 15 2926 set num [llength $conslist] 2927 if ![validint num 5] {return 0} 2928 setexp "$key NBNDS" $num 1 5 2929 # delete all old records 2930 foreach i [array names ::exparray "${key}BD*"] {unset ::exparray($i)} 2931 set i 0 2932 foreach cons $conslist { 2933 incr i 2934 set fi [string toupper [format %.4x $i]] 2935 makeexprec "${key}BD$fi" 2936 set pos 1 2937 foreach num $cons len {3 5 5 3 3 3 3 3 -6 -6} { 2938 if {$len > 0} { 2939 validint num $len 2940 setexp "${key}BD$fi" $num $pos $len 2941 } else { 2942 set len [expr abs($len)] 2943 validreal num $len 3 2944 setexp "${key}BD$fi" $num $pos $len 2945 } 2946 incr pos $len 2947 } 2948 } 2949 } 2893 2894 switch -glob ${parm}-$action { 2895 weight-get { 2896 return [string trim [string range [readexp "$key FACTR"] 0 14]] 2897 } 2898 weight-set { 2899 # update FACTR 2900 if ![validreal value 15 6] {return 0} 2901 setexp "$key FACTR" $value 1 15 2902 } 2903 restraintlist-get { 2904 set ncons [string trim [string range [readexp "$key NBNDS"] 0 4]] 2905 set conslist {} 2906 for {set i 1} {$i <= $ncons} {incr i} { 2907 set fi [string toupper [format %.4x $i]] 2908 lappend conslist [string trim [readexp "${key}BD$fi"]] 2909 } 2910 return [list $conslist] 2911 } 2912 restraintlist-set { 2913 set num [llength $value] 2914 if ![validint num 5] {return 0} 2915 setexp "$key NBNDS" $num 1 5 2916 # delete all old records 2917 foreach i [array names ::exparray "${key}BD*"] {unset ::exparray($i)} 2918 set i 0 2919 foreach cons $value { 2920 incr i 2921 set fi [string toupper [format %.4x $i]] 2922 makeexprec "${key}BD$fi" 2923 set pos 1 2924 foreach num $cons len {3 5 5 3 3 3 3 3 -6 -6} { 2925 if {$len > 0} { 2926 validint num $len 2927 setexp "${key}BD$fi" $num $pos $len 2928 } else { 2929 set len [expr abs($len)] 2930 validreal num $len 3 2931 setexp "${key}BD$fi" $num $pos $len 2932 } 2933 incr pos $len 2934 } 2935 } 2936 } 2937 default { 2938 set msg "Unsupported phaseinfo access: parm=$parm action=$action" 2939 tk_dialog .badexp "Error in readexp" $msg error 0 Exit 2940 } 2941 return 1 2942 } 2943 } 2944 2950 2945 #====================================================================== 2951 2946 # conversion routines
Note: See TracChangeset
for help on using the changeset viewer.