+ mol = self
+ h = Dialog.run("Create MOPAC6 Input") {
+ layout(1,
+ item(:text, :title=>"MOPAC input"),
+ item(:textview, :width=>480, :height=>200, :tag=>"mopac_commands"),
+ layout(2,
+ item(:text, :title=>"Action: "),
+ item(:radio, :title=>"Save only", :tag=>"save_only", :value=>1),
+ -1,
+ item(:radio, :title=>"Save and Run MOPAC", :tag=>"save_and_run")
+ )
+ )
+ radio_group("save_only", "save_and_run")
+ item_with_tag("mopac_commands")[:value] = mol.create_mopac
+ }
+ # Record the command lines for next invocation
+ mop = h["mopac_commands"]
+ com = (mop.split(/[\r\n]/))[0..0].join("\n")
+ (@mopac_settings ||= Hash.new)["commands"] = com
+ if h[:status] == 0
+ basename = (self.path ? File.basename(self.path, ".*") : self.name)
+ fname = Dialog.save_panel("Export MOPAC input file:", self.dir, basename + ".mopin", "MOPAC input file (*.mopin)|*.mopin|All files|*.*")
+ return nil if !fname
+ open(fname, "w") { |fp|
+ fp.write(mop)
+ }
+ if h["save_and_run"] == 1
+ Molecule.execute_mopac(fname, self)
+ end
+ end
+
+ end
+
+# if lookup_menu("Create MOPAC6 Input...") < 0
+# register_menu("", "")
+# register_menu("Create MOPAC6 Input...", :cmd_create_mopac)
+# end
+
+end