From 9adbcfebe9fe4068cde97d49b559924d222de35f Mon Sep 17 00:00:00 2001 From: David A Minton Date: Mon, 15 May 2023 22:28:36 -0400 Subject: [PATCH] Restored some floating point operations to make them closer to the Swifter version --- src/swiftest/swiftest_kick.f90 | 2 +- src/swiftest/swiftest_util.f90 | 2 +- src/whm/whm_kick.f90 | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/swiftest/swiftest_kick.f90 b/src/swiftest/swiftest_kick.f90 index 430679b43..751702fa2 100644 --- a/src/swiftest/swiftest_kick.f90 +++ b/src/swiftest/swiftest_kick.f90 @@ -430,7 +430,7 @@ pure module subroutine swiftest_kick_getacch_int_one_tp(rji2, xr, yr, zr, GMpl, ! Internals real(DP) :: fac - fac = GMpl * sqrt(1.0_DP / (rji2*rji2*rji2)) + fac = GMpl / (rji2*sqrt(rji2)) ax = ax - fac * xr ay = ay - fac * yr az = az - fac * zr diff --git a/src/swiftest/swiftest_util.f90 b/src/swiftest/swiftest_util.f90 index be98690c3..3fc664af9 100644 --- a/src/swiftest/swiftest_util.f90 +++ b/src/swiftest/swiftest_util.f90 @@ -2609,7 +2609,7 @@ module subroutine swiftest_util_snapshot_system(self, param, nbody_system, t, ar end select end select - call nbody_system%pl%set_rhill(nbody_system%cb) + if (.not.param%lrhill_present) call nbody_system%pl%set_rhill(nbody_system%cb) ! Take a minimal snapshot wihout all of the extra storage objects allocate(snapshot, mold=nbody_system) diff --git a/src/whm/whm_kick.f90 b/src/whm/whm_kick.f90 index 6469809e5..403678ed6 100644 --- a/src/whm/whm_kick.f90 +++ b/src/whm/whm_kick.f90 @@ -124,14 +124,13 @@ function whm_kick_getacch_ah0(mu, rhp, n) result(ah0) ! Result real(DP), dimension(NDIM) :: ah0 ! Internals - real(DP) :: fac, r2, ir3h, irh + real(DP) :: fac, r2, ir3h integer(I4B) :: i ah0(:) = 0.0_DP do i = 1, n r2 = dot_product(rhp(:, i), rhp(:, i)) - irh = 1.0_DP / sqrt(r2) - ir3h = irh / r2 + ir3h = 1.0_DP / (r2 * sqrt(r2)) fac = mu(i) * ir3h ah0(:) = ah0(:) - fac * rhp(:, i) end do