w90_readwrite_read_units Subroutine

public subroutine w90_readwrite_read_units(settings, lenconfac, length_unit, energy_unit, bohr, error, comm)

Uses

  • proc~~w90_readwrite_read_units~~UsesGraph proc~w90_readwrite_read_units w90_readwrite_read_units module~w90_error w90_error proc~w90_readwrite_read_units->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

reads the "energy_unit" and "length_unit" (valid: "ang" or "bohr") variables

Arguments

Type IntentOptional Attributes Name
type(settings_type), intent(inout) :: settings
real(kind=dp), intent(inout) :: lenconfac
character(len=*), intent(inout) :: length_unit
character(len=*), intent(inout) :: energy_unit
real(kind=dp), intent(in) :: bohr
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Calls

proc~~w90_readwrite_read_units~~CallsGraph proc~w90_readwrite_read_units w90_readwrite_read_units proc~set_error_input set_error_input proc~w90_readwrite_read_units->proc~set_error_input proc~w90_readwrite_get_keyword w90_readwrite_get_keyword proc~w90_readwrite_read_units->proc~w90_readwrite_get_keyword proc~comms_sync_error comms_sync_error proc~set_error_input->proc~comms_sync_error proc~set_base_error set_base_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~set_error_fatal->proc~comms_sync_error proc~set_error_fatal->proc~set_base_error

Called by

proc~~w90_readwrite_read_units~~CalledByGraph proc~w90_readwrite_read_units w90_readwrite_read_units proc~w90_postw90_readwrite_read w90_postw90_readwrite_read proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_units proc~w90_wannier90_readwrite_read w90_wannier90_readwrite_read proc~w90_wannier90_readwrite_read->proc~w90_readwrite_read_units 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 program~postw90 postw90 program~postw90->proc~w90_postw90_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_readwrite_read_units(settings, lenconfac, length_unit, energy_unit, bohr, error, &
                                      comm)
    !! reads the "energy_unit" and "length_unit" (valid: "ang" or "bohr") variables
    use w90_error, only: w90_error_type, set_error_input
    implicit none
    character(len=*), intent(inout) :: energy_unit
    character(len=*), intent(inout) :: length_unit
    real(kind=dp), intent(in) :: bohr
    real(kind=dp), intent(inout) :: lenconfac
    type(settings_type), intent(inout) :: settings
    type(w90_comm_type), intent(in) :: comm
    type(w90_error_type), allocatable, intent(out) :: error

    integer :: ic
    logical :: found

    call w90_readwrite_get_keyword(settings, 'energy_unit', found, error, comm, c_value=energy_unit)
    if (allocated(error)) return

    call w90_readwrite_get_keyword(settings, 'length_unit', found, error, comm, c_value=length_unit)
    if (allocated(error)) return
    if (found) then
      if (length_unit .ne. 'ang' .and. length_unit .ne. 'bohr') then
        call set_error_input(error, &
                             'Error: value of length_unit not recognised in w90_readwrite_read_units', comm)
        return
      else if (length_unit .eq. 'bohr') then
        lenconfac = 1.0_dp/bohr
      end if
    end if

    ! Length unit (ang --> Ang, bohr --> Bohr) set to uppercase for printout
    ic = ichar(length_unit(1:1))
    if ((ic .ge. ichar('a')) .and. (ic .le. ichar('z'))) &
      length_unit(1:1) = char(ic + ichar('Z') - ichar('z'))
  end subroutine w90_readwrite_read_units