Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Higher-order finite difference #504

Merged
merged 47 commits into from
Jun 24, 2024

Conversation

manxkim
Copy link
Contributor

@manxkim manxkim commented May 22, 2024

The formula for calculating derivatives in k-space has so far been calculated using the first-order finite-difference(FD) approximation. This PR adds the higher-order FD to make .nnkp files. The main changes are in kmesh.f90.

Suppose the first-order FD uses b-vectors. The main strategy of n-th order(n>1) FD is to add 2b, 3b, ... nb vectors, and apply more conditions like Eq. (B1) in [1] to calculate the finite difference coefficients w_b, w_2b, w_3b, ... w_nb.

The scheme is in the same way as we did in one-dimension(see https://en.wikipedia.org/wiki/Finite_difference_coefficient)

This PR includes

New parameters:

  1. higher_order_n: default is 1(1st-order).
  2. higher_order_nearest_shells: default is .false.. If true, the routine uses the nearest shells to satisfy the conditions like (B1). Not extensively tested, and it is an experimental feature.

New tests:

  1. testw90_nnkpt6: a test for the higher-order bvectors and weights. output: .nnkp
  2. testw90_nnkpt7: a test for the higher-order bvectors and bweights, using the nearest-shells method. output: .nnkp
  3. testw90_knbo3_higher: a test for the Wannier position matrix elements and spreads using higher-order finite difference. output: .wout
  4. testpostw90_pt_shc_higher: a test for the spin hall conductivity using higher-order finite difference. output: -shc-fermiscan.dat

[1] N. Marzari and D. Vanderbilt, Physical Review B 56, 12847 (1997)

manxkim and others added 30 commits February 23, 2022 04:56
@manxkim manxkim marked this pull request as draft May 22, 2024 01:37
@manxkim
Copy link
Contributor Author

manxkim commented May 23, 2024

Except the test testw90_example02_restart, all tests passed.

The order of b-vectors file has been changed by the subroutine kmesh_sort. Therefore .chk, and the other outputs (.mmn, .uHu) including the info of b-vectors should be constructed again. The same issue should be applied to #498 (comment)

@manxkim manxkim marked this pull request as ready for review May 23, 2024 07:07
@manxkim
Copy link
Contributor Author

manxkim commented May 29, 2024

bvecs in benchmark, and the lines in .chk and .mmn for lead (testw90_bvec, testw90_example02_restart) have been rearranged.

Copy link
Collaborator

@JeromeCCP9 JeromeCCP9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Higher order functionality coded neatly and consistently with new code style. Tests all pass correctly and new functionality is tested and documented appropriately.

@JeromeCCP9 JeromeCCP9 merged commit dd450c6 into wannier-developers:develop Jun 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants