berry_get_kdotp Subroutine

public subroutine berry_get_kdotp(kdotp, dis_manifold, kpt_latt, print_output, pw90_berry, pw90_band_deriv_degen, wannier_data, ws_distance, wigner_seitz, ws_region, HH_R, u_matrix, v_matrix, eigval, real_lattice, scissors_shift, mp_grid, num_bands, num_kpts, num_wann, num_valence_bands, effective_model, have_disentangled, seedname, stdout, timer, error, comm)

Uses

  • proc~~berry_get_kdotp~~UsesGraph proc~berry_get_kdotp berry_get_kdotp module~w90_comms w90_comms proc~berry_get_kdotp->module~w90_comms module~w90_constants w90_constants proc~berry_get_kdotp->module~w90_constants module~w90_postw90_types w90_postw90_types proc~berry_get_kdotp->module~w90_postw90_types module~w90_types w90_types proc~berry_get_kdotp->module~w90_types module~w90_utility w90_utility proc~berry_get_kdotp->module~w90_utility module~w90_wan_ham w90_wan_ham proc~berry_get_kdotp->module~w90_wan_ham module~w90_comms->module~w90_constants module~w90_error_base w90_error_base module~w90_comms->module~w90_error_base module~w90_postw90_types->module~w90_comms module~w90_postw90_types->module~w90_constants module~w90_types->module~w90_constants module~w90_utility->module~w90_comms module~w90_utility->module~w90_constants module~w90_wan_ham->module~w90_constants module~w90_error w90_error module~w90_wan_ham->module~w90_error module~w90_error->module~w90_comms module~w90_error->module~w90_error_base

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(out), dimension(:, :, :, :, :) :: kdotp
type(dis_manifold_type), intent(in) :: dis_manifold
real(kind=dp), intent(in) :: kpt_latt(:,:)
type(print_output_type), intent(in) :: print_output
type(pw90_berry_mod_type), intent(in) :: pw90_berry
type(pw90_band_deriv_degen_type), intent(in) :: pw90_band_deriv_degen
type(wannier_data_type), intent(in) :: wannier_data
type(ws_distance_type), intent(inout) :: ws_distance
type(wigner_seitz_type), intent(inout) :: wigner_seitz
type(ws_region_type), intent(in) :: ws_region
complex(kind=dp), intent(inout), allocatable :: HH_R(:,:,:)
complex(kind=dp), intent(in) :: u_matrix(:,:,:)
complex(kind=dp), intent(in) :: v_matrix(:,:,:)
real(kind=dp), intent(in) :: eigval(:,:)
real(kind=dp), intent(in) :: real_lattice(3,3)
real(kind=dp), intent(in) :: scissors_shift
integer, intent(in) :: mp_grid(3)
integer, intent(in) :: num_bands
integer, intent(in) :: num_kpts
integer, intent(in) :: num_wann
integer, intent(in) :: num_valence_bands
logical, intent(in) :: effective_model
logical, intent(in) :: have_disentangled
character(len=50), intent(in) :: seedname
integer, intent(in) :: stdout
type(timer_list_type), intent(inout) :: timer
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Calls

proc~~berry_get_kdotp~~CallsGraph proc~berry_get_kdotp berry_get_kdotp proc~utility_rotate utility_rotate proc~berry_get_kdotp->proc~utility_rotate proc~wham_get_d_h_p_value wham_get_D_h_P_value proc~berry_get_kdotp->proc~wham_get_d_h_p_value proc~wham_get_eig_deleig wham_get_eig_deleig proc~berry_get_kdotp->proc~wham_get_eig_deleig proc~wham_get_eig_uu_hh_aa_sc wham_get_eig_UU_HH_AA_sc proc~berry_get_kdotp->proc~wham_get_eig_uu_hh_aa_sc proc~wham_get_d_h_p_value->proc~utility_rotate proc~get_hh_r get_HH_R proc~wham_get_eig_deleig->proc~get_hh_r proc~pw90common_fourier_r_to_k pw90common_fourier_R_to_k proc~wham_get_eig_deleig->proc~pw90common_fourier_r_to_k proc~utility_diagonalize utility_diagonalize proc~wham_get_eig_deleig->proc~utility_diagonalize proc~wham_get_deleig_a wham_get_deleig_a proc~wham_get_eig_deleig->proc~wham_get_deleig_a proc~wham_get_eig_uu_hh_aa_sc->proc~get_hh_r proc~pw90common_fourier_r_to_k_new_second_d pw90common_fourier_R_to_k_new_second_d proc~wham_get_eig_uu_hh_aa_sc->proc~pw90common_fourier_r_to_k_new_second_d proc~wham_get_eig_uu_hh_aa_sc->proc~utility_diagonalize interface~comms_bcast comms_bcast proc~get_hh_r->interface~comms_bcast proc~fourier_q_to_r fourier_q_to_R proc~get_hh_r->proc~fourier_q_to_r proc~get_win_min get_win_min proc~get_hh_r->proc~get_win_min proc~io_stopwatch_start io_stopwatch_start proc~get_hh_r->proc~io_stopwatch_start proc~io_stopwatch_stop io_stopwatch_stop proc~get_hh_r->proc~io_stopwatch_stop proc~mpirank mpirank proc~get_hh_r->proc~mpirank proc~operator_wigner_setup operator_wigner_setup proc~get_hh_r->proc~operator_wigner_setup proc~set_error_fatal set_error_fatal proc~get_hh_r->proc~set_error_fatal proc~set_error_file set_error_file proc~get_hh_r->proc~set_error_file proc~set_error_input set_error_input proc~get_hh_r->proc~set_error_input proc~utility_diagonalize->proc~set_error_fatal zhpevx zhpevx proc~utility_diagonalize->zhpevx proc~wham_get_deleig_a->proc~utility_rotate proc~wham_get_deleig_a->proc~utility_diagonalize proc~utility_rotate_diag utility_rotate_diag proc~wham_get_deleig_a->proc~utility_rotate_diag proc~comms_bcast_char comms_bcast_char interface~comms_bcast->proc~comms_bcast_char proc~comms_bcast_cmplx comms_bcast_cmplx interface~comms_bcast->proc~comms_bcast_cmplx proc~comms_bcast_int comms_bcast_int interface~comms_bcast->proc~comms_bcast_int proc~comms_bcast_logical comms_bcast_logical interface~comms_bcast->proc~comms_bcast_logical proc~comms_bcast_real comms_bcast_real interface~comms_bcast->proc~comms_bcast_real proc~comms_sync_error comms_sync_error proc~set_error_fatal->proc~comms_sync_error proc~set_base_error set_base_error proc~set_error_fatal->proc~set_base_error proc~set_error_file->proc~comms_sync_error proc~set_error_file->proc~set_base_error proc~set_error_input->proc~comms_sync_error proc~set_error_input->proc~set_base_error proc~utility_matmul_diag utility_matmul_diag proc~utility_rotate_diag->proc~utility_matmul_diag proc~utility_zgemm_new utility_zgemm_new proc~utility_rotate_diag->proc~utility_zgemm_new proc~comms_bcast_char->proc~comms_sync_error proc~comms_no_sync_bcast_char comms_no_sync_bcast_char proc~comms_bcast_char->proc~comms_no_sync_bcast_char proc~comms_bcast_cmplx->proc~comms_sync_error proc~comms_no_sync_bcast_cmplx comms_no_sync_bcast_cmplx proc~comms_bcast_cmplx->proc~comms_no_sync_bcast_cmplx proc~comms_bcast_int->proc~comms_sync_error proc~comms_no_sync_bcast_int comms_no_sync_bcast_int proc~comms_bcast_int->proc~comms_no_sync_bcast_int proc~comms_bcast_logical->proc~comms_sync_error proc~comms_no_sync_bcast_logical comms_no_sync_bcast_logical proc~comms_bcast_logical->proc~comms_no_sync_bcast_logical proc~comms_bcast_real->proc~comms_sync_error proc~comms_no_sync_bcast_real comms_no_sync_bcast_real proc~comms_bcast_real->proc~comms_no_sync_bcast_real zgemm zgemm proc~utility_zgemm_new->zgemm

Called by

proc~~berry_get_kdotp~~CalledByGraph proc~berry_get_kdotp berry_get_kdotp proc~berry_main berry_main proc~berry_main->proc~berry_get_kdotp program~postw90 postw90 program~postw90->proc~berry_main

Source Code

  subroutine berry_get_kdotp(kdotp, dis_manifold, kpt_latt, print_output, pw90_berry, &
                             pw90_band_deriv_degen, wannier_data, ws_distance, wigner_seitz, &
                             ws_region, HH_R, u_matrix, v_matrix, eigval, real_lattice, &
                             scissors_shift, mp_grid, num_bands, num_kpts, num_wann, &
                             num_valence_bands, effective_model, have_disentangled, seedname, &
                             stdout, timer, error, comm)
    !================================================!
    !  Extracts k.p expansion coefficients using quasi-degenerate
    !  (Lowdin) perturbation theory, adapted to the Wannier formalism,
    !  see Appendix in IAdJS19 for details
    !================================================!

    use w90_constants, only: dp, cmplx_0, cmplx_i
    use w90_wan_ham, only: wham_get_D_h, wham_get_eig_UU_HH_AA_sc, wham_get_eig_deleig, &
                           wham_get_D_h_P_value
    use w90_utility, only: utility_rotate
    use w90_types, only: print_output_type, wannier_data_type, &
                         dis_manifold_type, kmesh_info_type, ws_region_type, ws_distance_type, timer_list_type
    use w90_postw90_types, only: pw90_berry_mod_type, pw90_spin_mod_type, &
                                 pw90_spin_hall_type, pw90_band_deriv_degen_type, pw90_oper_read_type, wigner_seitz_type, &
                                 kpoint_dist_type
    use w90_comms, only: w90_comm_type

    implicit none

    ! Arguments
    type(pw90_berry_mod_type), intent(in) :: pw90_berry
    type(dis_manifold_type), intent(in) :: dis_manifold
    type(pw90_band_deriv_degen_type), intent(in) :: pw90_band_deriv_degen
    type(print_output_type), intent(in) :: print_output
    type(ws_region_type), intent(in) :: ws_region
    type(wannier_data_type), intent(in) :: wannier_data
    type(wigner_seitz_type), intent(inout) :: wigner_seitz
    type(ws_distance_type), intent(inout) :: ws_distance
    type(timer_list_type), intent(inout) :: timer
    type(w90_comm_type), intent(in) :: comm
    type(w90_error_type), allocatable, intent(out) :: error

    complex(kind=dp), intent(out), dimension(:, :, :, :, :)     :: kdotp
    !complex(kind=dp), allocatable, intent(inout) :: AA_R(:, :, :, :) ! <0n|r|Rm>
    complex(kind=dp), allocatable, intent(inout) :: HH_R(:, :, :) !  <0n|r|Rm>
    complex(kind=dp), intent(in) :: u_matrix(:, :, :), v_matrix(:, :, :)

    real(kind=dp), intent(in) :: eigval(:, :)
    real(kind=dp), intent(in) :: real_lattice(3, 3)
    real(kind=dp), intent(in) :: scissors_shift
    real(kind=dp), intent(in) :: kpt_latt(:, :)

    integer, intent(in) :: mp_grid(3)
    integer, intent(in) :: num_wann, num_kpts, num_bands, num_valence_bands
    integer, intent(in) :: stdout

    character(len=50), intent(in) :: seedname
    logical, intent(in) :: have_disentangled
    logical, intent(in) :: effective_model

    complex(kind=dp), allocatable :: UU(:, :)
    complex(kind=dp), allocatable :: HH_da(:, :, :), HH_da_bar(:, :, :)
    complex(kind=dp), allocatable :: HH_dadb(:, :, :, :), HH_dadb_bar(:, :, :, :)
    complex(kind=dp), allocatable :: HH(:, :), HH_bar(:, :)
    real(kind=dp), allocatable    :: eig(:)
    real(kind=dp), allocatable    :: eig_da(:, :)
    complex(kind=dp), allocatable :: D_h(:, :, :)

    ! local variables
    !real(kind=dp) :: DeltaE_n, DeltaE_m
    integer :: kdotp_num_bands
    integer :: i, a, b, n, m, r !, c, bc,if, ifreq, istart, iend
    logical :: break_loop

    allocate (UU(num_wann, num_wann))
    allocate (HH_da(num_wann, num_wann, 3))
    allocate (HH_da_bar(num_wann, num_wann, 3))
    allocate (HH_dadb(num_wann, num_wann, 3, 3))
    allocate (HH_dadb_bar(num_wann, num_wann, 3, 3))
    allocate (HH(num_wann, num_wann))
    allocate (HH_bar(num_wann, num_wann))
    allocate (eig(num_wann))
    allocate (eig_da(num_wann, 3))
    allocate (D_h(num_wann, num_wann, 3))

    ! Gather W-gauge matrix objects !

    ! get Hamiltonian and its first and second derivatives
    call wham_get_eig_UU_HH_AA_sc(dis_manifold, kpt_latt, ws_region, &
                                  print_output, wannier_data, ws_distance, wigner_seitz, HH, &
                                  HH_da, HH_dadb, HH_R, u_matrix, UU, v_matrix, eig, eigval, &
                                  pw90_berry%kdotp_kpoint, real_lattice, scissors_shift, mp_grid, &
                                  num_bands, num_kpts, num_wann, num_valence_bands, &
                                  effective_model, have_disentangled, seedname, stdout, timer, &
                                  error, comm)
    if (allocated(error)) return

    ! get eigenvalues and their k-derivatives
    call wham_get_eig_deleig(dis_manifold, kpt_latt, pw90_band_deriv_degen, ws_region, &
                             print_output, wannier_data, ws_distance, wigner_seitz, HH_da, HH, &
                             HH_R, u_matrix, UU, v_matrix, eig_da, eig, eigval, &
                             pw90_berry%kdotp_kpoint, real_lattice, scissors_shift, mp_grid, &
                             num_bands, num_kpts, num_wann, num_valence_bands, &
                             effective_model, have_disentangled, seedname, stdout, timer, &
                             error, comm)
    if (allocated(error)) return

    ! get D_h (Eq. (24) WYSV06)
    call wham_get_D_h_P_value(pw90_berry, HH_da, D_h, UU, eig, num_wann)

    ! rotate quantities from W to H gauge
    HH_bar(:, :) = utility_rotate(HH(:, :), UU, num_wann)
    do a = 1, 3
      ! first derivative of Hamiltonian dH_da
      HH_da_bar(:, :, a) = utility_rotate(HH_da(:, :, a), UU, num_wann)
      do b = 1, 3
        ! second derivative of Hamiltonian d^{2}H_dadb
        HH_dadb_bar(:, :, a, b) = utility_rotate(HH_dadb(:, :, a, b), UU, num_wann)
      end do
    end do

    kdotp_num_bands = size(pw90_berry%kdotp_bands)
    ! loop on initial and final bands in k.p set (subset A in IAdJS19)
    do n = 1, kdotp_num_bands
      do m = 1, kdotp_num_bands

        ! zeroth order term
        if (n == m) kdotp(n, m, 1, 1, 1) = eig(pw90_berry%kdotp_bands(n))
        ! first order term
        do a = 1, 3
          kdotp(n, m, 2, a, 1) = HH_da_bar(pw90_berry%kdotp_bands(n), pw90_berry%kdotp_bands(m), a)
        end do
        ! second order term
        do a = 1, 3
          do b = 1, 3
            ! add contribution independent of other states
            kdotp(n, m, 3, a, b) = 0.5*(HH_dadb_bar(pw90_berry%kdotp_bands(n), &
                                                    pw90_berry%kdotp_bands(m), a, b))

            ! add contribution dependent on other states (subset B in IAdJS19)
            do r = 1, num_wann

              ! cycle for bands in the k.p set (subset A)
              break_loop = .false.
              do i = 1, kdotp_num_bands
                if (r == pw90_berry%kdotp_bands(i)) break_loop = .true.
              end do
              if (break_loop) cycle

              kdotp(n, m, 3, a, b) = kdotp(n, m, 3, a, b) + &
                                     0.5*HH_da_bar(pw90_berry%kdotp_bands(n), r, a) &
                                     *HH_da_bar(r, pw90_berry%kdotp_bands(m), b) &
                                     *((eig(pw90_berry%kdotp_bands(n)) - eig(r))**(-1) &
                                       + (eig(pw90_berry%kdotp_bands(m)) - eig(r))**(-1))

            end do
          end do
        end do

      end do ! bands
    end do ! bands

  end subroutine berry_get_kdotp