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

Fix filtering of bvectors for gamma only case #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rashidrafeek
Copy link

@rashidrafeek rashidrafeek commented Nov 15, 2024

Currently all positive bvectors are chosen while filtering bvectors in the delete_shells_Γ function. This won't work if some components are negative. For example, this does not work for the Na_chain in the wannier90 tests:

using Wannier
read_w90("test-suite/tests/testw90_na_chain_gamma/Na_chain")

gives the error:

┌ Info: Reading win file
│   filename = "test-suite/tests/testw90_na_chain_gamma/Na_chain.win"
│   num_wann = 10
│   num_bands = 30
└   mp_grid = (1, 1, 1)
ERROR: Non-symmetric bvectors for Γ-point calculation: StaticArraysCore.SVector{3, Float64}[[-0.20943951023931953, 0.0, -0.6283185307179586], [-0.20943951023931953, 0.6283185307179586, 0.0], [0.20943951023931953, 0.6283185307179586, 0.0], [0.20943951023931953, 0.0, 0.6283185307179586], [0.20943951023931953, -0.6283185307179586, 0.0], [0.20943951023931953, 0.0, -0.6283185307179586], [-0.20943951023931953, -0.6283185307179586, 0.0], [-0.20943951023931953, 0.0, 0.6283185307179586]]

I noticed this while I was testing it for a system I was working on.

I have fixed this by modifying the delete_shells_Γ to find the non-unique bvectors by filtering bvectors based on whether they are negative of each other. Also, I had to sort the bvectors before delete_shells_Γ as I was getting the error:

ERROR: AssertionError: auto generated kpb_G are different from mmn file

otherwise. So I had to add a method delete_shells_Γ(::KspaceStencil) for the same. This does fix the issue and the above code works fine now. It might be useful to add the above case to the tests.

I am not familiar with the codebase and I am looking at the wannier code for the first time, so not sure whether this is the best approach. Let me know if any changes need to be made.

Also, thanks for the great package :)

Currently all positive bvecs are chosen while filtering bvectors for
gamma-only calculation. This won't work if some components are negative.
Instead, the non-unique bvectors are chosen by filtering based on
whether they are negative of each other.
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.

1 participant