Skip to content

Commit 4ab0dee

Browse files
committed
Fixed the negative gradient modulus error.
It was a 1 extra conjugation (both transposition and conjugation cancel out)
1 parent d5b1c60 commit 4ab0dee

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Modules/SchaMinimizer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,9 @@ def minimization_step(self, custom_function_gradient = None):
416416

417417

418418
# Store the gradient in the minimization
419-
self.__gc__.append(np.real(np.einsum("abc,acb", dyn_grad, np.conj(dyn_grad))))
420-
self.__gc_err__.append(np.real(np.einsum("abc, acb", err, np.conj(err))))
421-
419+
self.__gc__.append( np.sqrt(np.sum( np.abs(dyn_grad)**2)))
420+
self.__gc_err__.append( np.sqrt(np.sum( np.abs(err)**2)))
421+
422422
# Perform the step for the dynamical matrix respecting the root representation
423423
new_dyn = PerformRootStep(np.array(self.dyn.dynmats, order = "C"), dyn_grad,
424424
self.min_step_dyn, root_representation = self.root_representation,

0 commit comments

Comments
 (0)