| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ws_distance_type), | intent(in) | :: | ws_distance | |||
| type(ws_region_type), | intent(in) | :: | ws_region | |||
| type(wigner_seitz_type), | intent(in) | :: | wigner_seitz | |||
| integer, | intent(in) | :: | num_wann | |||
| complex(kind=dp), | intent(in) | :: | op_R(num_wann,num_wann,wigner_seitz%nrpts) |
operator in real-space grid, before applying ndegen |
||
| complex(kind=dp), | intent(inout) | :: | op_R_opt_ws(num_wann,num_wann,wigner_seitz%nrpts_pw90) |
operator in real-space grid, after applying ndegen |
subroutine operator_wigner_setup(ws_distance, ws_region, wigner_seitz, num_wann, op_R, op_R_opt_ws) !========================================================================== ! ! Also, divide real-space matrix elements with the degeneracy factor. ! For use_ws_distance = true, reorder the real-space grid index ! using ir_ind_ws_to_pw90. ! ! After this routine, irvec_pw90, crvec_pw90, and nrpts_pw90 can be ! used in the fourier_R_to_k routines, irrespective of use_ws_distance. ! !========================================================================== use w90_constants, only: dp, cmplx_0 use w90_types, only: ws_region_type, ws_distance_type use w90_postw90_types, only: wigner_seitz_type type(ws_distance_type), intent(in) :: ws_distance type(ws_region_type), intent(in) :: ws_region type(wigner_seitz_type), intent(in) :: wigner_seitz integer, intent(in) :: num_wann complex(kind=dp), intent(in) :: op_R(num_wann, num_wann, wigner_seitz%nrpts) !! operator in real-space grid, before applying ndegen complex(kind=dp), intent(inout) :: op_R_opt_ws(num_wann, num_wann, wigner_seitz%nrpts_pw90) !! operator in real-space grid, after applying ndegen integer :: ir, jr, i, j, ideg op_R_opt_ws = cmplx_0 if (ws_region%use_ws_distance) then do ir = 1, wigner_seitz%nrpts do j = 1, num_wann do i = 1, num_wann do ideg = 1, ws_distance%ndeg(i, j, ir) jr = wigner_seitz%ir_ind_ws_to_pw90(ideg, i, j, ir) op_R_opt_ws(i, j, jr) = op_R_opt_ws(i, j, jr) & + op_R(i, j, ir)/real(wigner_seitz%ndegen(ir)* & ws_distance%ndeg(i, j, ir), dp) end do end do end do end do else ! .not. use_ws_distance ! Note that nrpts_pw90 == nrpts if use_ws_distance == .false. do ir = 1, wigner_seitz%nrpts op_R_opt_ws(:, :, ir) = op_R(:, :, ir)/real(wigner_seitz%ndegen(ir), dp) end do end if ! use_ws_distance end subroutine operator_wigner_setup