Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sqm backend fixes #4

Merged
merged 1 commit into from
Jan 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading