Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

use_ws_distance in pw90common_fourier_R_to_k_vec #271

Closed
qiaojunfeng opened this issue May 11, 2019 · 0 comments · Fixed by #273
Closed

use_ws_distance in pw90common_fourier_R_to_k_vec #271

qiaojunfeng opened this issue May 11, 2019 · 0 comments · Fixed by #273

Comments

@qiaojunfeng
Copy link
Collaborator

When using the pw90common_fourier_R_to_k_new and pw90common_fourier_R_to_k_vec in postw90_common.F90, I noticed they produce different results, which is caused by the repeated lines in pw90common_fourier_R_to_k_vec.

rdotk = twopi*dot_product(kpt(:), real(irdist_ws(:, ideg, i, j, ir), dp))
phase_fac = cmplx(cos(rdotk), sin(rdotk), dp)/real(ndegen(ir)*wdist_ndeg(i, j, ir), dp)
rdotk = twopi*dot_product(kpt(:), irvec(:, ir))
phase_fac = cmplx(cos(rdotk), sin(rdotk), dp)/real(ndegen(ir), dp)

In the use_ws_distance = .true. branch, the rdotk and phase_fac are calculated twice. The first two lines use the new Wigner-Seitz cell interpolation, while the last two lines use the old interpolation. As a result, the old interpolation replaces the Wigner-Seitz cell interpolation. The last two lines should be deleted.

There are repeated lines in pw90common_fourier_R_to_k_vec_dadb as well.

rdotk = twopi*dot_product(kpt(:), real(irdist_ws(:, ideg, i, j, ir), dp))
phase_fac = cmplx(cos(rdotk), sin(rdotk), dp)/real(ndegen(ir)*wdist_ndeg(i, j, ir), dp)
rdotk = twopi*dot_product(kpt(:), irvec(:, ir))
phase_fac = cmplx(cos(rdotk), sin(rdotk), dp)/real(ndegen(ir), dp)

The SHC code uses both pw90common_fourier_R_to_k_new and pw90common_fourier_R_to_k_vec

call pw90common_fourier_R_to_k_new(kpt, SS_R(:, :, :, shc_gamma), OO=S_w)

call pw90common_fourier_R_to_k_vec(kpt, SR_R(:, :, :, shc_gamma, :), OO_true=SR_w)

When I change the wrong pw90common_fourier_R_to_k_vec to the correct pw90common_fourier_R_to_k_new, the testpostw90_pt_shc test case produces large deviations,

shc
    ERROR: absolute error 7.05e+01 greater than 1.00e-03. (Test: 280.60944.  Benchmark: 351.10919.)
    ERROR: relative error 2.01e-01 greater than 2.00e-03. (Test: 280.60944.  Benchmark: 351.10919.)
shc
    ERROR: absolute error 7.12e+01 greater than 1.00e-03. (Test: 282.67215.  Benchmark: 353.83371.)
    ERROR: relative error 2.01e-01 greater than 2.00e-03. (Test: 282.67215.  Benchmark: 353.83371.)

Fortunately, when using a denser berry_kmesh like 100 * 100 * 100, the final result doesn't change much compared to previous calculations:
pt_diff
The Pt-shc-fermiscan.dat.old.10 and Pt-shc-fermiscan.dat.old.100 are calculated with the develop branch, the Pt-shc-fermiscan.dat.new.10 and Pt-shc-fermiscan.dat.new.100 are calculated with my modified branch, which uses pw90common_fourier_R_to_k_new instead of pw90common_fourier_R_to_k_vec.

When this problem is fixed, I may need to update benchmark files in the SHC test cases.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant