diff --git a/qforce/qm/qm.py b/qforce/qm/qm.py index 7fc5562..61d08a0 100644 --- a/qforce/qm/qm.py +++ b/qforce/qm/qm.py @@ -161,9 +161,9 @@ def Calculation(self, filename, required_files, *, folder=None, software=None): def setup_hessian_calculation(self, folder, coords, atnums, preopt=False): """Setup hessian calculation""" if preopt is True: - software = self.softwares['software'] - else: software = self.softwares['preopt'] + else: + software = self.softwares['software'] calculation = self.Calculation(self.hessian_name(software), software.read.hessian_files, diff --git a/qforce/qm/xtb.py b/qforce/qm/xtb.py index 2f4725e..39ac0a5 100644 --- a/qforce/qm/xtb.py +++ b/qforce/qm/xtb.py @@ -871,14 +871,19 @@ def _read_xtb_charge_mult(out_file): next(fh) next(fh) break + # for line in fh: if line.strip() == '': break - if 'charge' in line: - charge = int(line.split()[-1]) - if 'spin' in line: - spin = float(line.split()[-1]) - mult = round(2.0*spin)+1 + if 'program call' in line: + words = line.split() + for i, word in enumerate(words): + if word == '--chrg': + charge = int(words[i+1]) + if word == '--uhf': + spin = int(words[i+1]) + mult = round(2.0*spin)+1 + break if charge is None: raise ValueError("Could not find charge in xtb file")