diff --git a/src/EMSL_dump.py b/src/EMSL_dump.py index ed1ed1e..184b6d5 100644 --- a/src/EMSL_dump.py +++ b/src/EMSL_dump.py @@ -42,7 +42,8 @@ class EMSL_dump: self.db_path = db_path if format not in format_dict: - print >> sys.stderr, "Format {0} doesn't exist. Choose in:".format(format) + print >> sys.stderr, "Format {0} doesn't exist. Choose in:".format( + format) print >> sys.stderr, format_dict.keys() sys.exit(1) else: @@ -152,8 +153,6 @@ class EMSL_dump: return d - - # _____ _ # / __ \ | | # | / \/_ __ ___ __ _| |_ ___ diff --git a/src/EMSL_local.py b/src/EMSL_local.py index 0230158..ffe85d0 100755 --- a/src/EMSL_local.py +++ b/src/EMSL_local.py @@ -348,7 +348,7 @@ class EMSL_local: print >> sys.stderr, handle_f_dict.keys() sys.exit(1) else: - l_atom_basis = f(l_atom_basis,self.get_list_symetry) + l_atom_basis = f(l_atom_basis, self.get_list_symetry) # ~#~#~#~#~ # # C h e c k # diff --git a/src/parser.py b/src/parser.py index df30312..4f98aeb 100644 --- a/src/parser.py +++ b/src/parser.py @@ -29,48 +29,48 @@ def get_dict_ele(): # \_| (_| | | | (/_ _> _> |_| _> # def parse_basis_data_gamess_us(data, name, des, elts, debug=False): - """Parse the basis data raw html of gamess-us to get a nice tuple - Return [name, description, [[ele, data_ele],...]]""" - basis_data = [] + """Parse the basis data raw html of gamess-us to get a nice tuple + Return [name, description, [[ele, data_ele],...]]""" + basis_data = [] - b = data.find("$DATA") - e = data.find("$END") - if (b == -1 or data.find("$DATA$END") != -1): - if debug: - print data - raise Exception("WARNING not DATA") - else: - dict_replace = {"PHOSPHOROUS": "PHOSPHORUS", - "D+": "E+", - "D-": "E-"} + b = data.find("$DATA") + e = data.find("$END") + if (b == -1 or data.find("$DATA$END") != -1): + if debug: + print data + raise Exception("WARNING not DATA") + else: + dict_replace = {"PHOSPHOROUS": "PHOSPHORUS", + "D+": "E+", + "D-": "E-"} - for k, v in dict_replace.iteritems(): - data = data.replace(k, v) + for k, v in dict_replace.iteritems(): + data = data.replace(k, v) - data = data[b + 5:e - 1].split('\n\n') + data = data[b + 5:e - 1].split('\n\n') - dict_ele = get_dict_ele() + dict_ele = get_dict_ele() - for (elt, data_elt) in zip(elts, data): + for (elt, data_elt) in zip(elts, data): - elt_long_th = dict_ele[elt.lower()] - elt_long_exp = data_elt.split()[0].lower() + elt_long_th = dict_ele[elt.lower()] + elt_long_exp = data_elt.split()[0].lower() - if "$" in data_elt: - if debug: - print "Eror", - raise Exception("WARNING bad split") + if "$" in data_elt: + if debug: + print "Eror", + raise Exception("WARNING bad split") - if elt_long_th == elt_long_exp: - basis_data.append([elt, data_elt.strip()]) - else: - if debug: - print "th", elt_long_th - print "exp", elt_long_exp - print "abv", elt - raise Exception("WARNING not a good ELEMENT") + if elt_long_th == elt_long_exp: + basis_data.append([elt, data_elt.strip()]) + else: + if debug: + print "th", elt_long_th + print "exp", elt_long_exp + print "abv", elt + raise Exception("WARNING not a good ELEMENT") - return [name, des, basis_data] + return [name, des, basis_data] import os @@ -90,70 +90,72 @@ format_dict = {"Gaussian94": None, "deMon2k": None, "AcesII": None} -# _ _ _ _ _ _ _ _ _ +# _ _ _ _ _ _ _ _ _ # | | | | | | | ( | ) | ( | ) -# | |_| | __ _ _ __ __| | | ___ V V| | V V -# | _ |/ _` | '_ \ / _` | |/ _ \ | | -# | | | | (_| | | | | (_| | | __/ | |____ -# \_| |_/\__,_|_| |_|\__,_|_|\___| \_____/ +# | |_| | __ _ _ __ __| | | ___ V V| | V V +# | _ |/ _` | '_ \ / _` | |/ _ \ | | +# | | | | (_| | | | | (_| | | __/ | |____ +# \_| |_/\__,_|_| |_|\__,_|_|\___| \_____/ # # + + def handle_f_gamess_us(l_atom_basis, list_symetry): - """ - Read l_atom_basis, if "L" orbital before "D" one, split them into S and P - """ + """ + Read l_atom_basis, if "L" orbital before "D" one, split them into S and P + """ - l_data = [] + l_data = [] - for atom_basis in l_atom_basis: + for atom_basis in l_atom_basis: - # Split the data in line - l_line_raw = atom_basis.split("\n") - l_line = [l_line_raw[0]] - # l_line_raw[0] containt the name of the Atom + # Split the data in line + l_line_raw = atom_basis.split("\n") + l_line = [l_line_raw[0]] + # l_line_raw[0] containt the name of the Atom - maybe_good_l = True + maybe_good_l = True - for symmetry, begin, end in list_symetry(l_line_raw): + for symmetry, begin, end in list_symetry(l_line_raw): - if maybe_good_l and symmetry in "L": + if maybe_good_l and symmetry in "L": - body_s = [] - body_p = [] + body_s = [] + body_p = [] - for i_l in l_line_raw[begin + 1:end]: + for i_l in l_line_raw[begin + 1:end]: - # one L => S & P - a = i_l.split() + # one L => S & P + a = i_l.split() - common = "{:>3}".format(a[0]) - common += "{:>15.7f}".format(float(a[1])) + common = "{:>3}".format(a[0]) + common += "{:>15.7f}".format(float(a[1])) - tail_s = common + "{:>23.7f}".format(float(a[2])) - body_s.append(tail_s) + tail_s = common + "{:>23.7f}".format(float(a[2])) + body_s.append(tail_s) - # Maybe only One coefficient for L function - # I guess it mean S and L are equal - try: - tail_p = common + "{:>23.7f}".format(float(a[3])) - except IndexError: - tail_p = tail_s - finally: - body_p.append(tail_p) + # Maybe only One coefficient for L function + # I guess it mean S and L are equal + try: + tail_p = common + "{:>23.7f}".format(float(a[3])) + except IndexError: + tail_p = tail_s + finally: + body_p.append(tail_p) - l_line += [l_line_raw[begin].replace("L", "S")] - l_line += body_s + l_line += [l_line_raw[begin].replace("L", "S")] + l_line += body_s - l_line += [l_line_raw[begin].replace("L", "P")] - l_line += body_p - else: - l_line += l_line_raw[begin:end] + l_line += [l_line_raw[begin].replace("L", "P")] + l_line += body_p + else: + l_line += l_line_raw[begin:end] - if symmetry not in ["S", "P", "L"]: - maybe_good_l = False + if symmetry not in ["S", "P", "L"]: + maybe_good_l = False - l_data.append("\n".join(l_line)) + l_data.append("\n".join(l_line)) - return l_data + return l_data handle_f_dict = {"GAMESS-US": handle_f_gamess_us}