diff --git a/src/netcdf/netcdf.f90 b/src/netcdf/netcdf.f90 index a4ee55c8c..44ba0e58d 100644 --- a/src/netcdf/netcdf.f90 +++ b/src/netcdf/netcdf.f90 @@ -68,7 +68,7 @@ module function netcdf_get_old_t_final_system(self, param) result(old_t_final) real(DP), dimension(1) :: val real(DP) :: KE_orb_orig, KE_spin_orig, PE_orig, Ltmp - call param%nciu%open(param, readonly=.true.) + call param%nciu%open(param) call check( nf90_inquire_dimension(param%nciu%ncid, param%nciu%time_dimid, len=itmax) ) call check( nf90_inquire_dimension(param%nciu%ncid, param%nciu%id_dimid, len=idmax) ) allocate(vals(idmax)) @@ -110,7 +110,6 @@ module function netcdf_get_old_t_final_system(self, param) result(old_t_final) end if deallocate(vals) - call param%nciu%close() return end function netcdf_get_old_t_final_system diff --git a/src/symba/symba_encounter_check.f90 b/src/symba/symba_encounter_check.f90 index 7c40516b6..f75fc49f2 100644 --- a/src/symba/symba_encounter_check.f90 +++ b/src/symba/symba_encounter_check.f90 @@ -35,6 +35,8 @@ module function symba_encounter_check_pl(self, param, system, dt, irec) result(l nplm = pl%nplm nplt = npl - nplm + call pl%set_renc(irec) + if (nplt == 0) then call encounter_check_all_plpl(param, npl, pl%xh, pl%vh, pl%renc, dt, lvdotr, index1, index2, nenc) else @@ -116,6 +118,8 @@ module function symba_encounter_check(self, param, system, dt, irec) result(lany nenc_enc = count(lencmask(:)) if (nenc_enc == 0) return + call pl%set_renc(irec) + allocate(encidx(nenc_enc)) allocate(lencounter(nenc_enc)) encidx(:) = pack([(k, k = 1, self%nenc)], lencmask(:)) @@ -203,6 +207,7 @@ module function symba_encounter_check_tp(self, param, system, dt, irec) result(l if (self%nbody == 0) return associate(tp => self, ntp => self%nbody, pl => system%pl, npl => system%pl%nbody) + call pl%set_renc(irec) call encounter_check_all_pltp(param, npl, ntp, pl%xh, pl%vh, tp%xh, tp%vh, pl%renc, dt, lvdotr, index1, index2, nenc) lany_encounter = nenc > 0 diff --git a/src/symba/symba_step.f90 b/src/symba/symba_step.f90 index ba4c1a734..eac112dcd 100644 --- a/src/symba/symba_step.f90 +++ b/src/symba/symba_step.f90 @@ -173,7 +173,6 @@ module recursive subroutine symba_step_recur_system(self, param, t, ireci) nloops = NTENC end if do j = 1, nloops - call system%pl%set_renc(irecp) lencounter = plplenc_list%encounter_check(param, system, dtl, irecp) .or. pltpenc_list%encounter_check(param, system, dtl, irecp) call plplenc_list%kick(system, dth, irecp, 1)