MinusFermiDerivative Function

private function MinusFermiDerivative(E, mu, KT)

This function calculates -dn(E)/dE, where n(E) is the Fermi distribution function.

\param E Energy at which we want to calculate -dn(E)/dE, in 1/eV \param mu Chemical potential in eV \param KT k_Boltzmann * Temperature, in eV

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: E
real(kind=dp), intent(in) :: mu
real(kind=dp), intent(in) :: KT

Return Value real(kind=dp)


Called by

proc~~minusfermiderivative~~CalledByGraph proc~minusfermiderivative MinusFermiDerivative proc~boltzwann_main boltzwann_main proc~boltzwann_main->proc~minusfermiderivative

Contents

Source Code


Source Code

  function MinusFermiDerivative(E, mu, KT)
    real(kind=dp), intent(in) :: E
    real(kind=dp), intent(in) :: mu
    real(kind=dp), intent(in) :: KT
    real(kind=dp) :: MinusFermiDerivative

    ! I do not put stopwatches here because it would slow down the calculation by orders of magnitude

    ! MaxExp is the maximum value to be used for the exp function.
    ! The function is taken to be zero for x>MaxExp. This value is chosen so that
    ! the function is truncated when its value is smaller than about 1.e-16
    real(kind=dp), parameter :: MaxExp = 36._dp
    real(kind=dp) :: MyExp

    MyExp = (E - mu)/KT
    if (abs(MyExp) > MaxExp) then
      MinusFermiDerivative = 0._dp
    else
      MinusFermiDerivative = 1._dp/KT*exp(MyExp)/((exp(MyExp) + 1._dp)**2)
    end if

  end function MinusFermiDerivative