Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Fixed problem that caused a divide by zero error if adaptive interact…
Browse files Browse the repository at this point in the history
…ions was turned on but there was only one massive body
  • Loading branch information
daminton committed Sep 27, 2021
1 parent 2b19ee0 commit 39cf623
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/kick/kick.f90
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@ module subroutine kick_getacch_int_pl(self, param)
character(len=STRMAX) :: tstr, nstr, cstr, mstr, lstyle
character(len=1) :: schar


if (param%ladaptive_interactions) then
if (lfirst) then
write(itimer%loopname, *) "kick_getacch_int_pl"
write(itimer%looptype, *) "INTERACTION"
call itimer%time_this_loop(param, self, self%nplpl)
lfirst = .false.
if (self%nplpl > 0) then
if (lfirst) then
write(itimer%loopname, *) "kick_getacch_int_pl"
write(itimer%looptype, *) "INTERACTION"
call itimer%time_this_loop(param, self, self%nplpl)
lfirst = .false.
else
if (itimer%check(param, self%nplpl)) call itimer%time_this_loop(param, self, self%nplpl)
end if
else
if (itimer%check(param, self%nplpl)) call itimer%time_this_loop(param, self, self%nplpl)
param%lflatten_interactions = .false.
end if
end if

Expand All @@ -37,7 +40,7 @@ module subroutine kick_getacch_int_pl(self, param)
call kick_getacch_int_all_triangular_pl(self%nbody, self%nbody, self%xh, self%Gmass, self%radius, self%ah)
end if

if (param%ladaptive_interactions) then
if (param%ladaptive_interactions .and. self%nplpl > 0) then
if (itimer%is_on) call itimer%adapt(param, self, self%nplpl)
end if

Expand Down

0 comments on commit 39cf623

Please sign in to comment.