This subroutine calculates the level spacing, i.e. how much the level changes near a given point of the interpolation mesh
Type  Intent  Optional  Attributes  Name  

real(kind=dp),  intent(in),  dimension(num_wann, 3)  ::  del_eig  Band velocities, already corrected when degeneracies occur 

integer,  intent(in),  dimension(3)  ::  kmesh  array of three integers, giving the number of k points along each of the three directions defined by the reciprocal lattice vectors 

real(kind=dp),  intent(out),  dimension(num_wann)  ::  levelspacing  On output, the spacing for each of the bands (in eV) 
subroutine dos_get_levelspacing(del_eig, kmesh, levelspacing)
!! This subroutine calculates the level spacing, i.e. how much the level changes
!! near a given point of the interpolation mesh
use w90_parameters, only: num_wann
use w90_postw90_common, only: pw90common_kmesh_spacing
real(kind=dp), dimension(num_wann, 3), intent(in) :: del_eig
!! Band velocities, already corrected when degeneracies occur
integer, dimension(3), intent(in) :: kmesh
!! array of three integers, giving the number of k points along
!! each of the three directions defined by the reciprocal lattice vectors
real(kind=dp), dimension(num_wann), intent(out) :: levelspacing
!! On output, the spacing for each of the bands (in eV)
real(kind=dp) :: Delta_k
integer :: band
Delta_k = pw90common_kmesh_spacing(kmesh)
do band = 1, num_wann
levelspacing(band) = &
sqrt(dot_product(del_eig(band, :), del_eig(band, :)))*Delta_k
end do
end subroutine dos_get_levelspacing