| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | unit | |||
| type(mqc_config_t), | intent(inout) | :: | config | |||
| type(error_t), | intent(out) | :: | error |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | eq_pos | ||||
| integer, | private | :: | io_stat | ||||
| character(len=MAX_LINE_LEN), | private | :: | key | ||||
| character(len=MAX_LINE_LEN), | private | :: | line | ||||
| character(len=MAX_LINE_LEN), | private | :: | value |
module subroutine parse_hessian_section(unit, config, error) integer, intent(in) :: unit type(mqc_config_t), intent(inout) :: config type(error_t), intent(out) :: error character(len=MAX_LINE_LEN) :: line, key, value integer :: io_stat, eq_pos do read (unit, '(A)', iostat=io_stat) line if (io_stat /= 0) then call error%set(ERROR_IO, "Unexpected end of file in %hessian section") return end if line = adjustl(line) if (len_trim(line) == 0) cycle if (line(1:1) == '#' .or. line(1:1) == '!') cycle if (trim(strip_comment(line)) == 'end') exit eq_pos = index(line, '=') if (eq_pos == 0) cycle key = adjustl(line(1:eq_pos - 1)) value = adjustl(line(eq_pos + 1:)) select case (trim(key)) case ('finite_difference_displacement', 'displacement') read (value, *, iostat=io_stat) config%hessian_displacement case ('temperature') read (value, *, iostat=io_stat) config%hessian_temperature if (io_stat /= 0) then call error%set(ERROR_PARSE, "Invalid temperature value: "//trim(value)) return end if case ('pressure') read (value, *, iostat=io_stat) config%hessian_pressure if (io_stat /= 0) then call error%set(ERROR_PARSE, "Invalid pressure value: "//trim(value)) return end if case default call error%set(ERROR_PARSE, "Unknown key in %hessian section: "//trim(key)) return end select end do end subroutine parse_hessian_section