Changeset 1018 for branches/sandbox
- Timestamp:
- Oct 5, 2010 1:45:37 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/sandbox/readexp.tcl
r1017 r1018 498 498 } 499 499 500 proc disagldat_get {phase} { 501 set key " DSGL CDAT$phase" 502 if {[existsexp $key] == 0} {return "{none} {none}"} 503 set line [readexp $key] 504 set i1 2 505 # read atom-atom distance parameter 506 set dist {} 507 set item [string range $line $i1 $i1+3] 508 if {$item == "DMAX"} { 509 set val [string range $line $i1+4 $i1+11] 510 set dist [string trim $val] 511 incr i1 13 512 } else { 513 set dist "radii" 514 incr i1 5 515 } 516 # read atom-atom-atom angle parameter 517 set ang {} 518 set item [string range $line $i1 $i1+3] 519 if {$item == "DAGL"} { 520 set val [string range $line $i1+4 $i1+11] 521 set ang [string trim $val] 522 incr i1 13 523 } else { 524 set ang "radii" 525 incr i1 5 526 } 527 # note there are two more parameters, NOFO/FORA & ONCR/DFLT, but they are not being processed yet 528 return "$dist $ang" 529 } 530 500 531 # get phase information: phaseinfo phase parm action value 501 532 # phase: 1 to 9 (as defined) … … 520 551 # ODFcoefXXX -- the ODF coefficient for for ODF term XXX (*) 521 552 # ODFRefcoef -- refinement flag for ODF terms (*) 553 # DistCalc -- returns "radii", "none" or a number (*) 554 # none: no distance or angle computation for the phase 555 # radii: computation will be done by sums of radii 556 # (see AtmTypInfo and DefAtmTypInfo) 557 # other: a distance specifing the maximum distance 558 # AngCalc -- returns "radii", "none" or a number (*) 559 # none: no distance or angle computation for the phase 560 # radii: computation will be done by sums of radii 561 # (see AtmTypInfo and DefAtmTypInfo) 562 # other: a distance specifing the maximum distance 522 563 # action: get (default) or set 523 564 # value: used only with set … … 833 874 } 834 875 } 835 876 DistCalc-get { 877 set val [disagldat_get $phase] 878 return [lindex $val 0] 879 } 880 DistCalc-set { 881 set key " DSGL CDAT$phase" 882 # for none delete the record & thats all folks 883 if {$value == "none"} { 884 catch {unset exparray($key)} 885 return 886 } 887 if {[existsexp $key] == 0} { 888 makeexprec $key 889 } 890 set line [readexp $key] 891 if {[string trim $line] == ""} { 892 # blank set to defaults 893 set line [string replace $line 2 15 "DRAD ARAD NOFO"] 894 } 895 if {$value == "radii"} { 896 if {[string range $line 2 5] == "DMAX"} { 897 set line [string replace $line 2 13 "DRAD"] 898 } else { 899 set line [string replace $line 2 5 "DRAD"] 900 } 901 } else { 902 if ![validreal value 8 2] {return 0} 903 if {[string range $line 2 5] == "DMAX"} { 904 set line [string replace $line 6 13 $value] 905 } else { 906 set line [string replace $line 2 5 "DMAX"] 907 set line [string replace $line 6 6 "$value "] 908 } 909 } 910 setexp $key $line 0 68 911 } 912 AngCalc-get { 913 set val [disagldat_get $phase] 914 return [lindex $val 1] 915 } 916 AngCalc-set { 917 set key " DSGL CDAT$phase" 918 # for none delete the record & thats all folks 919 if {$value == "none"} { 920 catch {unset exparray($key)} 921 return 922 } 923 if {[existsexp $key] == 0} { 924 makeexprec $key 925 } 926 set line [readexp $key] 927 if {[string trim $line] == ""} { 928 # blank set to defaults 929 set line [string replace $line 2 15 "DRAD ARAD NOFO"] 930 } 931 if {[string range $line 2 5] == "DMAX"} { 932 set i2 8 933 } else { 934 set i2 0 935 } 936 if {$value == "radii"} { 937 if {[string range $line $i2+7 $i2+10] == "DAGL"} { 938 set line [string replace $line $i2+7 $i2+18 "ARAD"] 939 } else { 940 set line [string replace $line $i2+7 $i2+10 "ARAD"] 941 } 942 } else { 943 if ![validreal value 8 2] {return 0} 944 if {[string range $line $i2+7 $i2+10] == "DAGL"} { 945 set line [string replace $line $i2+11 $i2+18 $value] 946 } else { 947 set line [string replace $line $i2+7 $i2+10 "DAGL"] 948 set line [string replace $line $i2+11 $i2+11 "$value "] 949 } 950 } 951 setexp $key $line 0 68 952 } 836 953 default { 837 954 set msg "Unsupported phaseinfo access: parm=$parm action=$action" … … 841 958 return 1 842 959 } 960 843 961 844 962
Note: See TracChangeset
for help on using the changeset viewer.