diff --git a/src/modules/symba_classes.f90 b/src/modules/symba_classes.f90 index 032ccd47a..05698d44c 100644 --- a/src/modules/symba_classes.f90 +++ b/src/modules/symba_classes.f90 @@ -501,9 +501,10 @@ module recursive subroutine symba_step_recur_system(self, param, t, ireci) integer(I4B), value :: ireci !! input recursion level end subroutine symba_step_recur_system - module subroutine symba_step_reset_system(self) + module subroutine symba_step_reset_system(self, param) implicit none - class(symba_nbody_system), intent(inout) :: self !! SyMBA nbody system object + class(symba_nbody_system), intent(inout) :: self !! SyMBA nbody system object + class(symba_parameters), intent(in) :: param !! Current run configuration parameters with SyMBA additions end subroutine symba_step_reset_system end interface diff --git a/src/symba/symba_step.f90 b/src/symba/symba_step.f90 index e07d16cc2..249c73a82 100644 --- a/src/symba/symba_step.f90 +++ b/src/symba/symba_step.f90 @@ -19,20 +19,23 @@ module subroutine symba_step_system(self, param, t, dt) ! Internals logical :: lencounter - call self%reset() select type(pl => self%pl) class is (symba_pl) select type(tp => self%tp) class is (symba_tp) - lencounter = pl%encounter_check(self, dt, 0) .or. tp%encounter_check(self, dt, 0) - if (lencounter) then - tp%lfirst = pl%lfirst - call self%interp(param, t, dt) - pl%lfirst = .true. - tp%lfirst = .true. - else - call helio_step_system(self, param, t, dt) - end if + select type(param) + class is (symba_parameters) + call self%reset(param) + lencounter = pl%encounter_check(self, dt, 0) .or. tp%encounter_check(self, dt, 0) + if (lencounter) then + tp%lfirst = pl%lfirst + call self%interp(param, t, dt) + pl%lfirst = .true. + tp%lfirst = .true. + else + call helio_step_system(self, param, t, dt) + end if + end select end select end select @@ -212,7 +215,7 @@ module recursive subroutine symba_step_recur_system(self, param, t, ireci) end subroutine symba_step_recur_system - module subroutine symba_step_reset_system(self) + module subroutine symba_step_reset_system(self, param) !! author: David A. Minton !! !! Resets pl, tp,and encounter structures at the start of a new step @@ -221,7 +224,8 @@ module subroutine symba_step_reset_system(self) !! Adapted from Hal Levison's Swift routine symba5_step.f implicit none ! Arguments - class(symba_nbody_system), intent(inout) :: self !! SyMBA nbody system object + class(symba_nbody_system), intent(inout) :: self !! SyMBA nbody system object + class(symba_parameters), intent(in) :: param !! Current run configuration parameters with SyMBA additions ! Internals integer(I4B) :: i @@ -254,8 +258,8 @@ module subroutine symba_step_reset_system(self) system%pltpenc_list%nenc = 0 end if - call system%pl_adds%resize(0) - call system%pl_discards%resize(0) + call system%pl_adds%setup(0, param) + call system%pl_discards%setup(0, param) end select end select end associate diff --git a/src/symba/symba_util.f90 b/src/symba/symba_util.f90 index 12919bed0..e6ac2b6be 100644 --- a/src/symba/symba_util.f90 +++ b/src/symba/symba_util.f90 @@ -456,8 +456,10 @@ module subroutine symba_util_rearray_pl(self, system, param) pl%lmtiny(:) = pl%Gmass(:) > param%GMTINY pl%nplm = count(pl%lmtiny(:)) - ! Reindex the bodies and calculate the level 0 encounter list + ! Reindex the new list ofbodies call pl%eucl_index() + + ! Re-build the encounter list lencounter = pl%encounter_check(system, param%dt, 0) select type(tp => system%tp) class is (symba_tp) diff --git a/src/util/util_append.f90 b/src/util/util_append.f90 index 88755870f..971e3c950 100644 --- a/src/util/util_append.f90 +++ b/src/util/util_append.f90 @@ -245,8 +245,6 @@ module subroutine util_append_pl(self, source, lsource_mask) call util_append_body(self, source, lsource_mask) end associate - - call self%eucl_index() class default write(*,*) "Invalid object passed to the append method. Source must be of class swiftest_pl or its descendents" call util_exit(FAILURE)