kmesh_get_amat Subroutine

private subroutine kmesh_get_amat(kmesh_input, amat, bvector, multi, loop_order, num_x, num_y, num_z)

Uses

  • proc~~kmesh_get_amat~~UsesGraph proc~kmesh_get_amat kmesh_get_amat module~w90_types w90_types proc~kmesh_get_amat->module~w90_types module~w90_constants w90_constants module~w90_types->module~w90_constants

Find amat(coefficients to find bweight) and the numbers of x, y, z components for a given order

Arguments

Type IntentOptional 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(:)

Called by

proc~~kmesh_get_amat~~CalledByGraph proc~kmesh_get_amat kmesh_get_amat proc~kmesh_shell_automatic kmesh_shell_automatic proc~kmesh_shell_automatic->proc~kmesh_get_amat proc~kmesh_get kmesh_get proc~kmesh_get->proc~kmesh_shell_automatic proc~w90_create_kmesh w90_create_kmesh proc~w90_create_kmesh->proc~kmesh_get program~postw90 postw90 program~postw90->proc~kmesh_get proc~w90_get_gkpb~2 w90_get_gkpb proc~w90_get_gkpb~2->proc~w90_create_kmesh proc~w90_get_nnkp~2 w90_get_nnkp proc~w90_get_nnkp~2->proc~w90_create_kmesh proc~w90_get_nn~2 w90_get_nn proc~w90_get_nn~2->proc~w90_create_kmesh proc~write_kmesh write_kmesh proc~write_kmesh->proc~w90_create_kmesh proc~w90_get_gkpb w90_get_gkpb proc~w90_get_gkpb->proc~w90_get_gkpb~2 proc~w90_get_nn w90_get_nn proc~w90_get_nn->proc~w90_get_nn~2 proc~w90_get_nnkp w90_get_nnkp proc~w90_get_nnkp->proc~w90_get_nnkp~2 program~wannier wannier program~wannier->proc~w90_get_nn~2 program~wannier->proc~write_kmesh

Source Code

  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