def psi_log(path, File, spec): import os from general import eof err = False ext = False stat = False # CHECK FOR RAIJIN WALLTIME EXCEEDED err, ext, stat = rjn_wall(path, File, err, ext, stat) if not ext: # LINES AT END OF FILE lines = eof(path, File, 0.1) #for line in lines: if '4 exiting successfully' in lines[len(lines) - 1]: stat = 7 ext = '_eGeom' #break # COMMON ERRORS if not ext: stat = 10 err = 'unk' ext = '_unknown' return err, ext, stat
def gms_log(path, File, spec): import os from general import eof from pprint import stat_print err = False ext = False stat = False # CHECK FOR RAIJIN WALLTIME EXCEEDED err, ext, stat = rjn_wall(path, File, err, ext, stat) # IF NOT WALLTIME EXCEEDED if not ext: # LINES AT END OF FILE lines = eof(path, File, 0.2) for line in lines: if "CHECK YOUR INPUT CHARGE AND MULT" in line: stat = 8 err = 'inp' ext = '_inpError' break elif "ERROR READING VARIABLE IDUM" in line: stat = 9 err = 'inp' ext = '_inpError' break elif "FAILURE TO LOCATE STATIONARY" in line: stat = 4 err = 'max' ext = '_maxIters' break elif "DDI Process" in line: stat = 10 err = 'mem' ext = '_memError' break elif "CORRUPTION OF THE HESSIAN" in line: stat = 17 err = 'hes' ext = '_hesError' break elif "DUE TO TIME LIMIT" in line: stat = 11 err = 'time' ext = '_timeLimit' elif "ION OF GAMESS TERMINATED NORMA" in line: stat = 7 ext = '_eGeom' break if not ext: stat = 10 err = 'unk' ext = '_unknown' return err, ext, stat
def energy_psi(path, File, energy): from logFile import psi_log from general import psi_check_spec from general import eof HF = '' ZP = '' MP2 = '' MP2_opp = '' MP2_same = '' sysDict = {} spec = psi_check_spec(path, File) err, ext, stat = psi_log(path, File, spec) if spec: typ = 'spe' else: typ = 'opt' if not err: lines = eof(path, File, 0.1) for line in lines: if "Total Energy =" in line: MP2 = line.split() MP2 = MP2[len(MP2) - 2] elif 'Reference Energy' in line: HF = line.split() HF = HF[len(HF) - 2] elif "Same-Spin Energy =" in line: MP2_same = line.split() MP2_same = MP2_same[len(MP2_same) - 2] elif "Opposite-Spin Energy =" in line: MP2_opp = line.split() MP2_opp = MP2_opp[len(MP2_opp) - 2] # FINDING ZP NOT INCLUDED # CREATE DICTIONARY OF FILE sysDict["Path"] = path sysDict["File"] = File sysDict["Type"] = typ sysDict["HF" ] = HF sysDict["ZP" ] = ZP sysDict["MP2" ] = MP2 sysDict["MP2_same"] = MP2_same sysDict["MP2_opp"] = MP2_opp energy.append(sysDict) return energy
def g09_log(path, File, spec): import os, re from general import eof err = False ext = False stat = False # CHECK FOR RAIJIN WALLTIME EXCEEDED err, ext, stat = rjn_wall(path, File, err, ext, stat) # IF NOT WALLTIME EXCEEDED if not ext: # LINES AT END OF FILE lines = eof(path, File, 0.3) for line in lines: if 'Normal termination' in line: stat = 7 ext = '_eGeom' break # COMMON ERRORS if "Erroneous write" in line: stat = 13 err = 'mem' ext = '_diskError' break elif "link 9999" in line: stat = 14 err = 'conv' ext = '_convError' break elif "NtrErr" in line: stat = 13 err = 'mem' ext = '_diskError' break elif "Convergence fail" in line: stat = 14 err = 'conv' ext = '_convError' break elif "NtrErr Called from FileIO" in line: stat = 14 err = 'conv' ext = '_convError' break elif "galloc" in line or "GetChg" in line: stat = 10 err = 'mem' ext = '_memError' break elif "Out-of-memory" in line: stat = 10 err = 'mem' ext = '_memError' break if not ext: stat = 12 err = 'unk' ext = '_unknown' return err, ext, stat
def g09_geom(path, File, opt): import os, re from general import eof from chemData import pTable ginc = False vals = False end = False coords = [] geom = [] hold = [] pattern = "-?[0-9]*\.[0-9]*\s*" lines = eof(path, File, 0.4) # GRAB GINC VALUES if opt: for line in lines: if re.search("GINC", line): # FINDS LAST CASE OF 'GINC' coords = [] ginc = True if ginc: coords.append(line) j = '' # FOR ALL LINES for i in coords: # SUM ALL LINES TOGETHER AS CONTINUOUR STRING j = j + i j = j.replace('\n', '') j = j.replace(' ', '') j = j.split('\\') # AND OPT GEOM geom = [] pat = ",-?[0-9]*\.[0-9]*" for line in j: if re.search("^[A-Z]{1,2},?[a-z]?[0-9]*" + \ pat + pat + pat + "$", line): line = line.split(',') # SOMETIMES AN EXTRA COLUMN RETRIEVED? geom.append([line[0], line[len(line) - 3],\ line[len(line) - 2], line[len(line) - 1]]) # FIND SECOND LAST STEP; LAST MAY NOT BE FINISHED else: with open(path + File, 'r+') as f: try: for line in f: if vals: if end: if re.search("------------*", line): vals = False if re.search(pattern + pattern + pattern, line): hold.append(line) end = True if "Coordinates" in line: vals = True end = False coords = hold hold = [] except: print("Corrupt line passed in file ", File) hold = [] for i in coords: i = i.split() hold.append([i[1], i[3], i[4], i[5]]) for i in hold: for el, data in pTable.items(): if data[0] == int(i[0]): geom.append([el, i[1], i[2], i[3]]) break return geom
def energy_g09(path, File, energy): import re from logFile import g09_log from general import g09_check_spec from general import eof HF = '' ZP = '' MP2 = '' sysDict = {} spec = g09_check_spec(path, File) err, ext, stat = g09_log(path, File, spec) if spec: typ = 'spe' else: typ = 'opt' coords = [] if not err: lines = eof(path, File, 0.1) ginc = False for line in lines: if re.search("GINC", line): # FINDS LAST CASE OF 'GINC' ginc = True if ginc: coords.append(line) if not coords: lines = eof(path, File, 0.4) for line in lines: if re.search("GINC", line): # FINDS LAST CASE OF 'GINC' ginc = True if ginc: coords.append(line) j = '' # FOR ALL LINES for i in coords: # SUM ALL LINES TOGETHER AS CONTINUOUS STRING j = j + i j = j.replace('\n', '') j = j.replace(' ','') j = j.split('\\') # FIND HF AND ZPVE for line in j: if 'HF=' in line: HF = line.split('=') HF = HF[1] pass if 'ZeroPoint' in line: ZP = line.split('=') ZP = line.split('=') ZP = ZP[1] if 'MP2' in line: MP2 = line.split('=') MP2 = MP2[1] # CREATE DICTIONARY OF FILE sysDict["Path"] = path sysDict["File"] = File sysDict["Type"] = typ sysDict["HF" ] = HF sysDict["ZP" ] = ZP sysDict["MP2" ] = MP2 ### A bit hacky sysDict["MP2_opp"] = '' sysDict["MP2_same"] = '' energy.append(sysDict) return energy
def energy_gms(path, File, energy): from logFile import gms_log from general import gms_check_spec from general import eof spec = gms_check_spec(path, File) err, ext, stat = gms_log(path, File, spec) scs = False HF = '' ZP = '' MP2 = '' sysDict = {} if spec: typ = 'spe' else: typ = 'opt' if not err: # CHECK IF FMO fmo = False with open(path + File) as f: for line in f: if 'FMO' in line: fmo = True elif 'SCSOPO' in line: scs = True elif 'THE POINT GROUP OF THE M' in line: break lines = eof(path, File, 0.2) if scs: for line in lines: if "E corr SCS" in line: MP2 = line.split() MP2 = MP2[len(MP2) - 1] elif 'Euncorr HF' in line: HF = line.split() HF = HF[len(HF) - 1] if fmo and HF == '': for line in lines: if "Ecorr" in line: MP2 = line.split() MP2 = MP2[len(MP2) - 1] elif 'Euncorr' in line: HF = line.split() HF = HF[len(HF) - 1] if not fmo: for line in lines: if "SCS-MP2" in line: MP2 = line.split() if 'E=' not in MP2[1]: MP2 = MP2[1] # E(MP2)= -76.2919350192 ACTUALLY, THIS IS THE SCS-MP2 ENERGY else: # SCS-MP2 E= -1161.8759377385 (magnus, massive) MP2 = MP2[-1] elif 'E(0)=' in line: HF = line.split() HF = HF[len(HF) - 1] # FINDING ZP NOT INCLUDED # CREATE DICTIONARY OF FILE sysDict["Path"] = path sysDict["File"] = File sysDict["Type"] = typ sysDict["HF" ] = HF sysDict["ZP" ] = ZP sysDict["MP2" ] = MP2 ### A bit hacky sysDict["MP2_opp"] = '' sysDict["MP2_same"] = '' energy.append(sysDict) return energy