量子化学計算ソフトGaussianのエネルギーをエクセルに出力するプログラム
量子化学計算ソフトGaussian16のエネルギーをエクセルに出力するプログラム
ここではlogファイルに記載されているギブスの自由エネルギーをエクセルに出力させるプログラムを作ってみました。プログラミング初心者なためコードが雑になっていますがご了承を。
python3.6
import os
import glob
import openpyxl as px
os.chdir('C:\\')
#logファイル名の取得
a = glob.glob("*.log")
wb = px.Workbook()
ws = wb.active
#ファイル名をエクセルのA列に出力
j=1
for p in a:
name = os.path.splitext(os.path.basename(p))[0]
print(name)
name2 = name.split()
for i in name2:
ws.cell(row=j,column=1).value = name
j += 1
wb.save('C:\samp.xlsx')
#logファイルに書かれているギブスエネルギーの値をエクセルのB列に出力
j = 1
for i in a:
path = i
with open(path) as f:
lines = f.readlines()
lines_strip = [line.strip() for line in lines]
m = [line for line in lines_strip if 'Sum of electronic and thermal Free Energies' in line]
s = ''.join(m)
l = s.lstrip('Sum of electronic and thermal Free Energies= ')
print(l)
ws.cell(row=j,column=2).value = l
j += 1
wb.save('C:\samp.xlsx')
Author And Source
この問題について(量子化学計算ソフトGaussianのエネルギーをエクセルに出力するプログラム), 我々は、より多くの情報をここで見つけました https://qiita.com/your_dammy_21/items/a8426153e5e0aa55eec3著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .