Returns the b-vectors for a given shell and kpoint.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(kmesh_input_type), | intent(in) | :: | kmesh_input | |||
| type(print_output_type), | intent(in) | :: | print_output | |||
| real(kind=dp), | intent(out) | :: | bvector(3,multi) | |||
| real(kind=dp), | intent(in) | :: | kpt_cart(:,:) | |||
| real(kind=dp), | intent(in) | :: | recip_lattice(3,3) | |||
| real(kind=dp), | intent(in) | :: | shell_dist | |||
| integer, | intent(in) | :: | lmn(:,:) | |||
| integer, | intent(in) | :: | kpt | |||
| integer, | intent(in) | :: | multi | |||
| integer, | intent(in) | :: | num_kpts | |||
| type(timer_list_type), | intent(inout) | :: | timer | |||
| type(w90_error_type), | intent(out), | allocatable | :: | error | ||
| type(w90_comm_type), | intent(in) | :: | comm |
subroutine kmesh_get_bvectors(kmesh_input, print_output, bvector, kpt_cart, recip_lattice, & shell_dist, lmn, kpt, multi, num_kpts, timer, error, comm) !================================================ ! !! Returns the b-vectors for a given shell and kpoint. ! !================================================ use w90_io, only: io_stopwatch_start, io_stopwatch_stop use w90_types, only: kmesh_input_type, print_output_type, timer_list_type implicit none ! arguments type(print_output_type), intent(in) :: print_output type(kmesh_input_type), intent(in) :: kmesh_input type(timer_list_type), intent(inout) :: timer type(w90_error_type), allocatable, intent(out) :: error type(w90_comm_type), intent(in) :: comm integer, intent(in) :: num_kpts integer, intent(in) :: lmn(:, :) integer, intent(in) :: multi ! the number of kpoints in the shell integer, intent(in) :: kpt ! which kpt is our 'origin' real(kind=dp), intent(in) :: recip_lattice(3, 3) real(kind=dp), intent(in) ::kpt_cart(:, :) real(kind=dp), intent(in) :: shell_dist ! the bvectors real(kind=dp), intent(out) :: bvector(3, multi) ! the bvectors ! local variables integer :: loop, nkp2, num_bvec real(kind=dp) :: dist, vkpp2(3), vkpp(3) if (print_output%timing_level > 1) call io_stopwatch_start('kmesh: get_bvectors', timer) bvector = 0.0_dp num_bvec = 0 ok: do loop = 1, (2*kmesh_input%search_supcell_size + 1)**3 vkpp2 = matmul(lmn(:, loop), recip_lattice) do nkp2 = 1, num_kpts vkpp = vkpp2 + kpt_cart(:, nkp2) dist = sqrt((kpt_cart(1, kpt) - vkpp(1))**2 & + (kpt_cart(2, kpt) - vkpp(2))**2 + (kpt_cart(3, kpt) - vkpp(3))**2) if ((dist .ge. shell_dist - kmesh_input%tol) .and. (dist .le. shell_dist + kmesh_input%tol)) then num_bvec = num_bvec + 1 bvector(:, num_bvec) = vkpp(:) - kpt_cart(:, kpt) end if !if we have the right number of neighbours we can exit if (num_bvec == multi) cycle ok end do end do ok if (num_bvec < multi) then call set_error_fatal(error, 'kmesh_get_bvector: Not enough bvectors found', comm) return end if if (print_output%timing_level > 1) call io_stopwatch_stop('kmesh: get_bvectors', timer) return end subroutine kmesh_get_bvectors