diff --git a/src/coreprofiles.f90 b/src/coreprofiles.f90 index 3e0b7ba..014b7d6 100644 --- a/src/coreprofiles.f90 +++ b/src/coreprofiles.f90 @@ -65,9 +65,8 @@ contains dens = 0 ddens = 0 - ! Outside the tail end both density and its - ! derivatives are identically zero - if (psin >= tail%end .or. psin < 0) return + ! Bail out when ψ is not available + if (psin < 0) return if (iprof == 0) then ! Use the analytical model @@ -81,6 +80,10 @@ contains else ! Use the numerical data + ! Past the tail end both density and its + ! derivatives are identically zero + if (psin >= tail%end) return + if (psin < tail%start) then ! Use the interpolating spline when in range