Skip to content

Commit

Permalink
Added official support for auxiliary basis sets, MP2 and CC methods
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelRobidas committed Aug 12, 2022
1 parent d711598 commit 574f100
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 11 deletions.
16 changes: 8 additions & 8 deletions ccinput/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ class CalcType(Enum):
"ccsdt",
"qcisd",
"qcisdt",
"lpno-ccsd",
"lpno-ccsdt",
"lpno-qcisd",
"lpno-qcisdt",
"dlpno-ccsd",
"dlpno-ccsdt",
"dlpno-qcisd",
"dlpno-qcisdt",
"lpnoccsd",
"lpnoccsdt",
"lpnoqcisd",
"lpnoqcisdt",
"dlpnoccsd",
"dlpnoccsdt",
"dlpnoqcisd",
"dlpnoqcisdt",
],
# Everything else is assumed to be DFT, because it most likely is
}
Expand Down
20 changes: 18 additions & 2 deletions ccinput/packages/orca.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import basis_set_exchange

from ccinput.constants import CalcType, ATOMIC_NUMBER, LOWERCASE_ATOMIC_SYMBOLS
from ccinput.utilities import get_method, get_basis_set, get_solvent, clean_xyz
from ccinput.utilities import get_method, get_basis_set, get_solvent, clean_xyz, warn
from ccinput.exceptions import (
InvalidParameter,
UnimplementedError,
Expand Down Expand Up @@ -58,6 +58,7 @@ def __init__(self, calc):
self.input_file = ""
self.specifications = {}
self.solvation_radii = {}
self.aux_basis_sets = {}

if self.calc.type not in self.CALC_TYPES:
raise ImpossibleCalculation(
Expand Down Expand Up @@ -97,7 +98,6 @@ def handle_specifications(self):
)

specifications_list = []

if _specifications != "":
sspecs = _specifications.split()
ind = 0
Expand All @@ -116,6 +116,12 @@ def handle_specifications(self):
raise InvalidParameter("Invalid specifications")
self.specifications["nimages"] = nimages
ind += 1
elif spec[-2:] == "/c":
self.aux_basis_sets["C"] = get_basis_set(spec[:-2], "orca")
elif spec[-3:] == "/jk":
self.aux_basis_sets["JK"] = get_basis_set(spec[:-3], "orca")
elif spec[-2:] == "/j":
self.aux_basis_sets["J"] = get_basis_set(spec[:-2], "orca")
elif spec not in specifications_list:
specifications_list.append(spec)

Expand Down Expand Up @@ -231,9 +237,19 @@ def handle_command(self):
]:
basis_set = get_basis_set(self.calc.parameters.basis_set, "orca")
self.command_line += f"{method} {basis_set} "
if self.calc.parameters.theory_level in ["mp2", "cc"] and (
method.find("RI") != -1 or method.find("LPNO") != -1
):
# If we need an auxiliary basis set
if "C" not in self.aux_basis_sets:
warn(f"No C auxiliary basis set specified, using {basis_set}")
self.aux_basis_sets["C"] = basis_set
else:
self.command_line += f"{method} "

for aux_t, aux_bs in self.aux_basis_sets.items():
self.command_line += f"{aux_bs}/{aux_t}"

def handle_custom_basis_sets(self):
if len(self.calc.parameters.custom_basis_sets) == 0:
return
Expand Down
158 changes: 157 additions & 1 deletion ccinput/tests/test_orca.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,169 @@ def test_sp_MP2(self):
"method": "RI-MP2",
"basis_set": "cc-pVTZ",
"charge": "-1",
"specifications": "cc-pvtz/C",
}

inp = self.generate_calculation(**params)

REF = """
!SP RI-MP2 cc-pVTZ cc-pVTZ/C
*xyz -1 1
Cl 0.0 0.0 0.0
*
%pal
nprocs 8
end
"""

self.assertTrue(self.is_equivalent(REF, inp.input_file))

def test_sp_MP2_default_aux(self):
params = {
"nproc": 8,
"type": "Single-Point Energy",
"file": "Cl.xyz",
"software": "ORCA",
"method": "RI-MP2",
"basis_set": "cc-pVTZ",
"charge": "-1",
"specifications": "",
}

inp = self.generate_calculation(**params)

REF = """
!SP RI-MP2 cc-pVTZ cc-pVTZ/C
*xyz -1 1
Cl 0.0 0.0 0.0
*
%pal
nprocs 8
end
"""

self.assertTrue(self.is_equivalent(REF, inp.input_file))

def test_sp_MP2_override_aux(self):
params = {
"nproc": 8,
"type": "Single-Point Energy",
"file": "Cl.xyz",
"software": "ORCA",
"method": "RI-MP2",
"basis_set": "cc-pVTZ",
"charge": "-1",
"specifications": "cc-pVDZ/C",
}

inp = self.generate_calculation(**params)

REF = """
!SP RI-MP2 cc-pVTZ cc-pVDZ/C
*xyz -1 1
Cl 0.0 0.0 0.0
*
%pal
nprocs 8
end
"""

self.assertTrue(self.is_equivalent(REF, inp.input_file))

def test_sp_MP2_without_RI(self):
params = {
"nproc": 8,
"type": "Single-Point Energy",
"file": "Cl.xyz",
"software": "ORCA",
"method": "MP2",
"basis_set": "cc-pVTZ",
"charge": "-1",
"specifications": "",
}

inp = self.generate_calculation(**params)

REF = """
!SP MP2 cc-pVTZ
*xyz -1 1
Cl 0.0 0.0 0.0
*
%pal
nprocs 8
end
"""

self.assertTrue(self.is_equivalent(REF, inp.input_file))

def test_sp_DLPNO_CCSDT(self):
params = {
"nproc": 8,
"type": "Single-Point Energy",
"file": "Cl.xyz",
"software": "ORCA",
"method": "DLPNO-CCSD(T)",
"basis_set": "cc-pVTZ",
"charge": "-1",
"specifications": "cc-pVTZ/C",
}

inp = self.generate_calculation(**params)

REF = """
!SP RI-MP2 cc-pVTZ cc-pvtz/c
!SP DLPNO-CCSD(T) cc-pVTZ cc-pVTZ/C
*xyz -1 1
Cl 0.0 0.0 0.0
*
%pal
nprocs 8
end
"""

self.assertTrue(self.is_equivalent(REF, inp.input_file))

def test_sp_DLPNO_CCSDT_default_aux(self):
params = {
"nproc": 8,
"type": "Single-Point Energy",
"file": "Cl.xyz",
"software": "ORCA",
"method": "DLPNO-CCSD(T)",
"basis_set": "cc-pVTZ",
"charge": "-1",
"specifications": "",
}

inp = self.generate_calculation(**params)

REF = """
!SP DLPNO-CCSD(T) cc-pVTZ cc-pVTZ/C
*xyz -1 1
Cl 0.0 0.0 0.0
*
%pal
nprocs 8
end
"""

self.assertTrue(self.is_equivalent(REF, inp.input_file))

def test_sp_CCSDT(self):
params = {
"nproc": 8,
"type": "Single-Point Energy",
"file": "Cl.xyz",
"software": "ORCA",
"method": "CCSD(T)",
"basis_set": "cc-pVTZ",
"charge": "-1",
"specifications": "",
}

inp = self.generate_calculation(**params)

REF = """
!SP CCSD(T) cc-pVTZ
*xyz -1 1
Cl 0.0 0.0 0.0
*
Expand Down

0 comments on commit 574f100

Please sign in to comment.