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

Commit

Permalink
Browse files Browse the repository at this point in the history
Commented out debugging write statements and diagnostics in prep for a test run
  • Loading branch information
daminton committed May 21, 2021
1 parent 764c13e commit 65a9a47
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
25 changes: 12 additions & 13 deletions src/symba/symba_frag_pos.f90
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ subroutine symba_frag_pos(param, symba_plA, family, x, v, L_spin, Ip, mass, radi
call calculate_system_energy(linclude_fragments=.false.)


write(*, "(' -------------------------------------------------------------------------------------')")
write(*, "(' Energy normalized by |Etot_before|')")
!write(*, "(' -------------------------------------------------------------------------------------')")
!write(*, "(' Energy normalized by |Etot_before|')")

call define_coordinate_system()
call define_pre_collisional_family()
Expand Down Expand Up @@ -224,20 +224,20 @@ subroutine symba_frag_pos(param, symba_plA, family, x, v, L_spin, Ip, mass, radi
if (.not.lmerge) exit
call restructure_failed_fragments()
end do
write(*, "(' -------------------------------------------------------------------------------------')")
write(*, "(' Final diagnostic')")
write(*, "(' -------------------------------------------------------------------------------------')")
!write(*, "(' -------------------------------------------------------------------------------------')")
!write(*, "(' Final diagnostic')")
!write(*, "(' -------------------------------------------------------------------------------------')")
if (lmerge) then
write(*,*) "symba_frag_pos can't find a solution, so this collision is flagged as a merge"
else
write(*, "(' dL_tot should be very small' )")
write(*,fmtlabel) ' dL_tot |', dLmag
write(*, "(' dE_tot should be negative and equal to Qloss' )")
write(*,fmtlabel) ' dE_tot |', dEtot
write(*,fmtlabel) ' Qloss |', -Qloss / abs(Etot_before)
write(*,fmtlabel) ' dE - Qloss |', (Etot_after - Etot_before + Qloss) / abs(Etot_before)
! write(*, "(' dL_tot should be very small' )")
! write(*,fmtlabel) ' dL_tot |', dLmag
! write(*, "(' dE_tot should be negative and equal to Qloss' )")
! write(*,fmtlabel) ' dE_tot |', dEtot
! write(*,fmtlabel) ' Qloss |', -Qloss / abs(Etot_before)
! write(*,fmtlabel) ' dE - Qloss |', (Etot_after - Etot_before + Qloss) / abs(Etot_before)
end if
write(*, "(' -------------------------------------------------------------------------------------')")
!write(*, "(' -------------------------------------------------------------------------------------')")

call restore_scale_factors()

Expand Down Expand Up @@ -767,7 +767,6 @@ subroutine restructure_failed_fragments()
implicit none
integer(I4B) :: i
integer(I4B), save :: iflip = 1
write(*,*) 'Failed to find a solution. Trying again'

m_frag(iflip) = m_frag(iflip) + m_frag(nfrag)
rad_frag(iflip) = (rad_frag(iflip)**3 + rad_frag(nfrag)**3)**(1._DP / 3._DP)
Expand Down
16 changes: 8 additions & 8 deletions src/util/util_minimize_bfgs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ function util_minimize_bfgs(f, N, x0, eps, lerr) result(x1)
!check for convergence
conv = count(abs(grad1(:)) > eps)
if (conv == 0) then
write(*,*) "BFGS converged on gradient after ",i," iterations"
!write(*,*) "BFGS converged on gradient after ",i," iterations"
exit
end if
S(:) = -matmul(H(:,:), grad1(:))
astar = minimize1D(f, x1, S, N, gradeps, lerr)
if (lerr) then
write(*,*) "Exiting BFGS with error in minimize1D step"
!write(*,*) "Exiting BFGS with error in minimize1D step"
exit
end if
! Get new x values
Expand All @@ -82,7 +82,7 @@ function util_minimize_bfgs(f, N, x0, eps, lerr) result(x1)
end do
! prevent divide by zero (convergence)
if (abs(Py) < tiny(Py)) then
write(*,*) "BFGS Converged on tiny Py after ",i," iterations"
!write(*,*) "BFGS Converged on tiny Py after ",i," iterations"
exit
end if
! set up update
Expand All @@ -106,12 +106,12 @@ function util_minimize_bfgs(f, N, x0, eps, lerr) result(x1)
if (any(fpe_flag)) exit
if (i == MAXLOOP) then
lerr = .true.
write(*,*) "BFGS ran out of loops!"
!write(*,*) "BFGS ran out of loops!"
end if
end do
call ieee_get_flag(ieee_usual, fpe_flag)
lerr = lerr .or. any(fpe_flag)
if (lerr) write(*,*) "BFGS did not converge!"
!if (lerr) write(*,*) "BFGS did not converge!"
call ieee_set_status(original_fpe_status)

return
Expand Down Expand Up @@ -199,7 +199,7 @@ function minimize1D(f, x0, S, N, eps, lerr) result(astar)
alo = a0
call bracket(f, x0, S, N, gam, step, alo, ahi, lerr)
if (lerr) then
write(*,*) "BFGS bracketing step failed!"
!write(*,*) "BFGS bracketing step failed!"
return
end if
if (abs(alo - ahi) < eps) then
Expand All @@ -209,7 +209,7 @@ function minimize1D(f, x0, S, N, eps, lerr) result(astar)
end if
call golden(f, x0, S, N, greduce, alo, ahi, lerr)
if (lerr) then
write(*,*) "BFGS golden section step failed!"
!write(*,*) "BFGS golden section step failed!"
return
end if
if (abs(alo - ahi) < eps) then
Expand All @@ -219,7 +219,7 @@ function minimize1D(f, x0, S, N, eps, lerr) result(astar)
end if
call quadfit(f, x0, S, N, eps, alo, ahi, lerr)
if (lerr) then
write(*,*) "BFGS quadfit failed!"
!write(*,*) "BFGS quadfit failed!"
return
end if
if (abs(alo - ahi) < eps) then
Expand Down

0 comments on commit 65a9a47

Please sign in to comment.