parse_method_string Function

public function parse_method_string(method_str) result(method_type)

Parse method string from input file (e.g., “XTB-GFN1” -> gfn1)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: method_str

Return Value integer(kind=int32)


Calls

proc~~parse_method_string~~CallsGraph proc~parse_method_string parse_method_string proc~method_type_from_string method_type_from_string proc~parse_method_string->proc~method_type_from_string

Called by

proc~~parse_method_string~~CalledByGraph proc~parse_method_string parse_method_string proc~parse_model_section parse_model_section proc~parse_model_section->proc~parse_method_string interface~parse_model_section parse_model_section interface~parse_model_section->proc~parse_model_section proc~read_mqc_file read_mqc_file proc~read_mqc_file->interface~parse_model_section program~main main program~main->proc~read_mqc_file

Variables

Type Visibility Attributes Name Initial
integer, private :: dash_pos
integer, private :: i
character(len=:), private, allocatable :: lower_str
character(len=:), private, allocatable :: method_part

Source Code

   function parse_method_string(method_str) result(method_type)
      !! Parse method string from input file (e.g., "XTB-GFN1" -> gfn1)
      character(len=*), intent(in) :: method_str
      integer(int32) :: method_type

      character(len=:), allocatable :: lower_str, method_part
      integer :: dash_pos, i

      ! Convert to lowercase
      allocate (character(len=len_trim(method_str)) :: lower_str)
      lower_str = trim(adjustl(method_str))
      do i = 1, len(lower_str)
         if (lower_str(i:i) >= 'A' .and. lower_str(i:i) <= 'Z') then
            lower_str(i:i) = achar(iachar(lower_str(i:i)) + 32)
         end if
      end do

      ! Handle "XTB-GFN1" format -> extract "gfn1"
      if (index(lower_str, 'xtb') > 0) then
         dash_pos = index(lower_str, '-')
         if (dash_pos > 0) then
            method_part = lower_str(dash_pos + 1:)
         else
            method_part = lower_str
         end if
      else
         method_part = lower_str
      end if

      method_type = method_type_from_string(method_part)

   end function parse_method_string