!
! License-Identifier: GPL
!
! Copyright (C) 2026 The Yambo Team
!
! Authors (see AUTHORS file for details): CA
!
module smearing
 !
 contains
 !
 elemental function smear_r(x ,damp, damp_type)
   use pars,       ONLY:SP,schlen
   use stderr,     ONLY:STRING_match     
   use functions,  ONLY:Fermi_fnc_derivative,Lorentzian_func,Gaussian_func
   real(SP), intent(in)          :: x, damp
   character(schlen), intent(in) :: damp_type
   !
   real(SP) :: smear_r
   !
   if(trim(damp_type)=="Lorentzian") then
     smear_r=Lorentzian_func(x ,damp)
   elseif(trim(damp_type)=="Gaussian") then
     smear_r=Gaussian_func(x, damp)  
   elseif(trim(damp_type)=="FermiDer") then
     smear_r=Fermi_fnc_derivative(x, damp)
   endif
 end function smear_r
 !
 elemental function delta_rep(W, pole, ordering, damp_type)
     use pars,       ONLY:SP,schlen
     use stderr,     ONLY:STRING_match     
     use functions,  ONLY:Lorentzian_FT,Gaussian_FT
     !
     implicit none
     ! 
     complex(SP), intent(in)       :: pole, W
     character(*), intent(in)      :: ordering
     character(schlen), intent(in) :: damp_type
     !
     complex(SP)              :: delta_rep
     ! 
     if (trim(damp_type)=="Lorentzian") then
        delta_rep=Lorentzian_FT(W, pole, ordering)
     elseif (trim(damp_type)=="Gaussian") then
        delta_rep=Gaussian_FT(W, pole, ordering)
     endif
     !   
 end function delta_rep
 !
end module smearing
