Skip to content

Commit

Permalink
Sqm backend fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kzinovjev authored Jan 20, 2024
1 parent 5d531a4 commit 6536e4f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions emle/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 6536e4f

Please sign in to comment.