• R/O
  • HTTP
  • SSH
  • HTTPS

Molby: コミット

Molecular Modeling Software


コミットメタ情報

リビジョン690fd4146d717de6c842863a18a0743b8e6afbdd (tree)
日時2014-03-25 09:09:17
作者toshinagata1964 <toshinagata1964@a2be...>
コミッターtoshinagata1964

ログメッセージ

Document figures in Step 11 are updated

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@506 a2be9bc6-48de-4e38-9406-05402d4bc13c

変更サマリ

差分

Binary files a/Documents/etc/ruby_01.png and b/Documents/etc/ruby_01.png differ
Binary files a/Documents/etc/ruby_02.png and b/Documents/etc/ruby_02.png differ
Binary files a/Documents/etc/ruby_03.png and b/Documents/etc/ruby_03.png differ
Binary files a/Documents/etc/ruby_04.png and b/Documents/etc/ruby_04.png differ
Binary files a/Documents/etc/ruby_05.png and b/Documents/etc/ruby_05.png differ
Binary files a/Documents/etc/ruby_06.png and b/Documents/etc/ruby_06.png differ
Binary files a/Documents/etc/ruby_07.png and b/Documents/etc/ruby_07.png differ
Binary files a/Documents/etc/ruby_08.png and b/Documents/etc/ruby_08.png differ
--- a/Documents/src/doc_source.html
+++ b/Documents/src/doc_source.html
@@ -2012,7 +2012,7 @@ The "32" here is not a number but a string, because it is surrounded by quotatio
20122012 </p>
20132013 <p><img src="../etc/ruby_02.png" /></p>
20142014 <p>
2015-Molby complains with this error dialog. It says "in '+': can't convert Fixnum into String," which means the integer 32 cannot be added to a string "C". Such kind of "type mismatch" error occurs very often, so please get used to it and learn how to fix it.
2015+Molby complains with this error dialog. It says "no implicit conversion of Fixnum into String," which means the integer 32 cannot be added to a string "C". Such kind of "type mismatch" error occurs very often, so please get used to it and learn how to fix it.
20162016 </p>
20172017 <p>
20182018 Another useful feature of Ruby is an <i>Array</i>, which is an ordered collection of other Ruby objects. An array is expressed by comma-separated values surrounded by a pair of brackets.
@@ -2220,9 +2220,25 @@ The last example generates a model of carbon nanotube with any chirality and len
22202220 <p class="code"><span class="comment"># Create a model of carbon nanotube
22212221 # Requires Molby</span>
22222222 r = 1.42 <span class="comment"># The C-C bond length</span>
2223-n = 10 <span class="comment"># The chirality index</span>
2223+n = 10 <span class="comment"># The default chirality index</span>
22242224 m = 5 <span class="comment"># (ibid)</span>
2225-aspect = 5.0 <span class="comment"># The aspect ratio (length / diameter)</span>
2225+aspect = 5.0 <span class="comment"># The default aspect ratio (length / diameter)</span>
2226+
2227+# Dialog to ask the chirality index and the aspect ratio
2228+h = Dialog.run("Create Carbon Nanotube") {
2229+ layout(3,
2230+ item(:text, :title=&gt;"Chirality Index"),
2231+ item(:textfield, :width=&gt;80, :tag=&gt;"n", :value=&gt;n.to_s),
2232+ item(:textfield, :width=&gt;80, :tag=&gt;"m", :value=&gt;m.to_s),
2233+ item(:text, :title=&gt;"Aspect Ratio"),
2234+ item(:textfield, :width=&gt;160, :tag=&gt;"aspect", :value=&gt;sprintf("%.1f", aspect)),
2235+ -1)
2236+}
2237+
2238+exit if h[:status] != 0
2239+aspect = h["aspect"].to_f
2240+n = h["n"].to_i
2241+m = h["m"].to_i
22262242
22272243 k = aspect / (PI * sqrt(3.0))
22282244 points = []
@@ -2257,7 +2273,7 @@ mol.guess_bonds
22572273 mol2 = Molecule.open
22582274 mol2.add(mol)
22592275 </p>
2260-<p><img src="../etc/ruby_07.png" /><img src="../etc/ruby_08.png" /></p>
2276+<p><img style="vertical-align: top;" src="../etc/ruby_07.png" /><img src="../etc/ruby_08.png" /></p>
22612277
22622278 <h2>5. Where to Go from Here</h2>
22632279 <p>
@@ -2316,7 +2332,7 @@ Ruby インタプリタが "1+2" を計算し、答え (3) を次の行に表示
23162332 </p>
23172333 <p><img src="../etc/ruby_02.png" /></p>
23182334 <p>
2319-Molby はエラーメッセージ "in '+': can't convert Fixnum into String" を表示します。これは、「整数」32 を「文字列」"C" に足すことはできないことを意味しています。このような「型が違う」エラーはとてもよく起きるので、どのように直せばいいかをよく理解しておいてください。
2335+Molby はエラーメッセージ "no implicit conversion of Fixnum into String" を表示します。これは、「整数」32 を「文字列」"C" に足すことはできないことを意味しています。このような「型が違う」エラーはとてもよく起きるので、どのように直せばいいかをよく理解しておいてください。
23202336 </p>
23212337 <p>
23222338 Ruby のもう1つの便利な機能は「配列」<i>(Array)</i> です。これは、他の Ruby オブジェクトを順番に並べたものです。配列は、値をコンマで区切って角括弧 [] で囲むことで表します。
@@ -2524,9 +2540,25 @@ fp.close <span class="comment"># We are done with this file
25242540 <p class="code"><span class="comment"># Create a model of carbon nanotube
25252541 # Requires Molby</span>
25262542 r = 1.42 <span class="comment"># The C-C bond length</span>
2527-n = 10 <span class="comment"># The chirality index</span>
2543+n = 10 <span class="comment"># The default chirality index</span>
25282544 m = 5 <span class="comment"># (ibid)</span>
2529-aspect = 5.0 <span class="comment"># The aspect ratio (length / diameter)</span>
2545+aspect = 5.0 <span class="comment"># The default aspect ratio (length / diameter)</span>
2546+
2547+# Dialog to ask the chirality index and the aspect ratio
2548+h = Dialog.run("Create Carbon Nanotube") {
2549+ layout(3,
2550+ item(:text, :title=&gt;"Chirality Index"),
2551+ item(:textfield, :width=&gt;80, :tag=&gt;"n", :value=&gt;n.to_s),
2552+ item(:textfield, :width=&gt;80, :tag=&gt;"m", :value=&gt;m.to_s),
2553+ item(:text, :title=&gt;"Aspect Ratio"),
2554+ item(:textfield, :width=&gt;160, :tag=&gt;"aspect", :value=&gt;sprintf("%.1f", aspect)),
2555+ -1)
2556+}
2557+
2558+exit if h[:status] != 0
2559+aspect = h["aspect"].to_f
2560+n = h["n"].to_i
2561+m = h["m"].to_i
25302562
25312563 k = aspect / (PI * sqrt(3.0))
25322564 points = []
@@ -2561,7 +2593,7 @@ mol.guess_bonds
25612593 mol2 = Molecule.open
25622594 mol2.add(mol)
25632595 </p>
2564-<p><img src="../etc/ruby_07.png" /><img src="../etc/ruby_08.png" /></p>
2596+<p><img style="vertical-align: top;" src="../etc/ruby_07.png" /><img src="../etc/ruby_08.png" /></p>
25652597
25662598 <h2>5. 次に学ぶべきこと</h2>
25672599 <p>
旧リポジトリブラウザで表示