utility_string_to_coord Subroutine

public subroutine utility_string_to_coord(string_tmp, outvec)

Uses

  • proc~~utility_string_to_coord~~UsesGraph proc~utility_string_to_coord utility_string_to_coord module~w90_io w90_io proc~utility_string_to_coord->module~w90_io module~w90_constants w90_constants module~w90_io->module~w90_constants

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

Arguments

Type IntentOptional AttributesName
character(len=maxlen), intent(in) :: string_tmp
real(kind=dp), intent(out) :: outvec(3)

Called by

proc~~utility_string_to_coord~~CalledByGraph proc~utility_string_to_coord utility_string_to_coord proc~param_get_projections param_get_projections proc~param_get_projections->proc~utility_string_to_coord proc~param_read param_read proc~param_read->proc~param_get_projections program~wannier wannier program~wannier->proc~param_read proc~wannier_run wannier_run proc~wannier_run->proc~param_read proc~wannier_setup wannier_setup proc~wannier_setup->proc~param_read program~postw90 postw90 program~postw90->proc~param_read

Contents


Source Code

  subroutine utility_string_to_coord(string_tmp, outvec)!
    !====================================================!
    !                                                    !
    !! Takes a string in the form 0.0,1.0,0.5
    !! and returns an array of the real num
    !                                                    !
    !====================================================!
    use w90_io, only: io_error, maxlen

    implicit none

    character(len=maxlen), intent(in)  :: string_tmp
    real(kind=dp), intent(out) :: outvec(3)

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

    ctemp = string_tmp
    pos = index(ctemp, ',')
    if (pos <= 0) call io_error('utility_string_to_coord: Problem reading string into real number '//trim(string_tmp))
    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 io_error('utility_string_to_coord: Problem reading string into real number '//trim(string_tmp))

  end subroutine utility_string_to_coord