def ascii_file(self, fname='spectrum.dat'): wf = lib_file.wfile(fname) wt = lib_file.asciitable(ncol=3) for i, en in enumerate(self.en): wt.add_row([en, self.spec[i], self.lam[i]]) wf.write(wt.ret_table()) wf.post(lvprt=1)
def run(): print('jmol_MOs.py [<mldfile> [<mldfile2> ...]]\n') mldfiles = sys.argv[1:] if len(mldfiles) == 0: print("No file specified, generating generic script") mldfiles = [''] pref = '' elif len(mldfiles) == 1: print("Analyzing the file:", mldfiles[0]) pref = mldfiles[0] + '.' else: print("Analyzing the files:", mldfiles) pref = 'multi.' jopt = jmol_options('jmol.in') jopt.jmol_input() jo = lib_file.wfile('%sjmol_orbitals.spt'%pref) ho = lib_file.htmlfile('%sorbitals.html'%pref) lo = lib_file.latexfile('%sorbitals.tex'%pref) ho.pre('Orbitals') lo.pre(None, graphicx=True) for mldfile in mldfiles: print('Analyzing %s ...\n'%mldfile) if jopt['spec'] == 'sten': moc = mocoll(jopt['st_ind'], jopt['en_ind'], mldfile) elif jopt['spec'] == 'frontier': moc = mocollf(jopt['en_ind'], mldfile) elif jopt['spec'] == 'occ': moc = mocoll_occ(jopt['occmin'], jopt['occmax'], mldfile) else: raise error_handler.ElseError(self['spec'], 'spec') moout = mo_output_jmol(moc, jopt) moout.output(jo) moh = mo_output_html(moc, jopt) moh.output(ho) mol = mo_output_tex(moc, jopt) mol.output(lo) jo.post(lvprt=1) if mldfiles == [""]: print(" -> Open the Molden-file in jmol and execute the commands contained in this file.") else: print(" -> Now simply run \"jmol -n %s\" to plot all the orbitals.\n"%jo.name) ho.post(lvprt=1) print(" -> View in browser.") lo.post(lvprt=1) print(" -> Compile with pdflatex (or adjust first).")