wann_check_unitarity Subroutine

private subroutine wann_check_unitarity()

Uses

  • proc~~wann_check_unitarity~~UsesGraph proc~wann_check_unitarity wann_check_unitarity module~w90_constants w90_constants proc~wann_check_unitarity->module~w90_constants module~w90_parameters w90_parameters proc~wann_check_unitarity->module~w90_parameters module~w90_io w90_io proc~wann_check_unitarity->module~w90_io module~w90_parameters->module~w90_constants module~w90_parameters->module~w90_io module~w90_io->module~w90_constants

Arguments

None

Calls

proc~~wann_check_unitarity~~CallsGraph proc~wann_check_unitarity wann_check_unitarity proc~io_error io_error proc~wann_check_unitarity->proc~io_error

Called by

proc~~wann_check_unitarity~~CalledByGraph proc~wann_check_unitarity wann_check_unitarity proc~wann_main wann_main proc~wann_main->proc~wann_check_unitarity proc~wann_main_gamma wann_main_gamma proc~wann_main_gamma->proc~wann_check_unitarity program~wannier wannier program~wannier->proc~wann_main program~wannier->proc~wann_main_gamma proc~wannier_run wannier_run proc~wannier_run->proc~wann_main proc~wannier_run->proc~wann_main_gamma

Contents

Source Code


Source Code

  subroutine wann_check_unitarity()
    !========================================!

    use w90_constants, only: dp, cmplx_1, cmplx_0, eps5
    use w90_io, only: io_stopwatch, io_error, stdout
    use w90_parameters, only: num_kpts, num_wann, &
      u_matrix, timing_level

    implicit none

    integer :: nkp, i, j, m
    complex(kind=dp) :: ctmp1, ctmp2

    if (timing_level > 1 .and. on_root) call io_stopwatch('wann: check_unitarity', 1)

    do nkp = 1, num_kpts
      do i = 1, num_wann
        do j = 1, num_wann
          ctmp1 = cmplx_0
          ctmp2 = cmplx_0
          do m = 1, num_wann
            ctmp1 = ctmp1 + u_matrix(i, m, nkp)*conjg(u_matrix(j, m, nkp))
            ctmp2 = ctmp2 + u_matrix(m, j, nkp)*conjg(u_matrix(m, i, nkp))
          enddo
          if ((i .eq. j) .and. (abs(ctmp1 - cmplx_1) .gt. eps5)) &
            then
            if (on_root) write (stdout, *) ' ERROR: unitariety of final U', nkp, i, j, &
              ctmp1
            call io_error('wann_check_unitarity: error 1')
          endif
          if ((i .eq. j) .and. (abs(ctmp2 - cmplx_1) .gt. eps5)) &
            then
            if (on_root) write (stdout, *) ' ERROR: unitariety of final U', nkp, i, j, &
              ctmp2
            call io_error('wann_check_unitarity: error 2')
          endif
          if ((i .ne. j) .and. (abs(ctmp1) .gt. eps5)) then
            if (on_root) write (stdout, *) ' ERROR: unitariety of final U', nkp, i, j, &
              ctmp1
            call io_error('wann_check_unitarity: error 3')
          endif
          if ((i .ne. j) .and. (abs(ctmp2) .gt. eps5)) then
            if (on_root) write (stdout, *) ' ERROR: unitariety of final U', nkp, i, j, &
              ctmp2
            call io_error('wann_check_unitarity: error 4')
          endif
        enddo
      enddo
    enddo

    if (timing_level > 1 .and. on_root) call io_stopwatch('wann: check_unitarity', 2)

    return

  end subroutine wann_check_unitarity