10
0
mirror of https://github.com/LCPQ/EMSL_Basis_Set_Exchange_Local synced 2024-11-01 03:33:46 +01:00
This commit is contained in:
Thomas Applencourt 2015-03-16 15:47:44 +01:00
parent a773c4ed06
commit a7dba23654
3 changed files with 82 additions and 81 deletions

View File

@ -42,7 +42,8 @@ class EMSL_dump:
self.db_path = db_path self.db_path = db_path
if format not in format_dict: 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() print >> sys.stderr, format_dict.keys()
sys.exit(1) sys.exit(1)
else: else:
@ -152,8 +153,6 @@ class EMSL_dump:
return d return d
# _____ _ # _____ _
# / __ \ | | # / __ \ | |
# | / \/_ __ ___ __ _| |_ ___ # | / \/_ __ ___ __ _| |_ ___

View File

@ -348,7 +348,7 @@ class EMSL_local:
print >> sys.stderr, handle_f_dict.keys() print >> sys.stderr, handle_f_dict.keys()
sys.exit(1) sys.exit(1)
else: 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 # # C h e c k #

View File

@ -29,48 +29,48 @@ def get_dict_ele():
# \_| (_| | | | (/_ _> _> |_| _> # \_| (_| | | | (/_ _> _> |_| _>
# #
def parse_basis_data_gamess_us(data, name, des, elts, debug=False): 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 """Parse the basis data raw html of gamess-us to get a nice tuple
Return [name, description, [[ele, data_ele],...]]""" Return [name, description, [[ele, data_ele],...]]"""
basis_data = [] basis_data = []
b = data.find("$DATA") b = data.find("$DATA")
e = data.find("$END") e = data.find("$END")
if (b == -1 or data.find("$DATA$END") != -1): if (b == -1 or data.find("$DATA$END") != -1):
if debug: if debug:
print data print data
raise Exception("WARNING not DATA") raise Exception("WARNING not DATA")
else: else:
dict_replace = {"PHOSPHOROUS": "PHOSPHORUS", dict_replace = {"PHOSPHOROUS": "PHOSPHORUS",
"D+": "E+", "D+": "E+",
"D-": "E-"} "D-": "E-"}
for k, v in dict_replace.iteritems(): for k, v in dict_replace.iteritems():
data = data.replace(k, v) 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_th = dict_ele[elt.lower()]
elt_long_exp = data_elt.split()[0].lower() elt_long_exp = data_elt.split()[0].lower()
if "$" in data_elt: if "$" in data_elt:
if debug: if debug:
print "Eror", print "Eror",
raise Exception("WARNING bad split") raise Exception("WARNING bad split")
if elt_long_th == elt_long_exp: if elt_long_th == elt_long_exp:
basis_data.append([elt, data_elt.strip()]) basis_data.append([elt, data_elt.strip()])
else: else:
if debug: if debug:
print "th", elt_long_th print "th", elt_long_th
print "exp", elt_long_exp print "exp", elt_long_exp
print "abv", elt print "abv", elt
raise Exception("WARNING not a good ELEMENT") raise Exception("WARNING not a good ELEMENT")
return [name, des, basis_data] return [name, des, basis_data]
import os import os
@ -98,62 +98,64 @@ format_dict = {"Gaussian94": None,
# \_| |_/\__,_|_| |_|\__,_|_|\___| \_____/ # \_| |_/\__,_|_| |_|\__,_|_|\___| \_____/
# #
# #
def handle_f_gamess_us(l_atom_basis, list_symetry): 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 # Split the data in line
l_line_raw = atom_basis.split("\n") l_line_raw = atom_basis.split("\n")
l_line = [l_line_raw[0]] l_line = [l_line_raw[0]]
# l_line_raw[0] containt the name of the Atom # 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_s = []
body_p = [] 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 # one L => S & P
a = i_l.split() a = i_l.split()
common = "{:>3}".format(a[0]) common = "{:>3}".format(a[0])
common += "{:>15.7f}".format(float(a[1])) common += "{:>15.7f}".format(float(a[1]))
tail_s = common + "{:>23.7f}".format(float(a[2])) tail_s = common + "{:>23.7f}".format(float(a[2]))
body_s.append(tail_s) body_s.append(tail_s)
# Maybe only One coefficient for L function # Maybe only One coefficient for L function
# I guess it mean S and L are equal # I guess it mean S and L are equal
try: try:
tail_p = common + "{:>23.7f}".format(float(a[3])) tail_p = common + "{:>23.7f}".format(float(a[3]))
except IndexError: except IndexError:
tail_p = tail_s tail_p = tail_s
finally: finally:
body_p.append(tail_p) body_p.append(tail_p)
l_line += [l_line_raw[begin].replace("L", "S")] l_line += [l_line_raw[begin].replace("L", "S")]
l_line += body_s l_line += body_s
l_line += [l_line_raw[begin].replace("L", "P")] l_line += [l_line_raw[begin].replace("L", "P")]
l_line += body_p l_line += body_p
else: else:
l_line += l_line_raw[begin:end] l_line += l_line_raw[begin:end]
if symmetry not in ["S", "P", "L"]: if symmetry not in ["S", "P", "L"]:
maybe_good_l = False 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} handle_f_dict = {"GAMESS-US": handle_f_gamess_us}