!c Description:
!c  線形捜査によって化学種名から化学種の番号を求める. 
!c
!c Current Code Owner: 
!c   sugiyama@gfd-dennou.org
!c
!c Histry: 
!c   Version    Date          Comment
!c   -------    ----------    --------
!c   1.0        2003-02-06    作成
!c
!c Copyright (C) SUGIYAMA Ko-ichiro, 2003, All rights reserved

module interface_name2num  
  interface

     subroutine name2num(key, name, num)
       integer, intent(out)            :: num
       character(*), intent(in)        :: key
       character(*), intent(in)        :: name(:)
     end subroutine name2num
     
  end interface
end module interface_name2num



subroutine name2num(key, name, num)
  implicit none
  integer, intent(out)            :: num
  character(*), intent(in)        :: key
  character(*), intent(in)        :: name(:)

  integer                         :: N
  integer                         :: s
  

  N = size(name, 1)
  num = 0
  
  search: do s = 1, N
     if (trim(key) == trim(name(s))) then 
        num = s
        exit search
     end if
  end do search
  
end subroutine name2num
