GitBucket
Pull requests
Issues
Snippets
Sign in
db2021
/
to gau.py
Fork
0
Created at Fri Oct 22 16:48:16 JST 2021
Download ZIP
HTTP
Embed
Embed this snippet in your website.
HTTP
Clone with Git using the repository's web address.
Code
Revision
Forks
s18h024
revised this
on 22 Oct 2021
57b7b09
to gau.py
import subprocess import os # try: # cmd=["mkdir","inserted"] # subprocess.run(cmd) # except: # print("file has registed.") path_="./babel/" files =os.listdir("./babel") files_file = [f for f in files if os.path.isfile(os.path.join("./babel", f))] print("-------list of element--------") print(files_file) for i in files_file: filename = path_ + i print(filename) try: with open(filename) as e: ary = e.readlines() try: ary.pop(1) except: None print(ary) with open(filename,"w") as d : d.writelines(ary) try: with open(filename) as f: line = f.readlines() line.insert(1,'#P B3LYP/6-31G** OPT FREQ IOP(3/24=10,6/7=3)\n') with open(filename,"w") as g: g.writelines(line) print("edited") except: print("Error.check source file.") except FileNotFoundError: print("Failed") # errorname = "./error log" # with open(errorname) as er: # errortext = filename + "is fail has the empty.\ncheck the source file." # er.write(errortext)