• R/O
  • HTTP
  • SSH
  • HTTPS

Molby: コミット

Molecular Modeling Software


コミットメタ情報

リビジョンe6873ff73a0cbb1f41ca27d83857228a2c901f65 (tree)
日時2014-04-10 20:12:52
作者toshinagata1964 <toshinagata1964@a2be...>
コミッターtoshinagata1964

ログメッセージ

GAMESS execution from Ruby script is improved (not quite well yet)

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

変更サマリ

差分

--- a/Scripts/gamess.rb
+++ b/Scripts/gamess.rb
@@ -138,13 +138,13 @@ class Molecule
138138 end
139139 end
140140
141- if mol == nil
142- mol = Molecule.open(inpname)
143- if mol == nil
144- error_message_box("Cannot open #{inpname} as GAMESS input")
145- return
146- end
147- end
141+# if mol == nil
142+# mol = Molecule.open(inpname)
143+# if mol == nil
144+# error_message_box("Cannot open #{inpname} as GAMESS input")
145+# return
146+# end
147+# end
148148
149149 inpbase = File.basename(inpname)
150150 inpdir = File.dirname(inpname)
@@ -413,7 +413,9 @@ class Molecule
413413 end
414414 }
415415 erase_old_logs(scrdir, "latest", 5)
416- message_box(msg, hmsg, :ok, icon)
416+ if mol != nil
417+ message_box(msg, hmsg, :ok, icon)
418+ end
417419 }
418420
419421 timer_callback = lambda { |m, n|
@@ -491,7 +493,8 @@ class Molecule
491493 end
492494 else
493495 pid = call_subprocess(cmdline, "Running GAMESS")
494- term_callback(nil, pid)
496+ term_callback.call(nil, pid)
497+ return pid
495498 end
496499
497500 end
--- a/Scripts/md.rb
+++ b/Scripts/md.rb
@@ -394,39 +394,6 @@ class Molecule
394394 return count
395395 end
396396
397- def remove_dir(dir)
398- entries = Dir.entries(dir)
399- entries.each { |en|
400- next if en == "." || en == ".."
401- fname = "#{dir}/#{en}"
402- if File.directory?(fname)
403- remove_dir(fname)
404- else
405- File.unlink(fname)
406- end
407- }
408- Dir.unlink(dir)
409- end
410-
411- def erase_old_logs(tdir, level, keep_number)
412- log_dir = File.dirname(tdir)
413- if level == nil || level == "none"
414- remove_dir(tdir)
415- elsif level == "latest"
416- if keep_number == nil
417- keep_number = 5
418- else
419- keep_number = keep_number.to_i
420- end
421- entries = Dir.entries(log_dir).select { |en| en != "." && en != ".." && File.directory?("#{log_dir}/#{en}") }
422- # Sort by modification date
423- entries = entries.sort_by { |en| File.mtime("#{log_dir}/#{en}").to_i }
424- (0...entries.count - keep_number).each { |i|
425- remove_dir("#{log_dir}/#{entries[i]}")
426- }
427- end
428- end
429-
430397 def invoke_antechamber(ask_options = true, msg = nil)
431398 # Find the ambertool directory
432399 ante_dir = "#{ResourcePath}/amber11/bin"
--- a/Scripts/startup.rb
+++ b/Scripts/startup.rb
@@ -160,6 +160,40 @@ module Kernel
160160 }
161161 end
162162 end
163+
164+ def remove_dir(dir)
165+ entries = Dir.entries(dir)
166+ entries.each { |en|
167+ next if en == "." || en == ".."
168+ fname = "#{dir}/#{en}"
169+ if File.directory?(fname)
170+ remove_dir(fname)
171+ else
172+ File.unlink(fname)
173+ end
174+ }
175+ Dir.unlink(dir)
176+ end
177+
178+ def erase_old_logs(tdir, level, keep_number)
179+ log_dir = File.dirname(tdir)
180+ if level == nil || level == "none"
181+ remove_dir(tdir)
182+ elsif level == "latest"
183+ if keep_number == nil
184+ keep_number = 5
185+ else
186+ keep_number = keep_number.to_i
187+ end
188+ entries = Dir.entries(log_dir).select { |en| en != "." && en != ".." && File.directory?("#{log_dir}/#{en}") }
189+ # Sort by modification date
190+ entries = entries.sort_by { |en| File.mtime("#{log_dir}/#{en}").to_i }
191+ (0...entries.count - keep_number).each { |i|
192+ remove_dir("#{log_dir}/#{entries[i]}")
193+ }
194+ end
195+ end
196+
163197 end
164198
165199 class IO
旧リポジトリブラウザで表示