Skip to content

Commit

Permalink
Added support for the xTB suite
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelRobidas committed Mar 20, 2022
1 parent 03b05b4 commit 9588bcb
Show file tree
Hide file tree
Showing 5 changed files with 903 additions and 6 deletions.
24 changes: 22 additions & 2 deletions ccinput/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,20 @@ def __init__(
parameters,
type,
constraints=[],
nproc=0,
mem=0,
nproc=1,
mem=1000,
charge=0,
multiplicity=1,
aux_name="calc2",
name="calc",
header="File created by ccinput",
software="",
file=None,
):
self.xyz = xyz
self.parameters = parameters
self.type = type
self.file = file

if software not in SYN_SOFTWARE:
raise InvalidParameter(f"Invalid software: '{software}'")
Expand Down Expand Up @@ -170,8 +172,11 @@ def __init__(
if method == "":
if "functional" in kwargs:
method = get_method(kwargs["functional"], self.software)
elif self.software == "xtb":
method = "GFN2-xTB"
else:
raise InvalidParameter("No calculation method specified (method='...')")

else:
self.method = get_method(method, self.software)

Expand Down Expand Up @@ -364,6 +369,21 @@ def to_gaussian(self):
else:
return f"{t} {ids_str} F\n"

def to_xtb(self):
ids_str = ", ".join(
[str(i) for i in self.ids] + ["auto"]
) # Maybe add support for other starting points in the future
type = len(self.ids)

if type == 2:
t = "distance"
elif type == 3:
t = "angle"
elif type == 4:
t = "dihedral"

return f"{t}: {ids_str}\n"


def parse_freeze_constraints(arr, xyz_str, software=""):
if len(arr) == 0:
Expand Down
13 changes: 12 additions & 1 deletion ccinput/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class CalcType(Enum):
UVVIS = 11
UVVIS_TDA = 12
MO = 13
CONF_SEARCH = 14
CONSTR_CONF_SEARCH = 15

OPTFREQ = 20

Expand All @@ -28,7 +30,7 @@ class CalcType(Enum):
ATOMIC_SYMBOL[el.number] = el.symbol
LOWERCASE_ATOMIC_SYMBOLS[el.symbol.lower()] = el.symbol

STR_TYPES = { # TODO: more synonyms
STR_TYPES = { # TODO: just strip spaces and symbols and compare
"sp": CalcType.SP,
"single-point": CalcType.SP,
"single point": CalcType.SP,
Expand Down Expand Up @@ -77,6 +79,14 @@ class CalcType(Enum):
"opt_freq": CalcType.OPTFREQ,
"opt-freq": CalcType.OPTFREQ,
"opt+freq": CalcType.OPTFREQ,
"conformer search": CalcType.CONF_SEARCH,
"conformational search": CalcType.CONF_SEARCH,
"conf search": CalcType.CONF_SEARCH,
"constrained conformer search": CalcType.CONSTR_CONF_SEARCH,
"constrained conformational search": CalcType.CONSTR_CONF_SEARCH,
"constr conformer search": CalcType.CONSTR_CONF_SEARCH,
"constr conformational search": CalcType.CONSTR_CONF_SEARCH,
"constr conf search": CalcType.CONSTR_CONF_SEARCH,
}

INV_STR_TYPES = {}
Expand Down Expand Up @@ -192,6 +202,7 @@ class CalcType(Enum):
SYN_SOFTWARE = {
"gaussian": ["g16", "gaussian16", "gaussian 16"],
"orca": ["orca 5", "orca5"],
"xtb": [],
}

SYN_SOLVENTS = {
Expand Down

0 comments on commit 9588bcb

Please sign in to comment.