hamiltonian_setup Subroutine

public 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)

Uses

  • proc~~hamiltonian_setup~~UsesGraph proc~hamiltonian_setup hamiltonian_setup module~w90_constants w90_constants proc~hamiltonian_setup->module~w90_constants module~w90_types w90_types proc~hamiltonian_setup->module~w90_types module~w90_wannier90_types w90_wannier90_types proc~hamiltonian_setup->module~w90_wannier90_types module~w90_types->module~w90_constants module~w90_wannier90_types->module~w90_constants

Allocate arrays and setup data

Arguments

Type IntentOptional 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

Calls

proc~~hamiltonian_setup~~CallsGraph proc~hamiltonian_setup hamiltonian_setup proc~hamiltonian_wigner_seitz hamiltonian_wigner_seitz proc~hamiltonian_setup->proc~hamiltonian_wigner_seitz proc~set_error_alloc set_error_alloc proc~hamiltonian_setup->proc~set_error_alloc proc~hamiltonian_wigner_seitz->proc~set_error_alloc proc~io_stopwatch_start io_stopwatch_start proc~hamiltonian_wigner_seitz->proc~io_stopwatch_start proc~io_stopwatch_stop io_stopwatch_stop proc~hamiltonian_wigner_seitz->proc~io_stopwatch_stop proc~set_error_dealloc set_error_dealloc proc~hamiltonian_wigner_seitz->proc~set_error_dealloc proc~set_error_fatal set_error_fatal proc~hamiltonian_wigner_seitz->proc~set_error_fatal proc~utility_metric utility_metric proc~hamiltonian_wigner_seitz->proc~utility_metric proc~comms_sync_error comms_sync_error proc~set_error_alloc->proc~comms_sync_error proc~set_base_error set_base_error proc~set_error_alloc->proc~set_base_error proc~set_error_dealloc->proc~comms_sync_error proc~set_error_dealloc->proc~set_base_error proc~set_error_fatal->proc~comms_sync_error proc~set_error_fatal->proc~set_base_error

Called by

proc~~hamiltonian_setup~~CalledByGraph proc~hamiltonian_setup hamiltonian_setup proc~plot_main plot_main proc~plot_main->proc~hamiltonian_setup proc~tran_main tran_main proc~tran_main->proc~hamiltonian_setup proc~wann_main wann_main proc~wann_main->proc~hamiltonian_setup proc~w90_plot w90_plot proc~w90_plot->proc~plot_main proc~w90_transport w90_transport proc~w90_transport->proc~tran_main proc~w90_wannierise~2 w90_wannierise proc~w90_wannierise~2->proc~wann_main proc~w90_wannierise w90_wannierise proc~w90_wannierise->proc~w90_wannierise~2 program~wannier wannier program~wannier->proc~w90_plot program~wannier->proc~w90_transport program~wannier->proc~w90_wannierise~2

Source Code

  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