Find amat(coefficients to find bweight) and the numbers of x, y, z components for a given order
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(kmesh_input_type), | intent(inout) | :: | kmesh_input | |||
| real(kind=dp), | intent(inout) | :: | amat(:,:) | |||
| real(kind=dp), | intent(in) | :: | bvector(3,maxval(multi),kmesh_input%max_shells_h) | |||
| integer, | intent(in) | :: | multi(kmesh_input%search_shells) | |||
| integer, | intent(in) | :: | loop_order | |||
| integer, | intent(inout) | :: | num_x(:) | |||
| integer, | intent(inout) | :: | num_y(:) | |||
| integer, | intent(inout) | :: | num_z(:) |
subroutine kmesh_get_amat(kmesh_input, amat, bvector, multi, loop_order, num_x, num_y, num_z) !================================================ ! !! Find amat(coefficients to find bweight) and the numbers of x, y, z components for a given order ! !================================================ use w90_types, only: kmesh_input_type implicit none ! arguments type(kmesh_input_type), intent(inout) :: kmesh_input real(kind=dp), intent(inout) :: amat(:, :) integer, intent(inout) :: num_x(:) integer, intent(inout) :: num_y(:) integer, intent(inout) :: num_z(:) integer, intent(in) :: multi(kmesh_input%search_shells) ! the number of kpoints in the shell integer, intent(in) :: loop_order real(kind=dp), intent(in) :: bvector(3, maxval(multi), kmesh_input%max_shells_h) ! local variables integer :: num_of_eqs, num_of_eqs_prev integer :: loop_i, loop_j, loop_s, loop_b num_of_eqs = (1 + loop_order)*(1 + 2*loop_order) !((3, 2n)) (combi. with repetition) num_of_eqs_prev = loop_order*(2*loop_order - 1) if (loop_order .eq. 1) num_of_eqs_prev = 0 do loop_s = 1, kmesh_input%num_shells do loop_i = 1, num_of_eqs ! equation index, e.g. If loop_order == 3, (1,2,...,15) -> (xxx, xxy, xyy, yyy, xxz, xyz, ..., zzz) ! find the number of z components corresponding to the current loop_i do loop_j = 0, 2*loop_order if ((2*loop_order + 1)*loop_j - loop_j*(loop_j - 1)/2 <= loop_i - 1 & .and. (2*loop_order + 1)*(loop_j + 1) - (loop_j + 1)*loop_j/2 > loop_i - 1) then num_z(loop_i) = loop_j exit end if end do ! find the number of x and y components num_y(loop_i) = loop_i - 1 - ((2*loop_order + 1)*num_z(loop_i) - num_z(loop_i) & *(num_z(loop_i) - 1)/2) num_x(loop_i) = 2*loop_order - num_y(loop_i) - num_z(loop_i) ! calculate sum_b bb...bbbb do loop_b = 1, multi(kmesh_input%shell_list(loop_s)) amat(num_of_eqs_prev + loop_i, loop_s) = amat(num_of_eqs_prev + loop_i, loop_s) & + (bvector(1, loop_b, loop_s)**num_x(loop_i)) & *(bvector(2, loop_b, loop_s)**num_y(loop_i)) & *(bvector(3, loop_b, loop_s)**num_z(loop_i)) end do end do end do end subroutine kmesh_get_amat