utility_diagonalize Subroutine

public subroutine utility_diagonalize(mat, dim, eig, rot)

Uses

  • proc~~utility_diagonalize~~UsesGraph proc~utility_diagonalize utility_diagonalize module~w90_constants w90_constants proc~utility_diagonalize->module~w90_constants module~w90_io w90_io proc~utility_diagonalize->module~w90_io module~w90_io->module~w90_constants

Diagonalize the dim x dim hermitian matrix 'mat' and return the eigenvalues 'eig' and the unitary rotation 'rot'

Arguments

Type IntentOptional AttributesName
complex(kind=dp), intent(in) :: mat(dim,dim)
integer, intent(in) :: dim
real(kind=dp), intent(out) :: eig(dim)
complex(kind=dp), intent(out) :: rot(dim,dim)

Calls

proc~~utility_diagonalize~~CallsGraph proc~utility_diagonalize utility_diagonalize proc~io_error io_error proc~utility_diagonalize->proc~io_error

Called by

proc~~utility_diagonalize~~CalledByGraph proc~utility_diagonalize utility_diagonalize proc~wham_get_eig_uu_hh_jjlist wham_get_eig_UU_HH_JJlist proc~wham_get_eig_uu_hh_jjlist->proc~utility_diagonalize proc~spin_get_s spin_get_S proc~spin_get_s->proc~utility_diagonalize proc~spin_get_moment_k spin_get_moment_k proc~spin_get_moment_k->proc~utility_diagonalize proc~k_slice k_slice proc~k_slice->proc~utility_diagonalize proc~wham_get_eig_deleig wham_get_eig_deleig proc~k_slice->proc~wham_get_eig_deleig proc~spin_get_nk spin_get_nk proc~k_slice->proc~spin_get_nk proc~berry_get_shc_klist berry_get_shc_klist proc~k_slice->proc~berry_get_shc_klist proc~berry_get_imfgh_klist berry_get_imfgh_klist proc~k_slice->proc~berry_get_imfgh_klist proc~berry_get_imf_klist berry_get_imf_klist proc~k_slice->proc~berry_get_imf_klist proc~wham_get_eig_deleig->proc~utility_diagonalize proc~wham_get_eig_uu_hh_aa_sc_tb_conv wham_get_eig_UU_HH_AA_sc_TB_conv proc~wham_get_eig_uu_hh_aa_sc_tb_conv->proc~utility_diagonalize proc~wham_get_eig_uu_hh_aa_sc wham_get_eig_UU_HH_AA_sc proc~wham_get_eig_uu_hh_aa_sc->proc~utility_diagonalize proc~dos_main dos_main proc~dos_main->proc~utility_diagonalize proc~dos_main->proc~wham_get_eig_deleig proc~spin_get_nk->proc~utility_diagonalize proc~berry_get_kubo_k berry_get_kubo_k proc~berry_get_kubo_k->proc~utility_diagonalize proc~berry_get_kubo_k->proc~wham_get_eig_deleig proc~berry_get_kubo_k->proc~spin_get_nk proc~calctdfanddos calcTDFandDOS proc~calctdfanddos->proc~wham_get_eig_deleig proc~berry_get_sc_klist berry_get_sc_klist proc~berry_get_sc_klist->proc~wham_get_eig_deleig proc~berry_get_sc_klist->proc~wham_get_eig_uu_hh_aa_sc_tb_conv proc~berry_get_sc_klist->proc~wham_get_eig_uu_hh_aa_sc proc~berry_get_shc_klist->proc~wham_get_eig_deleig proc~berry_main berry_main proc~berry_main->proc~berry_get_kubo_k proc~berry_main->proc~berry_get_sc_klist proc~berry_main->proc~berry_get_shc_klist proc~berry_main->proc~berry_get_imfgh_klist proc~berry_main->proc~berry_get_imf_klist proc~k_path k_path proc~k_path->proc~spin_get_nk proc~k_path->proc~berry_get_shc_klist proc~k_path->proc~berry_get_imfgh_klist proc~k_path->proc~berry_get_imf_klist proc~gyrotropic_get_k_list gyrotropic_get_k_list proc~gyrotropic_get_k_list->proc~spin_get_s proc~gyrotropic_get_k_list->proc~wham_get_eig_deleig proc~gyrotropic_get_k_list->proc~berry_get_imfgh_klist proc~gyrotropic_get_k_list->proc~berry_get_imf_klist proc~berry_get_imfgh_klist->proc~wham_get_eig_uu_hh_jjlist proc~berry_get_imf_klist->proc~berry_get_imfgh_klist proc~boltzwann_main boltzwann_main proc~boltzwann_main->proc~calctdfanddos proc~gyrotropic_main gyrotropic_main proc~gyrotropic_main->proc~gyrotropic_get_k_list

Contents

Source Code


Source Code

  subroutine utility_diagonalize(mat, dim, eig, rot)
    !============================================================!
    !                                                            !
    !! Diagonalize the dim x dim  hermitian matrix 'mat' and
    !! return the eigenvalues 'eig' and the unitary rotation 'rot'
    !                                                            !
    !============================================================!

    use w90_constants, only: dp, cmplx_0
    use w90_io, only: io_error, stdout

    integer, intent(in)           :: dim
    complex(kind=dp), intent(in)  :: mat(dim, dim)
    real(kind=dp), intent(out)    :: eig(dim)
    complex(kind=dp), intent(out) :: rot(dim, dim)

    complex(kind=dp)   :: mat_pack((dim*(dim + 1))/2), cwork(2*dim)
    real(kind=dp)      :: rwork(7*dim)
    integer            :: i, j, info, nfound, iwork(5*dim), ifail(dim)

    do j = 1, dim
      do i = 1, j
        mat_pack(i + ((j - 1)*j)/2) = mat(i, j)
      enddo
    enddo
    rot = cmplx_0; eig = 0.0_dp; cwork = cmplx_0; rwork = 0.0_dp; iwork = 0
    call ZHPEVX('V', 'A', 'U', dim, mat_pack, 0.0_dp, 0.0_dp, 0, 0, -1.0_dp, &
                nfound, eig(1), rot, dim, cwork, rwork, iwork, ifail, info)
    if (info < 0) then
      write (stdout, '(a,i3,a)') 'THE ', -info, &
        ' ARGUMENT OF ZHPEVX HAD AN ILLEGAL VALUE'
      call io_error('Error in utility_diagonalize')
    endif
    if (info > 0) then
      write (stdout, '(i3,a)') info, ' EIGENVECTORS FAILED TO CONVERGE'
      call io_error('Error in utility_diagonalize')
    endif

  end subroutine utility_diagonalize