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

Commit

Permalink
Added check to make sure it doesn't go into an infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed May 23, 2021
1 parent 7abe593 commit d559a52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/symba/symba_discard_conserve_mtm.f90
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ subroutine symba_discard_conserve_mtm(param, swiftest_plA, ipl, lescape_body)
ke_spin = ke_spin - 0.5_DP * mass(1) * radius(1)**2 * Ip(3, 1) * dot_product(rot(:, 1), rot(:, 1))
xb(:, 1) = xcom(:)
vb(:, 1) = vcom(:)
ke_orbit = ke_orbit - 0.5_DP * mass(1) * dot_product(vb(:, 1), vb(:, 1) )
ke_orbit = ke_orbit - 0.5_DP * mass(1) * dot_product(vb(:, 1), vb(:, 1))
end if
! Update position and velocity of central body

Expand Down
3 changes: 2 additions & 1 deletion src/symba/symba_frag_pos.f90
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ subroutine symba_frag_pos(param, symba_plA, family, x, v, L_spin, Ip, mass, radi
logical, save :: lfirst = .true.
real(DP), parameter :: Ltol = 2 * epsilon(1.0_DP)
real(DP), parameter :: Etol = 1e-8_DP
integer(I4B), parameter :: MAXTRY = 200

if (nfrag < NFRAG_MIN) then
write(*,*) "symba_frag_pos needs at least ",NFRAG_MIN," fragments, but only ",nfrag," were given."
Expand Down Expand Up @@ -179,7 +180,7 @@ subroutine symba_frag_pos(param, symba_plA, family, x, v, L_spin, Ip, mass, radi

try = 1
lmerge = .false.
do while (nfrag >= NFRAG_MIN)
do while (nfrag >= NFRAG_MIN .and. try <= MAXTRY)
!write(*, "(' -------------------------------------------------------------------------------------')")
!write(*,*) "Try number: ",try, ' of ',ntry
!write(*, "(' -------------------------------------------------------------------------------------')")
Expand Down

0 comments on commit d559a52

Please sign in to comment.