parse_function_line Subroutine

private pure subroutine parse_function_line(line, func_num, exponent, coeff_s, coeff_p, has_p, stat)

Parse function line (e.g., “1 1.0 2.0” or “1 1.0 2.0 3.0” for L shells)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: line
integer, intent(out) :: func_num
real(kind=dp), intent(out) :: exponent
real(kind=dp), intent(out) :: coeff_s
real(kind=dp), intent(out), optional :: coeff_p
logical, intent(out) :: has_p
integer, intent(out) :: stat

Called by

proc~~parse_function_line~~CalledByGraph proc~parse_function_line parse_function_line proc~fill_element_basis fill_element_basis proc~fill_element_basis->proc~parse_function_line proc~parse_element_basis parse_element_basis proc~parse_element_basis->proc~fill_element_basis proc~build_molecular_basis build_molecular_basis proc~build_molecular_basis->proc~parse_element_basis

Variables

Type Visibility Attributes Name Initial
real(kind=dp), private :: temp_p

Source Code

   pure subroutine parse_function_line(line, func_num, exponent, coeff_s, coeff_p, has_p, stat)
      !! Parse function line (e.g., "1 1.0 2.0" or "1 1.0 2.0 3.0" for L shells)
      character(len=*), intent(in) :: line
      integer, intent(out) :: func_num
      real(dp), intent(out) :: exponent
      real(dp), intent(out) :: coeff_s
      real(dp), intent(out), optional :: coeff_p
      logical, intent(out) :: has_p
      integer, intent(out) :: stat

      real(dp) :: temp_p

      has_p = .false.

      ! Try to read 4 values (func_num, exponent, coeff_s, coeff_p)
      read (line, *, iostat=stat) func_num, exponent, coeff_s, temp_p

      if (stat == 0) then
         ! Successfully read 4 values - this is an L shell
         has_p = .true.
         if (present(coeff_p)) coeff_p = temp_p
      else
         ! Try reading just 3 values (func_num, exponent, coeff_s)
         read (line, *, iostat=stat) func_num, exponent, coeff_s
      end if

   end subroutine parse_function_line