w90_wannier90_readwrite_read_disentangle Subroutine

private subroutine w90_wannier90_readwrite_read_disentangle(settings, dis_control, dis_spheres, num_bands, num_wann, bohr, error, comm)

Uses

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

Arguments

Type IntentOptional Attributes Name
type(settings_type), intent(inout) :: settings
type(dis_control_type), intent(inout) :: dis_control
type(dis_spheres_type), intent(inout) :: dis_spheres
integer, intent(in) :: num_bands
integer, intent(in) :: num_wann
real(kind=dp), intent(in) :: bohr
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Calls

proc~~w90_wannier90_readwrite_read_disentangle~~CallsGraph proc~w90_wannier90_readwrite_read_disentangle w90_wannier90_readwrite_read_disentangle proc~set_error_alloc set_error_alloc proc~w90_wannier90_readwrite_read_disentangle->proc~set_error_alloc proc~set_error_input set_error_input proc~w90_wannier90_readwrite_read_disentangle->proc~set_error_input proc~w90_readwrite_get_keyword w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_disentangle->proc~w90_readwrite_get_keyword proc~w90_readwrite_get_keyword_block w90_readwrite_get_keyword_block proc~w90_wannier90_readwrite_read_disentangle->proc~w90_readwrite_get_keyword_block 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_block->proc~set_error_input proc~w90_readwrite_get_keyword_block->proc~set_error_fatal proc~set_error_fatal->proc~comms_sync_error proc~set_error_fatal->proc~set_base_error

Called by

proc~~w90_wannier90_readwrite_read_disentangle~~CalledByGraph proc~w90_wannier90_readwrite_read_disentangle w90_wannier90_readwrite_read_disentangle proc~w90_wannier90_readwrite_read w90_wannier90_readwrite_read proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_disentangle proc~w90_input_reader~2 w90_input_reader proc~w90_input_reader~2->proc~w90_wannier90_readwrite_read proc~w90_input_setopt w90_input_setopt proc~w90_input_setopt->proc~w90_wannier90_readwrite_read proc~w90_input_reader w90_input_reader proc~w90_input_reader->proc~w90_input_reader~2 proc~w90_input_setopt_f w90_input_setopt_f proc~w90_input_setopt_f->proc~w90_input_setopt program~wannier wannier program~wannier->proc~w90_input_reader~2

Source Code

  subroutine w90_wannier90_readwrite_read_disentangle(settings, dis_control, dis_spheres, &
                                                      num_bands, num_wann, bohr, error, comm)
    !================================================!
    use w90_error, only: w90_error_type
    implicit none

    integer, intent(in) :: num_bands, num_wann
    real(kind=dp), intent(in) :: bohr
    type(dis_control_type), intent(inout) :: dis_control
    type(dis_spheres_type), intent(inout) :: dis_spheres
    type(settings_type), intent(inout) :: settings
    type(w90_comm_type), intent(in) :: comm
    type(w90_error_type), allocatable, intent(out) :: error

    integer :: nkp, ierr
    logical :: found

    call w90_readwrite_get_keyword(settings, 'dis_num_iter', found, error, comm, &
                                   i_value=dis_control%num_iter)
    if (allocated(error)) return
    if (dis_control%num_iter < 0) then
      call set_error_input(error, 'Error: dis_num_iter must be positive', comm)
      return
    end if

    call w90_readwrite_get_keyword(settings, 'dis_mix_ratio', found, error, comm, &
                                   r_value=dis_control%mix_ratio)
    if (allocated(error)) return
    if (dis_control%mix_ratio <= 0.0_dp .or. dis_control%mix_ratio > 1.0_dp) then
      call set_error_input(error, 'Error: dis_mix_ratio must be greater than 0.0 but not greater than 1.0', comm)
      return
    end if

    call w90_readwrite_get_keyword(settings, 'dis_conv_tol', found, error, comm, &
                                   r_value=dis_control%conv_tol)
    if (allocated(error)) return
    if (dis_control%conv_tol < 0.0_dp) then
      call set_error_input(error, 'Error: dis_conv_tol must be positive', comm)
      return
    end if

    call w90_readwrite_get_keyword(settings, 'dis_conv_window', found, error, comm, &
                                   i_value=dis_control%conv_window)
    if (allocated(error)) return
    if (dis_control%conv_window < 0) then
      call set_error_input(error, 'Error: dis_conv_window must be positive', comm)
      return
    end if

    ! GS-start
    call w90_readwrite_get_keyword(settings, 'dis_spheres_first_wann', found, error, comm, &
                                   i_value=dis_spheres%first_wann)
    if (allocated(error)) return
    if (dis_spheres%first_wann < 1) then
      call set_error_input(error, 'Error: dis_spheres_first_wann must be greater than 0', comm)
      return
    end if
    if (dis_spheres%first_wann > num_bands - num_wann + 1) then
      call set_error_input(error, 'Error: dis_spheres_first_wann is larger than num_bands-num_wann+1', comm)
      return
    end if
    call w90_readwrite_get_keyword(settings, 'dis_spheres_num', found, error, comm, &
                                   i_value=dis_spheres%num)
    if (allocated(error)) return
    if (dis_spheres%num < 0) then
      call set_error_input(error, 'Error: dis_spheres_num cannot be negative', comm)
      return
    end if
    if (dis_spheres%num > 0) then
      allocate (dis_spheres%spheres(4, dis_spheres%num), stat=ierr)
      if (ierr /= 0) then
        call set_error_alloc(error, 'Error allocating dis_spheres in w90_wannier90_readwrite_read_disentangle', comm)
        return
      end if
      call w90_readwrite_get_keyword_block(settings, 'dis_spheres', found, dis_spheres%num, 4, &
                                           bohr, error, comm, r_value=dis_spheres%spheres)
      if (allocated(error)) return
      if (.not. found) then
        call set_error_input(error, 'Error: Did not find dis_spheres in the input file', comm)
        return
      end if
      do nkp = 1, dis_spheres%num
        if (dis_spheres%spheres(4, nkp) < 1.0e-15_dp) then
          call set_error_input(error, 'Error: radius for dis_spheres must be > 0', comm)
          return
        end if
      end do
    end if
    ! GS-end
  end subroutine w90_wannier90_readwrite_read_disentangle