Last active
September 27, 2015 11:42
-
-
Save jhjensen2/73f31260f0306e080fe9 to your computer and use it in GitHub Desktop.
This program finds the last heat of formation in all GAMESS log files for semiempirical geometry optimizations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
type "python read.py" to use | |
This program finds the last heat of formation in all GAMESS log files | |
for semiempirical geometry optimizations | |
""" | |
import string | |
from glob import glob | |
for filename in glob("/home/user/*.log"): | |
f = open(filename,'r') | |
while 1: | |
line = f.readline() # read a line from he file | |
if not line: break # if end-of-file: quit | |
words = string.split(line) # split line into words | |
if len(words) < 1: | |
continue | |
if words[0] == 'HEAT': | |
heat = words[-2] | |
print filename, heat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Apologies for the unrequested code review but some Python idioms that might help: