subroutine sitesym_slim_d_matrix_band(num_bands, num_kpts, sitesym, lwindow_in)
!================================================!
! not called !
use w90_wannier90_types, only: sitesym_type
implicit none
integer, intent(in) :: num_bands
integer, intent(in) :: num_kpts
logical, optional, intent(in) :: lwindow_in(num_bands, num_kpts)
type(sitesym_type), intent(inout) :: sitesym
integer :: ik, i, j, nb, ir
integer :: nindx(num_bands)
do ir = 1, sitesym%nkptirr
ik = sitesym%ir2ik(ir)
j = 0
do i = 1, num_bands
if (lwindow_in(i, ik)) then
j = j + 1
nindx(j) = i
end if
end do
nb = j
do j = 1, nb
i = nindx(j)
sitesym%d_matrix_band(1:nb, j, :, ir) = sitesym%d_matrix_band(nindx(1:nb), i, :, ir)
if (nb .lt. num_bands) then
sitesym%d_matrix_band(nb + 1:, j, :, ir) = 0
end if
end do
end do
return
end subroutine sitesym_slim_d_matrix_band