diff --git a/src/io/io.f90 b/src/io/io.f90 index 2892d5336..92924d458 100644 --- a/src/io/io.f90 +++ b/src/io/io.f90 @@ -671,7 +671,8 @@ module subroutine io_param_reader(self, unit, iotype, v_list, iostat, iomsg) else if (param_value == "YES" .or. param_value == 'T') then param%lrestart = .true. end if - case ("NPLMAX", "NTPMAX", "GMTINY", "MIN_GMFRAG", "FRAGMENTATION", "SEED", "YARKOVSKY", "YORP") ! Ignore SyMBA-specific, not-yet-implemented, or obsolete input parameters + ! Ignore SyMBA-specific, not-yet-implemented, or obsolete input parameters + case ("NPLMAX", "NTPMAX", "GMTINY", "MIN_GMFRAG", "FRAGMENTATION", "SEED", "YARKOVSKY", "YORP", "ENCOUNTER_SAVE", "FRAGMENTATION_SAVE") case default write(*,*) "Ignoring unknown parameter -> ",param_name end select diff --git a/src/setup/setup.f90 b/src/setup/setup.f90 index e95505b9b..ea6d3db23 100644 --- a/src/setup/setup.f90 +++ b/src/setup/setup.f90 @@ -68,6 +68,7 @@ module subroutine setup_construct_system(system, param) allocate(symba_pltpenc :: system%pltpenc_list) allocate(symba_plplenc :: system%plplenc_list) allocate(symba_plplenc :: system%plplcollision_list) + allocate(symba_encounter_storage :: system%encounter_history) end select case (RINGMOONS) write(*,*) 'RINGMOONS-SyMBA integrator not yet enabled' diff --git a/src/symba/symba_io.f90 b/src/symba/symba_io.f90 index 0300c6dc5..f11863059 100644 --- a/src/symba/symba_io.f90 +++ b/src/symba/symba_io.f90 @@ -301,8 +301,8 @@ module subroutine symba_io_param_reader(self, unit, iotype, v_list, iostat, ioms iostat = -1 return end if - param%lencounter_save = (param%encounter_save /= "TRAJECTORY") .or. (param%encounter_save /= "CLOSEST") .or. & - (param%fragmentation_save /= "TRAJECTORY") .or. (param%fragmentation_save /= "CLOSEST") + param%lencounter_save = (param%encounter_save == "TRAJECTORY") .or. (param%encounter_save == "CLOSEST") .or. & + (param%fragmentation_save == "TRAJECTORY") .or. (param%fragmentation_save == "CLOSEST") ! Call the base method (which also prints the contents to screen) call io_param_reader(param, unit, iotype, v_list, iostat, iomsg) @@ -367,8 +367,8 @@ module subroutine symba_io_start_encounter(self, param, t) class(symba_parameters), intent(inout) :: param !! Current run configuration parameters real(DP), intent(in) :: t !! Current simulation time - if (allocated(self%encounter_history)) deallocate(self%encounter_history) - allocate(symba_encounter_storage :: self%encounter_history) + if (.not. allocated(self%encounter_history)) allocate(symba_encounter_storage :: self%encounter_history) + call self%encounter_history%reset() ! Take the snapshot at the start of the encounter call self%snapshot(param, t) @@ -390,7 +390,6 @@ module subroutine symba_io_stop_encounter(self, param, t) ! Take the final snapshot call self%snapshot(param, t) call self%encounter_history%dump(param) - deallocate(self%encounter_history) return end subroutine symba_io_stop_encounter diff --git a/src/symba/symba_step.f90 b/src/symba/symba_step.f90 index bdf73309b..e727ed9f3 100644 --- a/src/symba/symba_step.f90 +++ b/src/symba/symba_step.f90 @@ -315,8 +315,6 @@ module subroutine symba_step_reset_system(self, param) tp%lfirst = param%lfirstkick pl%lfirst = param%lfirstkick - call system%encounter_history%reset() - end associate end select end select