diff --git a/ccinput/packages/xtb.py b/ccinput/packages/xtb.py index 410d363..5d223d9 100644 --- a/ccinput/packages/xtb.py +++ b/ccinput/packages/xtb.py @@ -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: diff --git a/ccinput/tests/test_xtb.py b/ccinput/tests/test_xtb.py index a6526bc..c41ff23 100644 --- a/ccinput/tests/test_xtb.py +++ b/ccinput/tests/test_xtb.py @@ -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)) @@ -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))