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

Commit

Permalink
Fixed bug that happens when there are no plm-plm encounters but there…
Browse files Browse the repository at this point in the history
… are plm-plt encounters (massive-semi interacting only)
  • Loading branch information
daminton committed Jan 15, 2023
1 parent 950a475 commit 1a3ae14
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/encounter/encounter_check.f90
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ module subroutine encounter_check_all_plplm(param, nplm, nplt, rplm, vplm, rplt,

if (plmplt_nenc > 0) then ! Consolidate the two lists
allocate(itmp(nenc+plmplt_nenc))
itmp(1:nenc) = index1(1:nenc)
if (nenc > 0) itmp(1:nenc) = index1(1:nenc)
itmp(nenc+1:nenc+plmplt_nenc) = plmplt_index1(1:plmplt_nenc)
call move_alloc(itmp, index1)
allocate(itmp(nenc+plmplt_nenc))
itmp(1:nenc) = index2(1:nenc)
if (nenc > 0) itmp(1:nenc) = index2(1:nenc)
itmp(nenc+1:nenc+plmplt_nenc) = plmplt_index2(1:plmplt_nenc) + nplm ! Be sure to shift these indices back to their natural range
call move_alloc(itmp, index2)
allocate(ltmp(nenc+plmplt_nenc))
ltmp(1:nenc) = lvdotr(1:nenc)
if (nenc > 0) ltmp(1:nenc) = lvdotr(1:nenc)
ltmp(nenc+1:nenc+plmplt_nenc) = plmplt_lvdotr(1:plmplt_nenc)
call move_alloc(ltmp, lvdotr)
nenc = nenc + plmplt_nenc
Expand Down
30 changes: 15 additions & 15 deletions src/swiftest/swiftest_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1869,21 +1869,21 @@ module subroutine swiftest_util_rearray_pl(self, nbody_system, param)
call plplenc_old%copy(nbody_system%plpl_encounter)
end if

! ! Re-build the encounter list
! ! Be sure to get the level info if this is a SyMBA nbody_system
! select type(nbody_system)
! class is (symba_nbody_system)
! select type(pl)
! class is (symba_pl)
! select type(tp)
! class is (symba_tp)
! lencounter = pl%encounter_check(param, nbody_system, param%dt, nbody_system%irec)
! if (tp%nbody > 0) then
! lencounter = tp%encounter_check(param, nbody_system, param%dt, nbody_system%irec)
! end if
! end select
! end select
! end select
! Re-build the encounter list
! Be sure to get the level info if this is a SyMBA nbody_system
select type(nbody_system)
class is (symba_nbody_system)
select type(pl)
class is (symba_pl)
select type(tp)
class is (symba_tp)
lencounter = pl%encounter_check(param, nbody_system, param%dt, nbody_system%irec)
if (tp%nbody > 0) then
lencounter = tp%encounter_check(param, nbody_system, param%dt, nbody_system%irec)
end if
end select
end select
end select

! Re-index the encounter list as the index values may have changed
if (nenc_old > 0) then
Expand Down

0 comments on commit 1a3ae14

Please sign in to comment.