From 6536e4f6bba37248bb3f1e56832c95d6a4783a4b Mon Sep 17 00:00:00 2001 From: Kirill Zinovjev Date: Sat, 20 Jan 2024 09:14:21 +0100 Subject: [PATCH] Sqm backend fixes --- emle/calculator.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/emle/calculator.py b/emle/calculator.py index ef89709..301cb20 100644 --- a/emle/calculator.py +++ b/emle/calculator.py @@ -2708,6 +2708,7 @@ def _run_sqm(self, xyz, atomic_numbers, qm_charge): f.write(" &qmmm\n") f.write(f" qm_theory='{self._sqm_theory}',\n") f.write(f" qmcharge={qm_charge},\n") + f.write(" maxcyc=0,\n") f.write(" verbosity=4,\n") f.write(f" /\n") @@ -2740,7 +2741,7 @@ def _run_sqm(self, xyz, atomic_numbers, qm_charge): forces = [] for line in f: # Skip lines prior to convergence. - if line.startswith(" ... geometry converged !"): + if line.startswith(" QMMM SCC-DFTB: SCC-DFTB for step 0 converged"): is_converged = True continue @@ -2784,7 +2785,9 @@ def _run_sqm(self, xyz, atomic_numbers, qm_charge): energy *= _KCAL_MOL_TO_HARTREE # Convert the gradient to a NumPy array and reshape. - gradient = -_np.array(forces) * _KCAL_MOL_TO_HARTREE * _BOHR_TO_ANGSTROM + # Misleading comment in sqm output, the "forces" are actually gradients + # So, no need to multiply by -1 + gradient = _np.array(forces) * _KCAL_MOL_TO_HARTREE * _BOHR_TO_ANGSTROM return energy, gradient