utility_string_to_coord Subroutine

public subroutine utility_string_to_coord(string_tmp, outvec, error, comm)

Uses

  • proc~~utility_string_to_coord~~UsesGraph proc~utility_string_to_coord utility_string_to_coord module~w90_constants w90_constants proc~utility_string_to_coord->module~w90_constants module~w90_error w90_error proc~utility_string_to_coord->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_constants module~w90_comms->module~w90_error_base

Takes a string in the form 0.0,1.0,0.5 and returns an array of the real num

Arguments

Type IntentOptional Attributes Name
character(len=maxlen), intent(in) :: string_tmp
real(kind=dp), intent(out) :: outvec(3)
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Calls

proc~~utility_string_to_coord~~CallsGraph proc~utility_string_to_coord utility_string_to_coord proc~set_error_input set_error_input proc~utility_string_to_coord->proc~set_error_input 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

Called by

proc~~utility_string_to_coord~~CalledByGraph proc~utility_string_to_coord utility_string_to_coord proc~w90_readwrite_get_projections w90_readwrite_get_projections proc~w90_readwrite_get_projections->proc~utility_string_to_coord proc~w90_wannier90_readwrite_read_projections w90_wannier90_readwrite_read_projections proc~w90_wannier90_readwrite_read_projections->proc~w90_readwrite_get_projections proc~w90_wannier90_readwrite_read_special w90_wannier90_readwrite_read_special proc~w90_wannier90_readwrite_read_special->proc~w90_wannier90_readwrite_read_projections proc~input_reader_special input_reader_special proc~input_reader_special->proc~w90_wannier90_readwrite_read_special proc~w90_input_setopt w90_input_setopt proc~w90_input_setopt->proc~w90_wannier90_readwrite_read_special proc~w90_input_setopt_f w90_input_setopt_f proc~w90_input_setopt_f->proc~w90_input_setopt program~wannier wannier program~wannier->proc~input_reader_special

Source Code

  subroutine utility_string_to_coord(string_tmp, outvec, error, comm)
    !================================================!
    !
    !! Takes a string in the form 0.0,1.0,0.5
    !! and returns an array of the real num
    !
    !================================================!
    use w90_constants, only: maxlen
    use w90_error, only: w90_error_type, set_error_input

    implicit none

    character(len=maxlen), intent(in)  :: string_tmp
    real(kind=dp), intent(out) :: outvec(3)
    type(w90_error_type), allocatable, intent(out) :: error
    type(w90_comm_type), intent(in) :: comm

    integer :: pos
    character(len=maxlen) :: ctemp
    character(len=maxlen) :: ctemp2

    ctemp = string_tmp
    pos = index(ctemp, ',')
    if (pos <= 0) then
      call set_error_input(error, 'utility_string_to_coord: Problem reading string into real number '//trim(string_tmp), comm)
      return
    end if

    ctemp2 = ctemp(1:pos - 1)
    read (ctemp2, *, err=100, end=100) outvec(1)
    ctemp = ctemp(pos + 1:)
    pos = index(ctemp, ',')
    ctemp2 = ctemp(1:pos - 1)
    read (ctemp2, *, err=100, end=100) outvec(2)
    ctemp = ctemp(pos + 1:)
    read (ctemp, *, err=100, end=100) outvec(3)

    return

100 call set_error_input(error, 'utility_string_to_coord: Problem reading string into real number '//trim(string_tmp), comm)
    return ! this is kinda ugly, JJ

  end subroutine utility_string_to_coord