Read .CHRG and .UHF dot-files from the directory of an input path
if they exist on disk.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(structure_type), | intent(inout) | :: | self |
Molecular structure data to update |
||
| character(len=*), | intent(in) | :: | input |
Input geometry file path (or “-” for current directory) |
||
| type(error_type), | intent(out), | allocatable | :: | error |
Error handling |
|
| logical, | intent(in), | optional | :: | read_chrg |
Whether to check and read |
|
| logical, | intent(in), | optional | :: | read_uhf |
Whether to check and read |
|
| character(len=:), | intent(out), | optional, | allocatable | :: | chrg_file |
Resolved |
| character(len=:), | intent(out), | optional, | allocatable | :: | uhf_file |
Resolved |
subroutine read_dotfiles(self, input, error, read_chrg, read_uhf, & & chrg_file, uhf_file) !> Molecular structure data to update type(structure_type), intent(inout) :: self !> Input geometry file path (or "-" for current directory) character(len=*), intent(in) :: input !> Error handling type(error_type), allocatable, intent(out) :: error !> Whether to check and read `.CHRG` (default: `.true.`) logical, intent(in), optional :: read_chrg !> Whether to check and read `.UHF` (default: `.true.`) logical, intent(in), optional :: read_uhf !> Resolved `.CHRG` path if the file existed on disk character(len=:), allocatable, intent(out), optional :: chrg_file !> Resolved `.UHF` path if the file existed on disk character(len=:), allocatable, intent(out), optional :: uhf_file character(len=:), allocatable :: dir, path, found_chrg, found_uhf logical :: do_chrg, do_uhf, exist real(wp) :: charge integer :: uhf do_chrg = .true. if (present(read_chrg)) do_chrg = read_chrg do_uhf = .true. if (present(read_uhf)) do_uhf = read_uhf dir = dirname(input) if (do_chrg) then path = join_path(dir, ".CHRG") inquire(file=path, exist=exist) if (exist) then call read_chrg_from_file(charge, path, error) if (allocated(error)) return found_chrg = path end if end if if (do_uhf) then path = join_path(dir, ".UHF") inquire(file=path, exist=exist) if (exist) then call read_uhf_from_file(uhf, path, error) if (allocated(error)) return found_uhf = path end if end if if (allocated(found_chrg)) then self%charge = charge if (present(chrg_file)) chrg_file = found_chrg end if if (allocated(found_uhf)) then self%uhf = uhf if (present(uhf_file)) uhf_file = found_uhf end if end subroutine read_dotfiles