From 72fdd65603ebbd9b0db5390f7a6bee6d093a0f21 Mon Sep 17 00:00:00 2001 From: LorenzoGottardi1210 Date: Tue, 5 May 2026 09:42:12 +0200 Subject: [PATCH] Fix BFGS reset logic in relaxation.py Fixed a bug where self.inv_hess was being overwritten with None during a BFGS reset. The previous implementation called self.inv_hess = self._reset_bfgs(), but since the method lacked a return statement, it assigned None to the Hessian matrix. This caused a TypeError in the subsequent np.dot calculation. Updated the call to self._reset_bfgs() as a standalone method, which correctly updates the internal state without nullifying the variable. --- westpy/relaxation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/westpy/relaxation.py b/westpy/relaxation.py index a727a4d..9110a60 100644 --- a/westpy/relaxation.py +++ b/westpy/relaxation.py @@ -464,7 +464,7 @@ def _compute_new_position(self): if np.dot(self.grad, self.step) > 0.0: # resetting bfgs self._log("resetting bfgs history") - self.inv_hess = self._reset_bfgs() + self._reset_bfgs() self.step = -np.dot(self.inv_hess, self.grad) self.nr_step_length = self._scnorm(self.step)