Mod:Hunt Research Group:simple freq script
Appearance
- Save the following as freq.py in your home/bin directory.
- Run by typing python freq.py [freq_file_name].log in the directory with your frequency log file.
- The output prints to the console with commas in between each value.
- filename, E, G, H, S, ZPE, low frequencies
#!/usr/bin/env python
import sys
#######################################################
f = open(str(sys.argv[1]), 'r')
enstring = 'SCF Done'
gstring = 'Sum of electronic and thermal Free Energies='
hstring = 'Sum of electronic and thermal Enthalpies='
zpestring = 'Zero-point correction='
freqstring = 'Low frequencies ---'
freqlist = []
for line in f:
if enstring in line:
enval = line[(len(enstring)+16):(len(enstring)+31)]
if gstring in line:
gval = line[(len(gstring)+9):(len(gstring)+21)]
if hstring in line:
hval = line[(len(hstring)+12):(len(hstring)+24)]
if zpestring in line:
zpeval = line[(len(zpestring)+27):(len(zpestring)+36)]
newval=float(hval)-float(gval)
newval=str(round(newval,10))
f.close()
f = open(str(sys.argv[1]), 'r')
for line in f:
pos = line.find(freqstring)
if pos != -1:
freqval = line[(len(freqstring)+1):]
freqs = freqval.split()
freqlist = freqlist + freqs;
print sys.argv[1] + ',' + (enval) + ',' + (gval)+ ',' + (hval) + ',' + (newval) + ',' + (zpeval) + ',' + ','.join(freqlist)