mirror of
https://github.com/LCPQ/EMSL_Basis_Set_Exchange_Local
synced 2024-09-01 08:53:39 +02:00
Delete check_validation
This commit is contained in:
parent
4660f56711
commit
7ce8bfcbca
@ -251,6 +251,12 @@ class EMSL_local(object):
|
|||||||
handle_l_format=False, check_format=None):
|
handle_l_format=False, check_format=None):
|
||||||
"""
|
"""
|
||||||
Return the data from the basis set
|
Return the data from the basis set
|
||||||
|
basis_name : The value of 'name'raw from output_tab in the SQL database
|
||||||
|
elts : List of element avalaible in 'elt'raw
|
||||||
|
handle_l_format : If you want to use special treatement for SP function
|
||||||
|
(see src.parser_handler.get_handle_l_function)
|
||||||
|
check_format : If you want to verify some condition for special program
|
||||||
|
(see src.parser.check_validity)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# ~#~#~#~#~#~ #
|
# ~#~#~#~#~#~ #
|
||||||
@ -281,7 +287,7 @@ class EMSL_local(object):
|
|||||||
if check_format:
|
if check_format:
|
||||||
|
|
||||||
from src.parser_handler import get_symmetry_function
|
from src.parser_handler import get_symmetry_function
|
||||||
from src.parser.check_validity import get_check_function
|
from src.parser_handler import get_check_function
|
||||||
|
|
||||||
f = get_check_function(check_format)
|
f = get_check_function(check_format)
|
||||||
f_symmetry = get_symmetry_function(self.format)
|
f_symmetry = get_symmetry_function(self.format)
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
# _
|
|
||||||
# / |_ _ _ | _. | o _| o _|_
|
|
||||||
# \_ | | (/_ (_ |< \/ (_| | | (_| | |_ \/
|
|
||||||
# /
|
|
||||||
# Do this After the L special case traitement.
|
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def check_gamess(str_type):
|
|
||||||
"""Check is the orbital type is handle by gamess"""
|
|
||||||
|
|
||||||
assert len(str_type) == 1
|
|
||||||
|
|
||||||
if str_type in "S P D".split():
|
|
||||||
return True
|
|
||||||
elif str_type == "SP":
|
|
||||||
raise BaseException
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def check_NWChem(str_type):
|
|
||||||
"""Check is the orbital type is handle by gamess"""
|
|
||||||
|
|
||||||
assert len(str_type) == 1
|
|
||||||
|
|
||||||
if str_type in "S P D".split():
|
|
||||||
return True
|
|
||||||
elif str_type > "I" or str_type in "K L M".split():
|
|
||||||
raise BaseException
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
d_check = {"GAMESS-US": check_gamess,
|
|
||||||
"NWChem": check_NWChem}
|
|
||||||
|
|
||||||
|
|
||||||
def get_check_function(name_program):
|
|
||||||
"""
|
|
||||||
Tranforme SP special function (create using get_symmetry_function)
|
|
||||||
into S and P
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
f = d_check[name_program]
|
|
||||||
except KeyError:
|
|
||||||
str_ = "You need to add a check funtion for your program {0}"
|
|
||||||
print >> sys.stderr, str_.format(name_program)
|
|
||||||
print >> sys.stderr, "This one are avalaible {0}".format(d_check.keys())
|
|
||||||
sys.exit(1)
|
|
||||||
return f
|
|
@ -136,3 +136,16 @@ def handle_l_gamess_us(l_atom_basis):
|
|||||||
l_data.append("\n".join(l_line))
|
l_data.append("\n".join(l_line))
|
||||||
|
|
||||||
return l_data
|
return l_data
|
||||||
|
|
||||||
|
|
||||||
|
def check_gamess(str_type):
|
||||||
|
"""Check is the orbital type is handle by gamess"""
|
||||||
|
|
||||||
|
assert len(str_type) == 1
|
||||||
|
|
||||||
|
if str_type in "S P D".split():
|
||||||
|
return True
|
||||||
|
elif str_type == "SP":
|
||||||
|
raise BaseException
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
@ -226,3 +226,16 @@ def parse_basis_data_nwchem(data, name, description, elements, debug=True):
|
|||||||
serialized = json.dumps(chunk)
|
serialized = json.dumps(chunk)
|
||||||
pairs.append([symbol, serialized])
|
pairs.append([symbol, serialized])
|
||||||
return [name, description, pairs]
|
return [name, description, pairs]
|
||||||
|
|
||||||
|
|
||||||
|
def check_NWChem(str_type):
|
||||||
|
"""Check is the orbital type is handle by gamess"""
|
||||||
|
|
||||||
|
assert len(str_type) == 1
|
||||||
|
|
||||||
|
if str_type in "S P D".split():
|
||||||
|
return True
|
||||||
|
elif str_type > "I" or str_type in "K L M".split():
|
||||||
|
raise BaseException
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
@ -128,10 +128,38 @@ def get_handle_l_function(format):
|
|||||||
into S and P
|
into S and P
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
f = handle_l_dict[format]
|
return handle_l_dict[format]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print >> sys.stderr, "You need to add a function in handle_l_dict"
|
print >> sys.stderr, "You need to add a function in handle_l_dict"
|
||||||
print >> sys.stderr, "for your format ({0})".format(format)
|
print >> sys.stderr, "for your format ({0})".format(format)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
|
||||||
return f
|
|
||||||
|
# _ _ _ _ _ _ _
|
||||||
|
# | | | | | (_) | | | | (_)
|
||||||
|
# | | | | __ _| |_ __| | __ _| |_ _ ___ _ __
|
||||||
|
# | | | |/ _` | | |/ _` |/ _` | __| |/ _ \| '_ \
|
||||||
|
# \ \_/ / (_| | | | (_| | (_| | |_| | (_) | | | |
|
||||||
|
# \___/ \__,_|_|_|\__,_|\__,_|\__|_|\___/|_| |_|
|
||||||
|
#
|
||||||
|
from src.parser.gamess_us import check_gamess
|
||||||
|
from src.parser.nwchem import check_NWChem
|
||||||
|
|
||||||
|
d_check = {"GAMESS-US": check_gamess,
|
||||||
|
"NWChem": check_NWChem}
|
||||||
|
|
||||||
|
|
||||||
|
def get_check_function(name_program):
|
||||||
|
"""
|
||||||
|
Tranforme SP special function (create using get_symmetry_function)
|
||||||
|
into S and P
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
return d_check[name_program]
|
||||||
|
except KeyError:
|
||||||
|
str_ = "You need to add a check funtion for your program {0}"
|
||||||
|
print >> sys.stderr, str_.format(name_program)
|
||||||
|
print >> sys.stderr, "This one are avalaible {0}".format(
|
||||||
|
d_check.keys())
|
||||||
|
sys.exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user