mirror of
https://github.com/LCPQ/EMSL_Basis_Set_Exchange_Local
synced 2024-10-31 19:23:42 +01:00
Doc
This commit is contained in:
parent
6d84205ef2
commit
cfb4759273
@ -5,7 +5,6 @@ import time
|
||||
import sqlite3
|
||||
|
||||
from collections import OrderedDict
|
||||
from src.parser_handler import format_dict
|
||||
|
||||
|
||||
def install_with_pip(name):
|
||||
@ -40,21 +39,11 @@ class EMSL_dump:
|
||||
|
||||
def __init__(self, db_path=None, format="GAMESS-US", contraction="True"):
|
||||
|
||||
if format not in format_dict:
|
||||
print >> sys.stderr, "Format {0} doesn't exist. Choose in:".format(
|
||||
format)
|
||||
print >> sys.stderr, format_dict.keys()
|
||||
sys.exit(1)
|
||||
else:
|
||||
self.format = format
|
||||
from src.parser_handler import get_parser_function
|
||||
from src.parser_handler import check_format
|
||||
|
||||
if format_dict[self.format]:
|
||||
self.parser = format_dict[self.format]
|
||||
else:
|
||||
print >> sys.stderr, "We have no parser for this format"
|
||||
print >> sys.stderr, "Fill free to Fock /pull request"
|
||||
print >> sys.stderr, "You just need to add a function like"
|
||||
print >> sys.stderr, "'parse_basis_data_gamess_us' to parse you'r format"
|
||||
self.format = check_format(format)
|
||||
self.parser = get_parser_function(self.format)
|
||||
|
||||
if db_path:
|
||||
self.db_path = db_path
|
||||
@ -75,7 +64,8 @@ class EMSL_dump:
|
||||
|
||||
def get_list_format(self):
|
||||
"""List all the format available in EMSL"""
|
||||
return format_dict
|
||||
from src.parser_handler import parser_dict
|
||||
return parser_dict.keys()
|
||||
|
||||
def set_db_path(self, path):
|
||||
"""Define the database path"""
|
||||
|
@ -29,8 +29,9 @@ from src.parser.gaussian94 import parse_basis_data_gaussian94
|
||||
from src.parser.nwchem import parse_basis_data_nwchem
|
||||
|
||||
|
||||
format_dict = {"Gaussian94": parse_basis_data_gaussian94,
|
||||
parser_dict = {"Gaussian94": parse_basis_data_gaussian94,
|
||||
"GAMESS-US": parse_basis_data_gamess_us,
|
||||
"NWChem": parse_basis_data_nwchem,
|
||||
"GAMESS-UK": None,
|
||||
"Turbomole": None,
|
||||
"TX93": None,
|
||||
@ -43,8 +44,34 @@ format_dict = {"Gaussian94": parse_basis_data_gaussian94,
|
||||
"Dalton": None,
|
||||
"deMon-KS": None,
|
||||
"deMon2k": None,
|
||||
"AcesII": None,
|
||||
"NWChem": parse_basis_data_nwchem}
|
||||
"AcesII": None}
|
||||
|
||||
|
||||
def check_format(format):
|
||||
try:
|
||||
parser_dict[format]
|
||||
except KeyError:
|
||||
str_ = ["This format ({0}) is not available in EMSL".format(format),
|
||||
"EMSL provide this list : {0}".format(parser_dict.keys())]
|
||||
print >> sys.stderr, "\n".join(str_)
|
||||
sys.exit(1)
|
||||
else:
|
||||
return format
|
||||
|
||||
|
||||
def get_parser_function(format):
|
||||
if not parser_dict[format]:
|
||||
list_parser = [k for k, v in parser_dict.iteritems() if v]
|
||||
|
||||
str_ = ["We have no parser for this format {0}".format(format),
|
||||
"We only support {0}".format(list_parser),
|
||||
"Fill free to Fock /pull request",
|
||||
"You just need to add a function like this one:",
|
||||
"'src.pars.gamess_us.parse_basis_data_gamess_us'"]
|
||||
print >> sys.stderr, "\n".join(str_)
|
||||
sys.exit(1)
|
||||
else:
|
||||
return parser_dict[format]
|
||||
|
||||
# _____ _ _ _ _
|
||||
# / ___| | | | (_) | |
|
||||
@ -78,6 +105,7 @@ def get_symmetry_function(format):
|
||||
print >> sys.stderr, "You need to add a function in symmetry_dict"
|
||||
print >> sys.stderr, "for your format ({0})".format(format)
|
||||
sys.exit(1)
|
||||
else:
|
||||
return f
|
||||
|
||||
# _ _ _ _ _ _ _ _ _ ______ _ _
|
||||
@ -106,4 +134,5 @@ def get_handle_l_function(format):
|
||||
print >> sys.stderr, "You need to add a function in handle_l_dict"
|
||||
print >> sys.stderr, "for your format ({0})".format(format)
|
||||
sys.exit(1)
|
||||
else:
|
||||
return f
|
||||
|
Loading…
Reference in New Issue
Block a user