Molecular Modeling Software
リビジョン | 85446466f8beb971910c8e3848f976da2515877e (tree) |
---|---|
日時 | 2013-11-15 20:34:25 |
作者 | toshinagata1964 <toshinagata1964@a2be...> |
コミッター | toshinagata1964 |
Bond/Angle with Sigma dialog is being overhauled. (still in progress)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@419 a2be9bc6-48de-4e38-9406-05402d4bc13c
@@ -847,7 +847,7 @@ def bond_angle_with_sigma(*args) | ||
847 | 847 | printf " dr/d{alpha,beta,gamma} est %10.5g %10.5g %10.5g\n", dd[3], dd[4], dd[5] |
848 | 848 | end |
849 | 849 | sig = sqrt(sig) |
850 | - results.push([i, j, nil, notate_with_sigma.call(p[0], sig), symcode[i], symcode[j]]) | |
850 | + results.push([[i, j], notate_with_sigma.call(p[0], sig), symcode[i], symcode[j], nil]) | |
851 | 851 | } |
852 | 852 | |
853 | 853 | angles.each { |ang| |
@@ -912,12 +912,79 @@ def bond_angle_with_sigma(*args) | ||
912 | 912 | dd = dtdr12 * p0[9] + dtdr23 * p1[9] + dtdr13 * p2[9] + dtdr24 * p3[9] |
913 | 913 | sig += dd * dd * cell[11] * cell[11] |
914 | 914 | sig = sqrt(sig) |
915 | - results.push([i, j, k, notate_with_sigma.call(t123*180/PI, sig), symcode[i], symcode[j], symcode[k]]) | |
915 | + results.push([[i, j, k], notate_with_sigma.call(t123*180/PI, sig), symcode[i], symcode[j], symcode[k]]) | |
916 | 916 | } |
917 | 917 | results |
918 | 918 | end |
919 | 919 | |
920 | 920 | def cmd_bond_angle_with_sigma |
921 | + mol = self | |
922 | + Dialog.new("Bond & Angle with Sigma:" + self.name, "Close", nil) { | |
923 | + values = [] | |
924 | + clicked = [] | |
925 | + sel = mol.selection | |
926 | + on_get_value = proc { |it, row, col| | |
927 | + val = values[row][col] | |
928 | + if col == 0 | |
929 | + val = val.collect { |i| ap = mol.atoms[i]; "#{ap.res_seq}:#{ap.name}" }.join("-") | |
930 | + elsif col >= 2 && col <= 4 | |
931 | + val ||= "." | |
932 | + end | |
933 | + val | |
934 | + } | |
935 | + layout(1, | |
936 | + item(:table, :width=>480, :height=>300, :tag=>"table", | |
937 | + :columns=>["Bond/Angle", "value(sigma)", "symop1", "symop2", "symop3"], | |
938 | + :on_count=> proc { values.count }, | |
939 | + :on_get_value=> on_get_value) | |
940 | + ) | |
941 | + on_document_modified = proc { | |
942 | + newsel = mol.selection | |
943 | + puts "newsel = #{newsel}" | |
944 | + if sel != newsel | |
945 | + n0 = sel.count | |
946 | + n1 = newsel.count | |
947 | + if n1 == 1 # New atom is clicked | |
948 | + clicked[0] = newsel[0] | |
949 | + clicked[1..-1] = [] | |
950 | + if n0 == 1 | |
951 | + values[-1][0] = [clicked[0]] | |
952 | + else | |
953 | + values.push([[clicked[0]], "---", nil, nil, nil]) | |
954 | + end | |
955 | + elsif n1 == 2 # Bond | |
956 | + puts "new bond" | |
957 | + if newsel.include?(clicked[0]) | |
958 | + if newsel[0] == clicked[0] | |
959 | + clicked[1] = newsel[1] | |
960 | + else | |
961 | + clicked[1] = newsel[0] | |
962 | + end | |
963 | + else | |
964 | + clicked[0] = newsel[0] | |
965 | + clicked[1] = newsel[1] | |
966 | + end | |
967 | + clicked[2..-1] = [] | |
968 | + puts "clicked = #{clicked.inspect}" | |
969 | + val = mol.bond_angle_with_sigma(clicked) | |
970 | + puts "val = #{val.inspect}" | |
971 | + if n0 == 1 | |
972 | + values[-1] = val[0] | |
973 | + else | |
974 | + values.push(val[0]) | |
975 | + end | |
976 | + end | |
977 | + sel = newsel | |
978 | + item_with_tag("table")[:refresh] = true | |
979 | + end | |
980 | + } | |
981 | + listen(mol, "documentModified", on_document_modified) | |
982 | + listen(mol, "documentWillClose", proc { hide } ) | |
983 | + show | |
984 | + } | |
985 | +end | |
986 | + | |
987 | +def cmd_bond_angle_with_sigma_old | |
921 | 988 | if self.cell == nil |
922 | 989 | error_message_box "Unit cell is not defined" |
923 | 990 | elsif self.cell.length < 12 |