diff --git a/src/coreprofiles.f90 b/src/coreprofiles.f90 index a9afd97..e3a43da 100644 --- a/src/coreprofiles.f90 +++ b/src/coreprofiles.f90 @@ -371,12 +371,16 @@ contains call dens_spline%init(data%psrad, data%derad, n, range=[zero, data%psrad(n)], & tension=params%sspld, err=err) - ! if failed, re-fit with an interpolating spline (zero tension) + ! Tension is very small, re-fit with an interpolating spline if (err == -1) then - call log_warning('density fit failed with error -1: re-fitting with '// & - 'zero tension', mod='coreprofiles', proc='density') + call log_warning('re-fitting with density curve with zero tension', & + mod='coreprofiles', proc='density') call dens_spline%init(data%psrad, data%derad, n, & range=[zero, data%psrad(n)], tension=zero) + else if (err > 0) then + write (msg, '(a, g0)') 'density fit failed with error ', err + call log_error(msg, mod='coreprofiles', proc='density') + call exit(1) end if ! Computation of the polynomial tail parameters