Guest User

Untitled

a guest
May 26th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. #!/software/languages/python/2.5.2/gnu-4.2.4/bin/python
  2.  
  3. import sys,re,numpy
  4.  
  5. filename = sys.argv[1]
  6. energy = []
  7. rxcoord = []
  8. cols = {}
  9. cols[1] = "ENERGY"
  10. cols[2] = "RX.COORD"
  11. geoms = {}
  12.  
  13. try:
  14. inputfile = open(filename, "r")
  15. except:
  16. print ("file cannot be opened")
  17.  
  18. for line in inputfile:
  19. if "Summary of reaction path following:" in line:
  20. waste = inputfile.next()
  21. hyphens = inputfile.next()
  22. line = inputfile.next()
  23. while re.search("(ENERGY\s+|RX\.COORD\s+|[XYZ]\d+\s+)+",line):
  24. numCol = 0
  25. match = re.findall("ENERGY\s+|RX\.COORD\s+|[XYZ]\d+\s+",line)
  26. for col in match:
  27. numCol +=1
  28. col = col.strip(' \t\n\r')
  29. res = re.findall("([XYZ])(\d+)", col)
  30. for items in res:
  31. cols[numCol] = (items[0], items[1])
  32. line = inputfile.next()
  33. while re.search("\d+\s+([-|+]?\d+\.\d+\s+)+",line):
  34. broken = line.split()
  35. for i in range(1,numCol+1,1):
  36. if i == 1 and cols[i] == "ENERGY": energy.append(broken[i])
  37. if i == 2 and cols[i] == "RX.COORD": rxcoord.append(broken[i])
  38. if cols[i] != "ENERGY" and cols[i] != "RX.COORD":
  39. geoms[(broken[0],cols[i][0], cols[i][1])] = broken[i]
  40. try:
  41. line = inputfile.next()
  42. except:
  43. break
  44. cols = {}
  45.  
  46. noSteps = 0
  47. noAtoms = 0
  48. for each in geoms:
  49. print each[0], each[2]
  50. if each[0] > noSteps: noSteps = each[0]
  51. if each[2] > noAtoms: noAtoms = each[2]
  52. print "FINAL VALUES FOR noSteps AND noAtoms"
  53. print noSteps, noAtoms
Add Comment
Please, Sign In to add comment