w90_wannier90_readwrite_read_gyrotropic Subroutine

private subroutine w90_wannier90_readwrite_read_gyrotropic(settings, pw90_gyrotropic, num_wann, smr_fixed_en_width, smr_index, error, comm)

Uses

  • proc~~w90_wannier90_readwrite_read_gyrotropic~~UsesGraph proc~w90_wannier90_readwrite_read_gyrotropic w90_wannier90_readwrite_read_gyrotropic module~w90_comms w90_comms proc~w90_wannier90_readwrite_read_gyrotropic->module~w90_comms module~w90_error w90_error proc~w90_wannier90_readwrite_read_gyrotropic->module~w90_error module~w90_constants w90_constants module~w90_comms->module~w90_constants module~w90_error_base w90_error_base module~w90_comms->module~w90_error_base module~w90_error->module~w90_comms module~w90_error->module~w90_error_base

Arguments

Type IntentOptional Attributes Name
type(settings_type), intent(inout) :: settings
type(pw90_gyrotropic_type), intent(out) :: pw90_gyrotropic
integer, intent(in) :: num_wann
real(kind=dp), intent(in) :: smr_fixed_en_width
integer, intent(in) :: smr_index
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Calls

proc~~w90_wannier90_readwrite_read_gyrotropic~~CallsGraph proc~w90_wannier90_readwrite_read_gyrotropic w90_wannier90_readwrite_read_gyrotropic proc~set_error_alloc set_error_alloc proc~w90_wannier90_readwrite_read_gyrotropic->proc~set_error_alloc proc~set_error_input set_error_input proc~w90_wannier90_readwrite_read_gyrotropic->proc~set_error_input proc~w90_readwrite_get_keyword w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_gyrotropic->proc~w90_readwrite_get_keyword proc~w90_readwrite_get_keyword_vector w90_readwrite_get_keyword_vector proc~w90_wannier90_readwrite_read_gyrotropic->proc~w90_readwrite_get_keyword_vector proc~w90_readwrite_get_range_vector w90_readwrite_get_range_vector proc~w90_wannier90_readwrite_read_gyrotropic->proc~w90_readwrite_get_range_vector proc~w90_readwrite_get_smearing_index w90_readwrite_get_smearing_index proc~w90_wannier90_readwrite_read_gyrotropic->proc~w90_readwrite_get_smearing_index 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_input->proc~comms_sync_error proc~set_error_input->proc~set_base_error proc~w90_readwrite_get_keyword->proc~set_error_input proc~set_error_fatal set_error_fatal proc~w90_readwrite_get_keyword->proc~set_error_fatal proc~w90_readwrite_get_keyword_vector->proc~set_error_input proc~w90_readwrite_get_keyword_vector->proc~set_error_fatal proc~w90_readwrite_get_range_vector->proc~set_error_input proc~w90_readwrite_get_range_vector->proc~w90_readwrite_get_keyword_vector proc~w90_readwrite_get_vector_length w90_readwrite_get_vector_length proc~w90_readwrite_get_range_vector->proc~w90_readwrite_get_vector_length proc~w90_readwrite_get_smearing_index->proc~set_error_input proc~set_error_fatal->proc~comms_sync_error proc~set_error_fatal->proc~set_base_error proc~w90_readwrite_get_vector_length->proc~set_error_input proc~w90_readwrite_get_vector_length->proc~set_error_fatal

Called by

proc~~w90_wannier90_readwrite_read_gyrotropic~~CalledByGraph proc~w90_wannier90_readwrite_read_gyrotropic w90_wannier90_readwrite_read_gyrotropic proc~w90_postw90_readwrite_read w90_postw90_readwrite_read proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_gyrotropic proc~w90_postw90_readwrite_readall w90_postw90_readwrite_readall proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_gyrotropic program~postw90 postw90 program~postw90->proc~w90_postw90_readwrite_read

Source Code

  subroutine w90_wannier90_readwrite_read_gyrotropic(settings, pw90_gyrotropic, num_wann, &
                                                     smr_fixed_en_width, smr_index, error, comm)
    !================================================!

    use w90_error, only: w90_error_type
    use w90_comms, only: w90_comm_type

    implicit none
    type(pw90_gyrotropic_type), intent(out) :: pw90_gyrotropic
    integer, intent(in) :: num_wann
    real(kind=dp), intent(in) :: smr_fixed_en_width
    integer, intent(in) :: smr_index
    type(w90_error_type), allocatable, intent(out) :: error
    type(w90_comm_type), intent(in) :: comm
    type(settings_type), intent(inout) :: settings

    real(kind=dp) :: smr_max_arg
    real(kind=dp)                   :: gyrotropic_box_tmp(3)
    integer :: i, ierr, loop
    logical :: found
    character(len=maxlen)              :: ctmp

    ! Stepan
    call w90_readwrite_get_keyword(settings, 'gyrotropic_task', found, error, comm, &
                                   c_value=pw90_gyrotropic%task)
    if (allocated(error)) return
    call w90_readwrite_get_keyword(settings, 'gyrotropic_degen_thresh', found, error, comm, &
                                   r_value=pw90_gyrotropic%degen_thresh)
    if (allocated(error)) return

    do i = 1, 3
      pw90_gyrotropic%box(i, i) = 1.0_dp
      gyrotropic_box_tmp(:) = 0.0_dp
      call w90_readwrite_get_keyword_vector(settings, 'gyrotropic_box_b'//achar(48 + i), found, &
                                            3, error, comm, r_value=gyrotropic_box_tmp)
      if (allocated(error)) return
      if (found) pw90_gyrotropic%box(i, :) = gyrotropic_box_tmp(:)
    end do
    call w90_readwrite_get_keyword_vector(settings, 'gyrotropic_box_center', found, 3, error, &
                                          comm, r_value=gyrotropic_box_tmp)
    if (allocated(error)) return
    if (found) pw90_gyrotropic%box_corner(:) = &
      gyrotropic_box_tmp(:) - 0.5*(pw90_gyrotropic%box(1, :) + pw90_gyrotropic%box(2, :) + &
                                   pw90_gyrotropic%box(3, :))

    call w90_readwrite_get_range_vector(settings, 'gyrotropic_band_list', found, &
                                        pw90_gyrotropic%num_bands, .true., error, comm)
    if (allocated(error)) return
    if (found) then
      if (pw90_gyrotropic%num_bands < 1) then
        call set_error_input(error, 'Error: problem reading gyrotropic_band_list', comm)
        return
      end if
      if (allocated(pw90_gyrotropic%band_list)) deallocate (pw90_gyrotropic%band_list)
      allocate (pw90_gyrotropic%band_list(pw90_gyrotropic%num_bands), stat=ierr)
      if (ierr /= 0) then
        call set_error_alloc(error, 'Error allocating gyrotropic_band_list in w90_wannier90_readwrite_read', comm)
        return
      end if
      call w90_readwrite_get_range_vector(settings, 'gyrotropic_band_list', found, &
                                          pw90_gyrotropic%num_bands, .false., error, comm, &
                                          pw90_gyrotropic%band_list)
      if (allocated(error)) return
      if (any(pw90_gyrotropic%band_list < 1) .or. any(pw90_gyrotropic%band_list > num_wann)) then
        call set_error_input(error, 'Error: gyrotropic_band_list asks for a non-valid bands', comm)
        return
      end if
    else
      ! include all bands in the calculation
      pw90_gyrotropic%num_bands = num_wann
      if (allocated(pw90_gyrotropic%band_list)) deallocate (pw90_gyrotropic%band_list)
      allocate (pw90_gyrotropic%band_list(pw90_gyrotropic%num_bands), stat=ierr)
      if (ierr /= 0) then
        call set_error_alloc(error, 'Error allocating gyrotropic_band_list in w90_wannier90_readwrite_read', comm)
        return
      end if
      do loop = 1, num_wann
        pw90_gyrotropic%band_list(loop) = loop
      end do
    end if

    pw90_gyrotropic%smearing%use_adaptive = .false.
    smr_max_arg = 5.0
    call w90_readwrite_get_keyword(settings, 'smr_max_arg', found, error, comm, r_value=smr_max_arg)
    if (allocated(error)) return
    if (found .and. (smr_max_arg <= 0._dp)) then
      call set_error_input(error, 'Error: smr_max_arg must be greater than zero', comm)
      return
    end if

    pw90_gyrotropic%smearing%max_arg = smr_max_arg
    call w90_readwrite_get_keyword(settings, 'gyrotropic_smr_max_arg', found, error, comm, &
                                   r_value=pw90_gyrotropic%smearing%max_arg)
    if (allocated(error)) return
    if (found .and. (pw90_gyrotropic%smearing%max_arg <= 0._dp)) then
      call set_error_input(error, 'Error: gyrotropic_smr_max_arg must be greater than zero', comm)
      return
    end if

    pw90_gyrotropic%smearing%fixed_width = smr_fixed_en_width
    call w90_readwrite_get_keyword(settings, 'gyrotropic_smr_fixed_en_width', found, error, comm, &
                                   r_value=pw90_gyrotropic%smearing%fixed_width)
    if (allocated(error)) return
    if (found .and. (pw90_gyrotropic%smearing%fixed_width < 0._dp)) then
      call set_error_input(error, 'Error: gyrotropic_smr_fixed_en_width must be greater than or equal to zero', comm)
      return
    end if

    ! By default: use the "global" smearing index
    pw90_gyrotropic%smearing%type_index = smr_index
    call w90_readwrite_get_keyword(settings, 'gyrotropic_smr_type', found, error, comm, &
                                   c_value=ctmp)
    if (allocated(error)) return
    if (found) then
      pw90_gyrotropic%smearing%type_index = w90_readwrite_get_smearing_index(ctmp, &
                                                                             'gyrotropic_smr_type', &
                                                                             error, comm)
      if (allocated(error)) return
    end if

  end subroutine w90_wannier90_readwrite_read_gyrotropic