Reads finite-difference input variables: "search_shells" "kmesh_tol" "shell_list" "num_shells" "skip_B1_tests"
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(settings_type), | intent(inout) | :: | settings | |||
| type(kmesh_input_type), | intent(inout) | :: | kmesh_input | |||
| type(w90_error_type), | intent(out), | allocatable | :: | error | ||
| type(w90_comm_type), | intent(in) | :: | comm |
subroutine w90_readwrite_read_kmesh_data(settings, kmesh_input, error, comm) !! Reads finite-difference input variables: !! "search_shells" !! "kmesh_tol" !! "shell_list" !! "num_shells" !! "skip_B1_tests" use w90_error, only: w90_error_type, set_error_input, set_error_alloc implicit none type(kmesh_input_type), intent(inout) :: kmesh_input type(w90_error_type), allocatable, intent(out) :: error type(w90_comm_type), intent(in) :: comm type(settings_type), intent(inout) :: settings integer :: itmp, ierr logical :: found integer :: n call w90_readwrite_get_keyword(settings, 'search_shells', found, error, comm, & i_value=kmesh_input%search_shells) if (allocated(error)) return if (kmesh_input%search_shells < 0) then call set_error_input(error, 'Error: search_shells must be positive', comm) return end if call w90_readwrite_get_keyword(settings, 'search_supcell_size', found, error, comm, & i_value=kmesh_input%search_supcell_size) if (allocated(error)) return if (kmesh_input%search_supcell_size < 0) then call set_error_input(error, 'Error: search_supcell_size must be positive', comm) return end if call w90_readwrite_get_keyword(settings, 'higher_order_n', found, error, comm, & i_value=kmesh_input%higher_order_n) if (allocated(error)) return if (kmesh_input%higher_order_n < 0) then call set_error_input(error, 'Error: higher_order_n must be positive', comm) return end if n = kmesh_input%higher_order_n kmesh_input%max_shells_h = n*(4*n**2 + 15*n + 17)/6 kmesh_input%max_shells_aux = kmesh_input%max_shells_h kmesh_input%num_nnmax_h = 2*kmesh_input%max_shells_h call w90_readwrite_get_keyword(settings, 'higher_order_nearest_shells', found, error, comm, & l_value=kmesh_input%higher_order_nearest_shells) if (allocated(error)) return if (.not. kmesh_input%higher_order_nearest_shells) then kmesh_input%max_shells_aux = 6 end if ! override mechanism for cases where automatic determination of b-vector shells fails call w90_readwrite_get_keyword(settings, 'kmesh_shell_from_file', found, error, comm, & l_value=kmesh_input%kmesh_shell_from_file) if (allocated(error)) return call w90_readwrite_get_keyword(settings, 'kmesh_tol', found, error, comm, & r_value=kmesh_input%tol) if (allocated(error)) return if (kmesh_input%tol < 0.0_dp) then call set_error_input(error, 'Error: kmesh_tol must be positive', comm) return end if call w90_readwrite_get_range_vector(settings, 'shell_list', found, kmesh_input%num_shells, & .true., error, comm) if (allocated(error)) return if (found) then if (kmesh_input%num_shells < 0 .or. kmesh_input%num_shells > kmesh_input%max_shells_h) then call set_error_input(error, 'Error: number of shell in shell_list must be between zero and kmesh_input%max_shells_h', comm) return end if allocate (kmesh_input%shell_list(kmesh_input%num_shells), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error allocating shell_list in w90_readwrite_read_kmesh_data', comm) return end if call w90_readwrite_get_range_vector(settings, 'shell_list', found, kmesh_input%num_shells, & .false., error, comm, kmesh_input%shell_list) if (allocated(error)) return if (any(kmesh_input%shell_list < 1)) then call set_error_input(error, 'Error: shell_list must contain positive numbers', comm) return end if else ! this is the default allocation of the shell_list--used by kmesh_shell_automatic() allocate (kmesh_input%shell_list(kmesh_input%max_shells_h), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error allocating shell_list in w90_readwrite_read_kmesh_data', comm) return end if end if call w90_readwrite_get_keyword(settings, 'num_shells', found, error, comm, i_value=itmp) if (allocated(error)) return if (found .and. (itmp /= kmesh_input%num_shells)) then call set_error_input(error, & 'Error: Found obsolete keyword num_shells. Its value does not agree with shell_list', comm) return end if ! If .true., does not perform the check of B1 of ! Marzari, Vanderbild, PRB 56, 12847 (1997) ! in kmesh.F90 ! mainly needed for the interaction with Z2PACK ! By default: .false. (perform the tests) call w90_readwrite_get_keyword(settings, 'skip_b1_tests', found, error, comm, & l_value=kmesh_input%skip_B1_tests) if (allocated(error)) return end subroutine w90_readwrite_read_kmesh_data