From 592f1e59aa9e5dc48e20fdbac86f2d307f6c95e8 Mon Sep 17 00:00:00 2001 From: anand43 Date: Thu, 25 Jan 2024 13:52:18 -0500 Subject: [PATCH] Skip calculation of kick if c_lm = 0; to improve performance --- src/swiftest/swiftest_sph.f90 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/swiftest/swiftest_sph.f90 b/src/swiftest/swiftest_sph.f90 index 2def11b02..a84376038 100644 --- a/src/swiftest/swiftest_sph.f90 +++ b/src/swiftest/swiftest_sph.f90 @@ -72,6 +72,11 @@ module subroutine swiftest_sph_g_acc_one(GMcb, r_0, phi_cb, rh, c_lm, g_sph, GMp do l = 1, l_max ! skipping the l = 0 term; It is the spherical body term do m = 0, l + ! If c_lm is too small, skip the iteration to improve performance + if (abs(c_lm(m+1, l+1, 1)) < epsilon(0.0_DP) .and. abs(c_lm(m+1, l+1, 2)) < epsilon(0.0_DP)) then + cycle + endif + ! Associated Legendre Polynomials lmindex = PlmIndex(l, m) plm = p(lmindex) ! p_l,m