Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/software/languages/python/2.5.2/gnu-4.2.4/bin/python
- import sys,re,numpy
- filename = sys.argv[1]
- energy = []
- rxcoord = []
- cols = {}
- cols[1] = "ENERGY"
- cols[2] = "RX.COORD"
- geoms = {}
- try:
- inputfile = open(filename, "r")
- except:
- print ("file cannot be opened")
- for line in inputfile:
- if "Summary of reaction path following:" in line:
- waste = inputfile.next()
- hyphens = inputfile.next()
- line = inputfile.next()
- while re.search("(ENERGY\s+|RX\.COORD\s+|[XYZ]\d+\s+)+",line):
- numCol = 0
- match = re.findall("ENERGY\s+|RX\.COORD\s+|[XYZ]\d+\s+",line)
- for col in match:
- numCol +=1
- col = col.strip(' \t\n\r')
- res = re.findall("([XYZ])(\d+)", col)
- for items in res:
- cols[numCol] = (items[0], items[1])
- line = inputfile.next()
- while re.search("\d+\s+([-|+]?\d+\.\d+\s+)+",line):
- broken = line.split()
- for i in range(1,numCol+1,1):
- if i == 1 and cols[i] == "ENERGY": energy.append(broken[i])
- if i == 2 and cols[i] == "RX.COORD": rxcoord.append(broken[i])
- if cols[i] != "ENERGY" and cols[i] != "RX.COORD":
- geoms[(broken[0],cols[i][0], cols[i][1])] = broken[i]
- try:
- line = inputfile.next()
- except:
- break
- cols = {}
- noSteps = 0
- noAtoms = 0
- for each in geoms:
- print each[0], each[2]
- if each[0] > noSteps: noSteps = each[0]
- if each[2] > noAtoms: noAtoms = each[2]
- print "FINAL VALUES FOR noSteps AND noAtoms"
- print noSteps, noAtoms
Add Comment
Please, Sign In to add comment