Allocate arrays and setup data
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ham_logical_type), | intent(inout) | :: | ham_logical | |||
| type(print_output_type), | intent(in) | :: | print_output | |||
| type(ws_region_type), | intent(in) | :: | ws_region | |||
| type(w90_calculation_type), | intent(in) | :: | w90_calculation | |||
| complex(kind=dp), | intent(inout), | allocatable | :: | ham_k(:,:,:) | ||
| complex(kind=dp), | intent(inout), | allocatable | :: | ham_r(:,:,:) | ||
| real(kind=dp), | intent(in) | :: | real_lattice(3,3) | |||
| real(kind=dp), | intent(inout), | allocatable | :: | wannier_centres_translated(:,:) | ||
| integer, | intent(inout), | allocatable | :: | irvec(:,:) | ||
| integer, | intent(in) | :: | mp_grid(3) | |||
| integer, | intent(inout), | allocatable | :: | ndegen(:) | ||
| integer, | intent(in) | :: | num_kpts | |||
| integer, | intent(in) | :: | num_wann | |||
| integer, | intent(inout) | :: | nrpts | |||
| integer, | intent(inout) | :: | rpt_origin | |||
| character(len=*), | intent(in) | :: | bands_plot_mode | |||
| integer, | intent(in) | :: | stdout | |||
| type(timer_list_type), | intent(inout) | :: | timer | |||
| type(w90_error_type), | intent(out), | allocatable | :: | error | ||
| character(len=20), | intent(in) | :: | transport_mode | |||
| type(w90_comm_type), | intent(in) | :: | comm |
subroutine hamiltonian_setup(ham_logical, print_output, ws_region, w90_calculation, ham_k, & ham_r, real_lattice, wannier_centres_translated, irvec, mp_grid, & ndegen, num_kpts, num_wann, nrpts, rpt_origin, bands_plot_mode, & stdout, timer, error, transport_mode, comm) !================================================! ! !! Allocate arrays and setup data ! !================================================! use w90_constants, only: cmplx_0 use w90_types, only: print_output_type, ws_region_type, timer_list_type use w90_wannier90_types, only: w90_calculation_type, ham_logical_type implicit none ! arguments type(ham_logical_type), intent(inout) :: ham_logical type(print_output_type), intent(in) :: print_output type(w90_calculation_type), intent(in) :: w90_calculation type(timer_list_type), intent(inout) :: timer type(w90_error_type), allocatable, intent(out) :: error type(ws_region_type), intent(in) :: ws_region type(w90_comm_type), intent(in) :: comm integer, intent(in) :: mp_grid(3) integer, intent(inout), allocatable :: irvec(:, :) integer, intent(inout), allocatable :: ndegen(:) integer, intent(in) :: num_kpts integer, intent(in) :: num_wann integer, intent(inout) :: nrpts integer, intent(inout) :: rpt_origin integer, intent(in) :: stdout real(kind=dp), intent(in) :: real_lattice(3, 3) real(kind=dp), intent(inout), allocatable :: wannier_centres_translated(:, :) complex(kind=dp), intent(inout), allocatable :: ham_k(:, :, :) complex(kind=dp), intent(inout), allocatable :: ham_r(:, :, :) character(len=*), intent(in) :: bands_plot_mode character(len=20), intent(in) :: transport_mode ! local variables integer :: ierr if (ham_logical%ham_have_setup) return ! ! Determine whether to use translation ! if (w90_calculation%bands_plot .and. (index(bands_plot_mode, 'cut') .ne. 0)) & ham_logical%use_translation = .true. if (w90_calculation%transport .and. (index(transport_mode, 'bulk') .ne. 0)) & ham_logical%use_translation = .true. if (w90_calculation%transport .and. (index(transport_mode, 'lcr') .ne. 0)) & ham_logical%use_translation = .true. ! ! Set up Wigner-Seitz vectors ! call hamiltonian_wigner_seitz(ws_region, print_output, real_lattice, irvec, mp_grid, ndegen, & nrpts, rpt_origin, stdout, timer, error, .true., comm) if (allocated(error)) return allocate (irvec(3, nrpts), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error in allocating irvec in hamiltonian_setup', comm) return end if irvec = 0 allocate (ndegen(nrpts), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error in allocating ndegen in hamiltonian_setup', comm) return end if ndegen = 0 allocate (ham_r(num_wann, num_wann, nrpts), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error in allocating ham_r in hamiltonian_setup', comm) return end if ham_r = cmplx_0 allocate (ham_k(num_wann, num_wann, num_kpts), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error in allocating ham_k in hamiltonian_setup', comm) return end if ham_k = cmplx_0 ! ! Set up the wigner_seitz vectors ! call hamiltonian_wigner_seitz(ws_region, print_output, real_lattice, irvec, mp_grid, ndegen, & nrpts, rpt_origin, stdout, timer, error, .false., comm) if (allocated(error)) return allocate (wannier_centres_translated(3, num_wann), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error allocating wannier_centres_translated in hamiltonian_setup', comm) return end if wannier_centres_translated = 0.0_dp ham_logical%ham_have_setup = .true. return end subroutine hamiltonian_setup