From 0aa8fddfb2f8313feeb972e89b5a1d9cd059d192 Mon Sep 17 00:00:00 2001 From: toshinagata1964 Date: Sun, 16 Feb 2014 15:10:54 +0000 Subject: [PATCH] 'Create MO Cube' does not work when the molecule has no associated file. Fixed. git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@440 a2be9bc6-48de-4e38-9406-05402d4bc13c --- Scripts/commands.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Scripts/commands.rb b/Scripts/commands.rb index 3485850..8ab0eae 100755 --- a/Scripts/commands.rb +++ b/Scripts/commands.rb @@ -191,6 +191,8 @@ end_of_header item(:textfield, :width=>100, :height=>20, :tag=>"stepz", :value=>grid[6].to_s))) } if hash[:status] == 0 + path = self.path || self.name + dir = self.dir || Dir.pwd origin = Vector3D[hash["originx"], hash["originy"], hash["originz"]] dx = hash["deltax"] dy = hash["deltay"] @@ -198,16 +200,16 @@ end_of_header nx = hash["stepx"] ny = hash["stepy"] nz = hash["stepz"] - basename = File.basename(self.path, ".*") + basename = File.basename(path, ".*") filenames = [] mo_type = self.mo_type mos.each { |n| fname1 = fname2 = nil alpha = (mo_type != "UHF" ? "" : "alpha ") a = (mo_type != "UHF" ? "" : "a") - fname1 = Dialog.save_panel("Cube file name for #{alpha}MO #{n}", self.dir, basename + "_#{n}#{a}.cube", "Gaussian cube file (*.cube)|*.cube") + fname1 = Dialog.save_panel("Cube file name for #{alpha}MO #{n}", dir, basename + "_#{n}#{a}.cube", "Gaussian cube file (*.cube)|*.cube") if (mo_type == "UHF") - fname2 = Dialog.save_panel("Cube file name for beta MO #{n}", self.dir, basename + "_#{n}b.cube", "Gaussian cube file (*.cube)|*.cube") + fname2 = Dialog.save_panel("Cube file name for beta MO #{n}", dir, basename + "_#{n}b.cube", "Gaussian cube file (*.cube)|*.cube") end filenames.push([n, fname1, fname2]) } -- 2.11.0