• R/O
  • SSH
  • HTTPS

molby: Commit


Commit MetaInfo

Revision622 (tree)
Time2019-08-17 13:11:25
Authortoshinagata1964

Log Message

NO2, SO (sulfonyl) and SO3H (sulfonic acid) are now recognized as known fragments.

Change Summary

Incremental Difference

--- trunk/Scripts/formula.rb (revision 621)
+++ trunk/Scripts/formula.rb (revision 622)
@@ -209,7 +209,7 @@
209209 sd = self.find_dummy_atoms
210210 len2 = sd.length
211211 if len2 < mult
212- raise "Self has too few dummy atoms (#{len2}) to connect the given molecule (#{mult} bond order)"
212+ raise "self has too few dummy atoms (#{len2}) to connect the given molecule (#{mult} bond order)"
213213 elsif len2 > mult
214214 sd.shift # Keep the first dummy atom untouched
215215 sd.slice!(mult..-1)
@@ -499,9 +499,9 @@
499499 end
500500
501501 # Define atom fragments
502- elements = %w(C H Li Be B C N O F Na Mg Al Si P S Cl)
503- valences = [4,1,1,2,3,4,3,2,1,1,2,3,4,3,2,1]
504- degrees = {"N"=>100, "O"=>110, "P"=>95, "S"=>108}
502+ elements = %w(C H Li Be B C N O F Na Mg Al Si P S Cl Zn Ga Ge As Se Br Cd In Sn Sb Te I Hg Tl Pb Bi)
503+ valences = [4,1,1, 2, 3,4,3,2,1,1, 2, 3, 4, 3,2,1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1,2, 3, 4, 3]
504+ degrees = {"N"=>100, "O"=>110, "P"=>95, "S"=>108, "As"=>92, "Se"=>91, "Sb"=>92, "Te"=>90, "Bi"=>90}
505505 elements.each_index { |i|
506506 name = elements[i]
507507 angle = degrees[name]
--- trunk/Scripts/mbsf/fragment_def.rb (revision 621)
+++ trunk/Scripts/mbsf/fragment_def.rb (revision 622)
@@ -82,20 +82,35 @@
8282 ["MX4 tetrahedral", "coordination/MX4t.mbsf"],
8383 ["MX4 square-planar", "coordination/MX4p.mbsf"],
8484 ["MX5 trigonal bipyramidal", "coordination/MX5.mbsf"],
85- ["MX6 octahedral", "coordination/MX6.mbsf"]
85+ ["MX6 octahedral", "coordination/MX6.mbsf"],
86+
87+ "...",
88+ ["NO2", "fragments/NO2.mbsf", "H1"],
89+ ["SO2O", "fragments/SO3H.mbsf", "H1", "H2"],
90+ ["SO3", "fragments/SO3H.mbsf", "H1", "H2"],
91+ ["SO3H", "fragments/SO3H.mbsf", "H1"],
92+ ["SO", "fragments/SO.mbsf", "H1", "H2"]
8693 ]
8794
8895 $named_fragments = []
96+ subtitle = nil
8997
9098 table.each { |t|
9199 if t.is_a?(String)
92- $named_fragments.push([t, "-"]) # Subtitle
100+ if t != "..."
101+ subtitle = t
102+ $named_fragments.push([t, "-"]) # Subtitle
103+ else
104+ subtitle = nil
105+ end
93106 next
94107 end
95108 fname = t[1]
96109 if fname =~ /\.mbsf$/
97110 f = new(MbsfPath + "/" + fname) # Molecule.new
98- $named_fragments.push([t[0], t[1]]) # Registered fragment
111+ if subtitle
112+ $named_fragments.push([t[0], t[1]]) # Registered fragment
113+ end
99114 else
100115 f = known_fragment(fname)
101116 end
Show on old repository browser