find_basis_file Subroutine

public subroutine find_basis_file(basis_name, filename, error)

Find basis set file using normalized name

Search strategy: 1. Normalize the basis name (e.g., 6-31G* -> 6-31Gs) 2. Look for basis_sets/{normalized}.txt 3. If not found, return error

This is a simple, straightforward approach that assumes the JSON/mqc input provides the correct basis set name.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: basis_name
character(len=:), intent(out), allocatable :: filename
type(error_t), intent(out) :: error

Calls

proc~~find_basis_file~~CallsGraph proc~find_basis_file find_basis_file proc~error_set error_t%error_set proc~find_basis_file->proc~error_set proc~normalize_basis_name normalize_basis_name proc~find_basis_file->proc~normalize_basis_name

Variables

Type Visibility Attributes Name Initial
logical, private :: file_exists
character(len=512), private :: filepath
character(len=:), private, allocatable :: normalized

Source Code

   subroutine find_basis_file(basis_name, filename, error)
      !! Find basis set file using normalized name
      !!
      !! Search strategy:
      !!   1. Normalize the basis name (e.g., 6-31G* -> 6-31Gs)
      !!   2. Look for basis_sets/{normalized}.txt
      !!   3. If not found, return error
      !!
      !! This is a simple, straightforward approach that assumes
      !! the JSON/mqc input provides the correct basis set name.
      character(len=*), intent(in) :: basis_name
      character(len=:), allocatable, intent(out) :: filename
      type(error_t), intent(out) :: error

      character(len=:), allocatable :: normalized
      logical :: file_exists
      character(len=512) :: filepath

      ! Normalize the basis name
      normalized = normalize_basis_name(basis_name)

      ! Construct file path: basis_sets/{normalized}.txt
      filepath = "basis_sets/"//trim(normalized)//".txt"

      ! Check if file exists
      inquire (file=trim(filepath), exist=file_exists)

      if (file_exists) then
         filename = trim(filepath)
      else
         call error%set(ERROR_IO, "Basis set file not found: "//trim(filepath)// &
                        " (from basis name: "//trim(basis_name)//")")
      end if

   end subroutine find_basis_file