From dd653d509ea416a4543ed83a8f0afcf908ca15f5 Mon Sep 17 00:00:00 2001 From: Gregory Date: Tue, 10 Dec 2024 14:44:02 -0500 Subject: [PATCH] Fix gradient rotation in CFOUR calculator --- pysisyphus/calculators/CFOUR.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pysisyphus/calculators/CFOUR.py b/pysisyphus/calculators/CFOUR.py index 01b85ee44..188064d6c 100644 --- a/pysisyphus/calculators/CFOUR.py +++ b/pysisyphus/calculators/CFOUR.py @@ -87,14 +87,14 @@ def calc_rot_matrix( ): H = (source_coords_3d - source_centroid).T @ (target_coords_3d - target_centroid) assert H.shape == (3, 3) - U, S, V = np.linalg.svd(H) - R = V @ U.T + U, S, Vh = np.linalg.svd(H) + R = Vh.T @ U.T # Cover corner case if np.linalg.det(R) < 0: - U, S, V = np.linalg.svd(R) - V[:, 2] = V[:, 2] * -1 - R = V @ U.T + U, S, Vh = np.linalg.svd(R) + Vh[2, :] = Vh[2, :] * -1 + R = Vh.T @ U.T return R