Allocate arrays and setup data
subroutine hamiltonian_setup()
!! Allocate arrays and setup data
!============================================!
use w90_constants, only: cmplx_0
use w90_io, only: io_error
use w90_parameters, only: num_wann, num_kpts, bands_plot, transport, &
bands_plot_mode, transport_mode
implicit none
integer :: ierr
if (ham_have_setup) return
!
! Determine whether to use translation
!
if (bands_plot .and. (index(bands_plot_mode, 'cut') .ne. 0)) use_translation = .true.
if (transport .and. (index(transport_mode, 'bulk') .ne. 0)) use_translation = .true.
if (transport .and. (index(transport_mode, 'lcr') .ne. 0)) use_translation = .true.
!
! Set up Wigner-Seitz vectors
!
call hamiltonian_wigner_seitz(count_pts=.true.)
!
allocate (irvec(3, nrpts), stat=ierr)
if (ierr /= 0) call io_error('Error in allocating irvec in hamiltonian_setup')
irvec = 0
!
allocate (ndegen(nrpts), stat=ierr)
if (ierr /= 0) call io_error('Error in allocating ndegen in hamiltonian_setup')
ndegen = 0
!
allocate (ham_r(num_wann, num_wann, nrpts), stat=ierr)
if (ierr /= 0) call io_error('Error in allocating ham_r in hamiltonian_setup')
ham_r = cmplx_0
!
allocate (ham_k(num_wann, num_wann, num_kpts), stat=ierr)
if (ierr /= 0) call io_error('Error in allocating ham_k in hamiltonian_setup')
ham_k = cmplx_0
!
! Set up the wigner_seitz vectors
!
call hamiltonian_wigner_seitz(count_pts=.false.)
!
allocate (wannier_centres_translated(3, num_wann), stat=ierr)
if (ierr /= 0) call io_error('Error allocating wannier_centres_translated in hamiltonian_setup')
wannier_centres_translated = 0.0_dp
ham_have_setup = .true.
return
end subroutine hamiltonian_setup