Dear EPW developers,
I have modified the transport.f90 file to calculate both the overall RTA mobility and the mode-resolved mobility. Although the code compiles successfully and outputs data, the results differ from those in epw.out, indicating an issue with my modifications. Could the EPW team kindly review the changes and help identify the problem so that I can improve the code? For reference, I have attached the modified files and the added sections.
Thank you.
IF (iverbosity == 3) THEN
DO itemp = 1, nstemp
etemp = gtemp(itemp)
DO ik = 1, nktotf
DO ibnd = 1, nbndfst
IF (ABS(inv_tau_allcb(ibnd, ik, itemp)) > eps160 ) THEN
ekk = etf_all(ibnd, ik) - ef0(itemp)
fnk = wgauss(-ekk / etemp, -99)
dfnk = w0gauss(ekk / etemp, -99) / etemp
part2 = part2 + fnk
! (-) sign is because w0gauss is - df/de
f_serta(:, ibnd, ik, itemp) = wkf_all(ik) * dfnk * vkk_all(:, ibnd, ik) * vkk_all(:, ibnd, ik) * 1.093846036396395d0 * 1.093846036396395d0 / (inv_tau_allcb(ibnd, ik, itemp) * ryd2mev * mev2invps)
DO imode = 1, nmodes
IF (ABS(inv_tau_allcb_mode(imode, ibnd, ik, itemp)) > eps160) THEN
f_serta3(:, ibnd, ik, itemp, imode) = wkf_all(ik) * dfnk * vkk_all(:, ibnd, ik) * vkk_all(:, ibnd, ik) * 1.093846036396395d0 * 1.093846036396395d0 / (inv_tau_allcb_mode(imode, ibnd, ik, itemp) * ryd2mev * mev2invps)
ENDIF
ENDDO
ENDIF
ENDDO
ENDDO
ENDDO
OPEN (1, file="BTE.mode_xx", status="replace")
WRITE(1, '(1E14.5)') 1.0E4 *sum (f_serta(1, :, :,

)/part2
do imode = 1, nmodes
WRITE(1, '(1i8,1E14.5)') imode, 1.0E4 *sum(f_serta3(1, :, :, :, imode)) / part2
enddo
close(1)
OPEN (1, file="BTE.mode_yy", status="replace")
WRITE(1, '(1E14.5)') 1.0E4 *sum (f_serta(2, :, :,

)/part2
do imode = 1, nmodes
WRITE(1, '(1i8,1E14.5)') imode, 1.0E4 *sum(f_serta3(2, :, :, :, imode)) / part2
enddo
close(1)
OPEN (1, file="BTE.mode_zz", status="replace")
WRITE(1, '(1E14.5)') 1.0E4 *sum (f_serta(3, :, :,

)/part2
do imode = 1, nmodes
WRITE(1, '(1i8,1E14.5)') imode, 1.0E4 *sum(f_serta3(3, :, :, :, imode)) / part2
enddo
close(1)
ENDIF