Skip to content

Commit

Permalink
Fixed solvent issue, reverted softer verification but added the optio…
Browse files Browse the repository at this point in the history
…n to bypass verifications
  • Loading branch information
RaphaelRobidas committed Dec 13, 2022
1 parent d75a79e commit dc6133c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
7 changes: 4 additions & 3 deletions ccinput/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,11 @@ def __init__(
custom_basis_sets="",
d3=False,
d3bj=False,
trust_me=False,
**kwargs,
):

self.solvent = get_abs_solvent(solvent)
self.solvent = get_abs_solvent(solvent, trust_me=trust_me)
if self.solvent != "":
self.solvation_model = solvation_model.lower()
self.solvation_radii = solvation_radii.lower()
Expand Down Expand Up @@ -229,7 +230,7 @@ def __init__(
self.theory_level = get_theory_level(self.method)

if self.theory_level not in ["semiempirical", "xtb", "special"]:
self.basis_set = get_abs_basis_set(basis_set)
self.basis_set = get_abs_basis_set(basis_set, trust_me=trust_me)
else:
self.basis_set = ""

Expand Down Expand Up @@ -278,7 +279,7 @@ def __init__(
if bs_index in BASIS_SET_EXCHANGE_KEY:
bs_keyword = BASIS_SET_EXCHANGE_KEY[bs_index]
else:
bs_keyword = get_abs_basis_set(bs_str)
bs_keyword = get_abs_basis_set(bs_str, trust_me=trust_me)

dict_cbs[el] = bs_keyword

Expand Down
2 changes: 1 addition & 1 deletion ccinput/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,7 @@ class CalcType(Enum):
"benzene": "benzene",
"carbontetrachloride": "ccl4",
"dichloromethane": "ch2cl2",
"dichloroethane": "1,2-dichloroethane",
"chloroform": "chloroform",
"cyclohexane": "cyclohexane",
"dimethylformamide": "dmf",
Expand All @@ -2240,7 +2241,6 @@ class CalcType(Enum):
"112trichloroethane": "1,1,2-trichloroethane",
"124trimethylbenzene": "1,2,4-trimethylbenzene",
"12dibromoethane": "1,2-dibromoethane",
"12dichloroethane": "1,2-dichloroethane",
"12ethanediol": "1,2-ethanediol",
"14dioxane": "1,4-dioxane",
"1bromo2methylpropane": "1-bromo-2-methylpropane",
Expand Down
27 changes: 19 additions & 8 deletions ccinput/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,20 @@ def get_abs_software(software):
raise InvalidParameter(f"Unknown software package: '{software}'")


def get_abs_method(method):
def get_abs_method(method, trust_me=False):
_method = indexify(method)
for m in SYN_METHODS:
if _method in SYN_METHODS[m] or _method == m:
return m
raise InvalidParameter(f"Unknown method: '{method}'")

if trust_me:
warn(f"Using unknown method '{method}'")
return m
else:
raise InvalidParameter(f"Unknown method: '{method}'")


def get_abs_basis_set(basis_set):
def get_abs_basis_set(basis_set, trust_me=False):
_bs = indexify(basis_set)

for bs in SYN_BASIS_SETS:
Expand All @@ -216,19 +221,25 @@ def get_abs_basis_set(basis_set):
for bs in BASIS_SET_EXCHANGE_KEY:
if _bs.lower() == bs:
return bs

raise InvalidParameter(f"Unknown basis set: '{basis_set}'")
if trust_me:
warn(f"Using unknown basis set '{bs}'")
return bs
else:
raise InvalidParameter(f"Unknown basis set: '{basis_set}'")


def get_abs_solvent(solvent):
def get_abs_solvent(solvent, trust_me=False):
_solvent = indexify(solvent)
if _solvent in ["", "vacuum", "vac"]:
return ""
for solv in SYN_SOLVENTS:
if _solvent in SYN_SOLVENTS[solv] or _solvent == solv:
return solv
warn(f"Unknown solvent: '{solvent}'")
return solv
if trust_me:
warn(f"Using unknown solvent '{solvent}'")
return solvent
else:
raise InvalidParameter(f"Unknown solvent: '{solvent}'")


def is_exchange_correlation_combination(method):
Expand Down
9 changes: 9 additions & 0 deletions ccinput/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def generate_calculation(
header="File created by ccinput",
file=None,
driver="none",
trust_me=False,
**kwargs,
):

Expand Down Expand Up @@ -117,6 +118,7 @@ def generate_calculation(
custom_basis_sets,
d3,
d3bj,
trust_me,
**kwargs,
)

Expand Down Expand Up @@ -355,6 +357,12 @@ def get_parser():
help="Use filenames to assign the charge and multiplicity",
)

parser.add_argument(
"--trust_me",
action="store_true",
help="Unknown values will be accepted as given",
)

dispersion_group = parser.add_mutually_exclusive_group()

dispersion_group.add_argument(
Expand Down Expand Up @@ -524,6 +532,7 @@ def get_input_from_args(args, default_params=None):
"charge": args.charge,
"multiplicity": args.mult,
"parse_name": args.parse_name,
"trust_me": args.trust_me,
"d3": args.d3,
"d3bj": args.d3bj,
"aux_name": args.aux_name,
Expand Down

0 comments on commit dc6133c

Please sign in to comment.