Commit 5d6ef3d4 authored by Henning Janssen's avatar Henning Janssen

Forgot the file

parent cc703904
MODULE m_lorentzian_smooth
USE m_constants
IMPLICIT NONE
!PARAMETER FOR LORENTZIAN SMOOTHING
REAL, PARAMETER :: cut = 1e-8
CONTAINS
!This is essentially smooth out of m_smooth but with a lorentzian distribution
SUBROUTINE lorentzian_smooth(e,f,sigma,n)
INTEGER, INTENT(IN) :: n
REAL, INTENT(INOUT) :: f(:)
REAL, INTENT(IN) :: sigma
REAL, INTENT(IN) :: e(:)
REAL :: dx
REAL :: f0(n), ee(n)
INTEGER :: ie , je , j1 , j2 , numPoints
f0 = f
f = 0.0
ee = 0.0
dx = e(2)-e(1)
DO ie =1, n
ee(ie) = 1/pi_const * sigma/dx * 1.0/((ie-1)**2+(sigma/dx)**2)
IF ( ee(ie).LT.cut ) EXIT
ENDDO
numPoints = ie - 1
DO ie = 1, n
j1 = ie - numPoints + 1
j1 = MERGE(1,j1,j1.LT.1)
j2 = ie + numPoints - 1
j2 = MERGE(n,j2,j2.GT.n)
DO je = j1 , j2
f(ie) = f(ie) + ee(IABS(je-ie)+1)*f0(je)
ENDDO
ENDDO
END SUBROUTINE lorentzian_smooth
END MODULE m_lorentzian_smooth
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment