GitBucket
Pull requests
Issues
Snippets
Sign in
s18h024
/
Open babel 計算式 プログラム
Fork
0
Created at Mon Jul 26 16:20:06 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 26 Jul 2021
2db14ee
Open babel 計算式 プログラム
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)