Skip to content

Commit

Permalink
Fixed xtb multiplicity for multiplicities other than 1
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelRobidas committed Nov 13, 2024
1 parent 9744e28 commit 034c447
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ccinput/packages/xtb.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def handle_parameters(self):
self.main_command += f"--chrg {self.calc.charge} "

if self.calc.multiplicity != 1:
self.main_command += f"--uhf {self.calc.multiplicity} "
# uhf is the number of unpaired electrons
self.main_command += f"--uhf {self.calc.multiplicity-1} "

def handle_constraints_scan(self):
if len(self.calc.constraints) == 0:
Expand Down
4 changes: 2 additions & 2 deletions ccinput/tests/test_xtb.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_sp_multiplicity(self):

xtb = self.generate_calculation(**params)

REF = "xtb Cl.xyz --uhf 2"
REF = "xtb Cl.xyz --uhf 1"

self.assertTrue(self.is_equivalent(REF, xtb.command))
self.assertTrue(self.is_equivalent("", xtb.input_file))
Expand All @@ -59,7 +59,7 @@ def test_sp_charge_multiplicity(self):

xtb = self.generate_calculation(**params)

REF = "xtb Cl.xyz --chrg -1 --uhf 3"
REF = "xtb Cl.xyz --chrg -1 --uhf 2"

self.assertTrue(self.is_equivalent(REF, xtb.command))
self.assertTrue(self.is_equivalent("", xtb.input_file))
Expand Down

0 comments on commit 034c447

Please sign in to comment.