Skip to content

Commit

Permalink
Added a test for Counterpoise calculations and updated the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelRobidas committed Mar 21, 2023
1 parent 2b3c64c commit dd96a06
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ccinput/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ def __init__(
)
if self.solvation_radii.strip() == "":
warn("No solvation radii specified; using default radii")

if "counterpoise" in specifications.lower():
raise InvalidParameter(
"Counterpoise calculations are not compatible with implicit solvation"
)
else:
self.solvation_model = ""
self.solvation_radii = ""
Expand Down
2 changes: 0 additions & 2 deletions ccinput/packages/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,6 @@ def handle_xyz(self):
lines = [i + "\n" for i in clean_xyz(self.calc.xyz).split("\n") if i != ""]
# If counterpoise correction is the option, modify xyz corresponding to fragments
if self.calc.fragments != None:
print(self.calc.fragments)
print(type(self.calc.fragments))
lines = add_fragments_xyz(lines, self.calc.fragments)
self.xyz_structure = "".join(lines)

Expand Down
20 changes: 19 additions & 1 deletion ccinput/tests/test_gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -3874,7 +3874,6 @@ def test_sp_HF_CP_2(self):
O(Fragment=2) 0.62360000 0.07990000 1.25870000
H(Fragment=2) 0.94410000 0.53240000 2.04240000
"""

self.assertTrue(self.is_equivalent(REF, inp.input_file))
Expand Down Expand Up @@ -3912,3 +3911,22 @@ def test_sp_HF_CP_wrong_start_num(self):

with self.assertRaises(InvalidParameter):
self.generate_calculation(**params)

def test_sp_HF_CP_solvation_invalid(self):
params = {
"nproc": 8,
"mem": "10000MB",
"type": "Single-Point Energy",
"file": "ethanol.xyz",
"software": "Gaussian",
"method": "HF",
"basis_set": "3-21G",
"charge": "0",
"specifications": "counterpoise=4 ",
"fragments": "1,1,2,2,2,3,4,4,4",
"solvent": "dichloromethane",
"solvation_model": "PCM",
}

with self.assertRaises(InvalidParameter):
self.generate_calculation(**params)
2 changes: 1 addition & 1 deletion docs/source/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Custom basis sets yes yes n.a.
Density fitting yes yes n.a.
Custom additional keywords yes yes yes
Dispersion corrections yes yes yes [4]_
Counter-poise correction no no yes [4]_
Counter-poise correction yes no yes [4]_
=============================== ============ =========== =========


Expand Down

0 comments on commit dd96a06

Please sign in to comment.