subroutine final_output()
use constants, only: iotty, mfile
use numerics, only: nfev1, ncalls, xcm, ioptimz, nviter, &
nvar
use define_iteration_variables, only: loadxc
implicit none
if (nfev1 == 0) then ! no HYBRD call
!if (nviter == 1) then
! write(iotty,10) nviter,ncalls
!else
! write(iotty,20) nviter,ncalls
!end if
else if (nviter == 0) then ! no VMCON call
if (nfev1 == 1) then
write(iotty,30) nfev1,ncalls
else
write(iotty,40) nfev1,ncalls
end if
else if (nfev1 == 1) then ! (unlikely that nviter is also 1...)
write(iotty,50) nfev1,nviter,ncalls
else if (nviter == 1) then ! (unlikely that nfev1 is also 1...)
write(iotty,60) nfev1,nviter,ncalls
else
write(iotty,70) nfev1,nviter,ncalls
end if
30 format( &
t2,'The HYBRD point required ',i5,' iteration',/, &
t2,'There were ',i6,' function calls')
40 format( &
t2,'The HYBRD point required ',i5,' iterations',/, &
t2,'There were ',i6,' function calls')
50 format( &
t2,'The HYBRD point required ',i5,' iteration',/, &
t2,'The optimisation required ',i5,' iterations',/, &
t2,'There were ',i6,' function calls')
60 format( &
t2,'The HYBRD point required ',i5,' iterations',/, &
t2,'The optimisation required ',i5,' iteration',/, &
t2,'There were ',i6,' function calls')
70 format( &
t2,'The HYBRD point required ',i5,' iterations',/, &
t2,'The optimisation required ',i5,' iterations',/, &
t2,'There were ',i6,' function calls')
! Required to ensure mfile fully written before any model evaluation
! idempotence checks
flush(mfile)
end subroutine final_output