w90_wannier90_readwrite_read_dos Subroutine

private subroutine w90_wannier90_readwrite_read_dos(settings, pw90_calculation, pw90_dos, found_fermi_energy, num_wann, pw90_smearing, dos_plot, error, comm)

Uses

  • proc~~w90_wannier90_readwrite_read_dos~~UsesGraph proc~w90_wannier90_readwrite_read_dos w90_wannier90_readwrite_read_dos module~w90_comms w90_comms proc~w90_wannier90_readwrite_read_dos->module~w90_comms module~w90_error w90_error proc~w90_wannier90_readwrite_read_dos->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_calculation_type), intent(in) :: pw90_calculation
type(pw90_dos_mod_type), intent(inout) :: pw90_dos
logical, intent(in) :: found_fermi_energy
integer, intent(in) :: num_wann
type(pw90_smearing_type), intent(in) :: pw90_smearing
logical, intent(out) :: dos_plot
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Calls

proc~~w90_wannier90_readwrite_read_dos~~CallsGraph proc~w90_wannier90_readwrite_read_dos w90_wannier90_readwrite_read_dos proc~set_error_alloc set_error_alloc proc~w90_wannier90_readwrite_read_dos->proc~set_error_alloc proc~set_error_input set_error_input proc~w90_wannier90_readwrite_read_dos->proc~set_error_input proc~w90_readwrite_get_keyword w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_dos->proc~w90_readwrite_get_keyword proc~w90_readwrite_get_range_vector w90_readwrite_get_range_vector proc~w90_wannier90_readwrite_read_dos->proc~w90_readwrite_get_range_vector proc~w90_readwrite_get_smearing_index w90_readwrite_get_smearing_index proc~w90_wannier90_readwrite_read_dos->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_range_vector->proc~set_error_input proc~w90_readwrite_get_keyword_vector w90_readwrite_get_keyword_vector 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_keyword_vector->proc~set_error_input proc~w90_readwrite_get_keyword_vector->proc~set_error_fatal 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_dos~~CalledByGraph proc~w90_wannier90_readwrite_read_dos w90_wannier90_readwrite_read_dos proc~w90_postw90_readwrite_read w90_postw90_readwrite_read proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_dos proc~w90_postw90_readwrite_readall w90_postw90_readwrite_readall proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_dos program~postw90 postw90 program~postw90->proc~w90_postw90_readwrite_read

Source Code

  subroutine w90_wannier90_readwrite_read_dos(settings, pw90_calculation, pw90_dos, &
                                              found_fermi_energy, num_wann, pw90_smearing, &
                                              dos_plot, error, comm)
    !================================================!

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

    implicit none

    type(pw90_calculation_type), intent(in) :: pw90_calculation
    type(pw90_dos_mod_type), intent(inout) :: pw90_dos
    type(pw90_smearing_type), intent(in) :: pw90_smearing
    type(w90_error_type), allocatable, intent(out) :: error
    type(w90_comm_type), intent(in) :: comm
    type(settings_type), intent(inout) :: settings

    integer, intent(in) :: num_wann
    logical, intent(out) :: dos_plot
    logical, intent(in) :: found_fermi_energy

    integer :: i, ierr
    logical :: found
    character(len=maxlen)              :: ctmp

    if (pw90_calculation%dos) then
      dos_plot = .true.
    else
      dos_plot = .false.
    end if
    call w90_readwrite_get_keyword(settings, 'dos_task', found, error, comm, c_value=pw90_dos%task)
    if (allocated(error)) return
    if (pw90_calculation%dos) then
      if (index(pw90_dos%task, 'dos_plot') == 0 .and. &
          index(pw90_dos%task, 'find_fermi_energy') == 0) then
        call set_error_input(error, 'Error: value of dos_task not recognised in w90_wannier90_readwrite_read', comm)
        return
      end if
      if (index(pw90_dos%task, 'dos_plot') > 0) dos_plot = .true.
      if (index(pw90_dos%task, 'find_fermi_energy') > 0 .and. found_fermi_energy) then
        call set_error_input(error, 'Error: Cannot set "dos_task = find_fermi_energy" and give a value to "fermi_energy"', comm)
        return
      end if
    end if

!    sigma_abc_onlyorb=.false.
!    call w90_readwrite_get_keyword(settings, 'sigma_abc_onlyorb',found,l_value=sigma_abc_onlyorb)

! -------------------------------------------------------------------

    !IVO_END

    call w90_readwrite_get_keyword(settings, 'dos_energy_step', found, error, comm, &
                                   r_value=pw90_dos%energy_step)
    if (allocated(error)) return

    pw90_dos%smearing%use_adaptive = pw90_smearing%use_adaptive
    call w90_readwrite_get_keyword(settings, 'dos_adpt_smr', found, error, comm, &
                                   l_value=pw90_dos%smearing%use_adaptive)
    if (allocated(error)) return

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

    pw90_dos%smearing%adaptive_max_width = pw90_smearing%adaptive_max_width
    call w90_readwrite_get_keyword(settings, 'dos_adpt_smr_max', found, error, comm, &
                                   r_value=pw90_dos%smearing%adaptive_max_width)
    if (allocated(error)) return
    if (pw90_dos%smearing%adaptive_max_width <= 0._dp) then
      call set_error_input(error, 'Error: dos_adpt_smr_max must be greater than zero', comm)
      return
    end if

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

!    dos_gaussian_width        = 0.1_dp
!    call w90_readwrite_get_keyword(settings, 'dos_gaussian_width',found,r_value=dos_gaussian_width)

!    dos_plot_format           = 'gnuplot'
!    call w90_readwrite_get_keyword(settings, 'dos_plot_format',found,c_value=dos_plot_format)

    call w90_readwrite_get_range_vector(settings, 'dos_project', found, pw90_dos%num_project, &
                                        .true., error, comm)
    if (allocated(error)) return
    if (found) then
      if (pw90_dos%num_project < 1) then
        call set_error_input(error, 'Error: problem reading dos_project', comm)
        return
      end if
      if (allocated(pw90_dos%project)) deallocate (pw90_dos%project)
      allocate (pw90_dos%project(pw90_dos%num_project), stat=ierr)
      if (ierr /= 0) then
        call set_error_alloc(error, 'Error allocating dos_project in w90_wannier90_readwrite_read', comm)
        return
      end if
      call w90_readwrite_get_range_vector(settings, 'dos_project', found, pw90_dos%num_project, &
                                          .false., error, comm, pw90_dos%project)
      if (allocated(error)) return
      if (any(pw90_dos%project < 1) .or. &
          any(pw90_dos%project > num_wann)) then
        call set_error_input(error, 'Error: dos_project asks for out-of-range Wannier functions', comm)
        return
      end if
    else
      ! by default plot all
      pw90_dos%num_project = num_wann
      if (allocated(pw90_dos%project)) deallocate (pw90_dos%project)
      allocate (pw90_dos%project(pw90_dos%num_project), stat=ierr)
      if (ierr /= 0) then
        call set_error_alloc(error, 'Error allocating dos_project in w90_wannier90_readwrite_read', comm)
        return
      end if
      do i = 1, pw90_dos%num_project
        pw90_dos%project(i) = i
      end do
    end if

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

  end subroutine w90_wannier90_readwrite_read_dos