OSDN Git Service

export_prmtop can now be used from script
authortoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Thu, 13 Oct 2011 00:27:00 +0000 (00:27 +0000)
committertoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Thu, 13 Oct 2011 00:27:00 +0000 (00:27 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@139 a2be9bc6-48de-4e38-9406-05402d4bc13c

Scripts/md.rb

index bf729e8..e16a15b 100755 (executable)
@@ -795,7 +795,7 @@ class Molecule
   end
   
   # Create sander input files from current molecule  
-  def export_prmtop
+  def export_prmtop(filename = nil)
   
     def error_dialog(msg)
       Dialog.run("AMBER Export Error") {
@@ -956,10 +956,14 @@ class Molecule
       }
     }
         
-    basename = (self.path ? File.basename(self.path, ".*") : self.name)
-    fname = Dialog.save_panel("AMBER prmtop/inpcrd file name", self.dir, basename + ".prmtop", "All files|*.*")
-    return nil if !fname
-    
+       if filename
+         fname = filename
+    else
+      basename = (self.path ? File.basename(self.path, ".*") : self.name)
+      fname = Dialog.save_panel("AMBER prmtop/inpcrd file name", self.dir, basename + ".prmtop", "AMBER prmtop (*.prmtop)|*.prmtop|All files|*.*")
+      return nil if !fname
+    end
+
     open(fname, "w") { |fp|
       date = Time.now.localtime.strftime("%m/%d/%y  %H:%M:%S")