anchor.diff:  
   
   
  -  function Eigfunc(Ak,alpha,lamc,xpos)
  -  ! Used in KLrxi_point to call reconstructed realization at given point
  +  function Eigfunc(Ak,alpha,lamc,xpos,orderin)
  +  ! Evaluates Eigenfunction term for any order (0+) derivative of the eigenfunction
     real(8) :: Ak,alpha,lamc,xpos,Eigfunc
  -
  -  Eigfunc = Ak * ( sin(alpha*xpos) + lamc*alpha*cos(alpha*xpos) )
  +  integer, optional :: orderin
  +  integer :: order
  +
  +  order = merge(orderin,0,present(orderin))
  +  select case (mod(order,4))
  +    case (0)
  +      Eigfunc = Ak * ( sin(alpha*xpos) + lamc*alpha*cos(alpha*xpos) )
  +    case (1)
  +      Eigfunc = Ak * (-cos(alpha*xpos) + lamc*alpha*sin(alpha*xpos) )
  +    case (2)
  +      Eigfunc = Ak * (-sin(alpha*xpos) - lamc*alpha*cos(alpha*xpos) )
  +    case (3)
  +      Eigfunc = Ak * ( cos(alpha*xpos) - lamc*alpha*sin(alpha*xpos) )
  +  end select
  +  Eigfunc = Eigfunc/(alpha**order)
   
     end function Eigfunc
  +
  +
  +
  +  subroutine KLr_setmeans(order,tmeanadjust,tsigsmeanadjust,tsigameanadjust,tsigave,tsigscatave,tsigabsave)
  +  !This subroutine sets values for non-x-dependent terms based on derivative order
  +  use genRealzvars, only: sigave, sigscatave, sigabsave
  +  use KLvars, only: meanadjust, sigsmeanadjust, sigameanadjust
  +
  +  integer :: order
  +  real(8) :: tmeanadjust,tsigsmeanadjust,tsigameanadjust,tsigave,tsigscatave,tsigabsave
  +  if(order==0) then
  +    tmeanadjust     = meanadjust
  +    tsigsmeanadjust = sigsmeanadjust
  +    tsigameanadjust = sigameanadjust
  +    tsigave         = sigave
  +    tsigscatave     = sigscatave
  +    tsigabsave      = sigabsave
  +  else
  +    tmeanadjust     = 0
  +    tsigsmeanadjust = 0
  +    tsigameanadjust = 0
  +    tsigave         = 0
  +    tsigscatave     = 0
  +    tsigabsave      = 0
  +  endif
  +
  +  end subroutine KLr_setmeans
  +
   
   
   end module KLreconstruct
  
positive.code: 
  
  
  
    function KLrxi_integral(j,xl,xr,chxstype,tnumEigsin) result(KL_int)
    !This function integrates on KL reconstructed realizations from xl to xr.
    !Integration is always on total cross section, but 'material'- or 'totxs'-
    !cross sections are adjusted with or without meanadjust.
    use genRealzvars, only: lamc, sigave, Coscat, Coabs, scatrat, sigscatave, sigabsave
    use KLvars, only: alpha, Ak, Eig, numEigs, KLrxivals, meanadjust, flmatbasedxs, &
                      sigsmeanadjust, sigameanadjust
  
negative.code:   elseif(flmatbasedxs) then
      !cross section values
      if(chxstype .ne. 'scatter') &
        siga = tsigabsave  + tsigameanadjust + sqrt(Coabs)  * KL_sum
      if(chxstype .ne. 'absorb') &
        sigs = tsigscatave + tsigsmeanadjust + sqrt(Coscat) * KL_sum
      !determine point value
      select case (chxstype)
        case ("total")
  