subroutine wham_get_eig_UU_HH_AA_sc_TB_conv(pw90_berry, dis_manifold, kmesh_info, kpt_latt, &
ws_region, print_output, wannier_data, ws_distance, &
wigner_seitz, AA_R, HH, HH_da, HH_dadb, HH_R, &
u_matrix, UU, v_matrix, eig, eigval, kpt, &
real_lattice, scissors_shift, mp_grid, &
num_bands, num_kpts, num_wann, num_valence_bands, &
effective_model, have_disentangled, seedname, &
stdout, timer, error, comm)
!================================================!
!
! modified version of wham_get_eig_UU_HH_AA_sc, calls routines
! satisfying the TB phase convention
!
!================================================!
use w90_constants, only: dp
use w90_get_oper, only: get_HH_R, get_AA_R_effective, get_AA_R
use w90_postw90_common, only: pw90common_fourier_R_to_k_new_second_d_TB_conv
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_utility, only: utility_diagonalize
use w90_postw90_types, only: pw90_berry_mod_type, wigner_seitz_type
use w90_comms, only: w90_comm_type, mpirank
implicit none
! arguments
type(pw90_berry_mod_type), intent(in) :: pw90_berry
type(dis_manifold_type), intent(in) :: dis_manifold
type(kmesh_info_type), intent(in) :: kmesh_info
real(kind=dp), intent(in) :: kpt_latt(:, :)
type(print_output_type), intent(in) :: print_output
type(ws_region_type), intent(in) :: ws_region
type(w90_comm_type), intent(in) :: comm
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_error_type), allocatable, intent(out) :: error
integer, intent(in) :: num_wann, num_kpts, num_bands, num_valence_bands
integer, intent(in) :: mp_grid(3)
integer, intent(in) :: stdout
real(kind=dp), intent(out) :: eig(num_wann)
real(kind=dp), intent(in) :: eigval(:, :)
real(kind=dp), intent(in) :: kpt(3), real_lattice(3, 3)
real(kind=dp), intent(in) :: scissors_shift
complex(kind=dp), intent(out) :: UU(:, :)
complex(kind=dp), intent(out) :: HH(:, :)
complex(kind=dp), intent(out) :: HH_da(:, :, :)
complex(kind=dp), intent(out) :: HH_dadb(:, :, :, :)
complex(kind=dp), intent(in) :: u_matrix(:, :, :), v_matrix(:, :, :)
complex(kind=dp), allocatable, intent(inout) :: HH_R(:, :, :) ! <0n|r|Rm>
complex(kind=dp), allocatable, intent(inout) :: AA_R(:, :, :, :) ! <0n|r|Rm>
character(len=50), intent(in) :: seedname
logical, intent(in) :: have_disentangled
logical, intent(in) :: effective_model
call get_HH_R(dis_manifold, kpt_latt, print_output, wigner_seitz, HH_R, u_matrix, v_matrix, &
eigval, real_lattice, scissors_shift, num_bands, num_kpts, num_wann, &
num_valence_bands, effective_model, have_disentangled, seedname, ws_distance, ws_region, &
stdout, timer, error, comm)
if (allocated(error)) return
if (effective_model) then
call get_AA_R_effective(print_output, AA_R, HH_R, wigner_seitz%nrpts, num_wann, seedname, &
stdout, timer, error, comm)
else
call get_AA_R(pw90_berry, dis_manifold, kmesh_info, kpt_latt, print_output, wannier_data, AA_R, &
v_matrix, eigval, wigner_seitz, ws_distance, ws_region, num_bands, num_kpts, &
num_wann, have_disentangled, seedname, stdout, timer, error, comm)
end if
if (allocated(error)) return
call pw90common_fourier_R_to_k_new_second_d_TB_conv(kpt, HH_R, AA_R, num_wann, ws_region, &
wannier_data, real_lattice, mp_grid, &
ws_distance, wigner_seitz, error, comm, &
OO=HH, OO_da=HH_da(:, :, :), &
OO_dadb=HH_dadb(:, :, :, :))
if (allocated(error)) return
call utility_diagonalize(HH, num_wann, eig, UU, error, comm)
if (allocated(error)) return
end subroutine wham_get_eig_UU_HH_AA_sc_TB_conv