import os,sys
def treatGeo(geoName):
tc=''
electronicEnergies=[]
ttl=geoName
xyz=''
print(ttl)
print('LOG File Missing.')
print('')
return
with open(geoName+'.log') as f:
for line in f:
if 'Thermal correction to Gibbs Free Energy=' in line:
tc=line.replace('Thermal correction to Gibbs Free Energy=','').strip()
break
for postfix in ['_NoS.log','_ether.log','_PBE0.log']:
print('SP File Missing.')
print('')
return
with open(geoName+postfix) as f:
f=f.readlines()
for i in range(len(list(f))):
line=list(f)[-i]
if 'SCF Done' in line:
firstindex=line.index('=')
lastindex=line.upper().index('A.U.')
sp=line[firstindex:lastindex].strip()
electronicEnergies.append(sp)
break
with open(geoName+'!.gjf') as f:
flag=-416
for line in f:
if flag==1:
if 'Title Card Required' in line:
flag=0
if line.strip()=='':
flag+=1
#print('')
numImg=0
if 'TS' in geoName:
numImg=1
print('Imaginary frequency: '+str(numImg))
print('Thermodynamic correlation: '+tc)
print('Electronic Energy at M05-2X/BS1: '+electronicEnergies[0])
print('Electronic Energy at M05-2X/BS1 with implicit solvation: '+electronicEnergies[1])
print('Electronic Energy at PBE0-D3BJ/BS2: '+electronicEnergies[2])
print('')
for f in os.listdir('.'):
if '!' in f:
geoName=f.replace('!.gjf','')
treatGeo(geoName)
配合Rita的自动生成单点能gjf文件的程序Gjfenerator使用。Gjfenerator带来的使用习惯是每一个结构优化完后生成一个filename!.gjf用于储存构型,单点能文件以形如filename_NoS.gjf的格式存储。运行上述Python脚本即可自动提取SI的所需信息,不过仍然要手动修改几千个结构的标题。
领取专属 10元无门槛券
私享最新 技术干货