kylebystrom / pawpyseed

Parallel C/Python package for numerical analysis of PAW DFT wavefunctions
BSD 3-Clause "New" or "Revised" License
31 stars 11 forks source link

explicit tests comparing pawpyseed's all-electron WF and VASP's internal calculations #16

Open bernstei opened 3 years ago

bernstei commented 3 years ago

We've been trying to reproduce VASP's internal calculations of optical transition matrix elements - that's not what we really want, but just to convince ourselves that we have the right wavefunctions. We've been unable to do so, so far, and we'd like to eliminate the possibility that the issue is a bug in pawpyseed.

  1. Are there any explicit tests of the pawpyseed output wavefunctions that show that they give the same results as VASP's internal matrix element (of any sort) calculations? I think something like that would help us figure out if we are using the wavefunctions correctly.

  2. Would you expect that pawpyseed's wavefunctions (if printed at sufficient spatial resolution) would be able to reproduce VASP's own optical transition matrix elements, or is there something subtle about pseudo vs. PAW non-pseudized vs. actual all electron wavefunctions that would preclude that?

bernstei commented 3 years ago

I just did a test with LAECHG=T comparing the content of AECCAR2 and the norm of the pawpyseed wavefunction for a single electron system (1 Li atom in a cell), and it looks correct. Might still be nice to have that as a unit test.

kylebystrom commented 3 years ago

Sorry for the lack of responsiveness this week; I will push to PyPI tonight and answer the other issue you posted ASAP.

  1. Not really, only the overlap operator (which is tested pretty thoroughly in core.tests.test_core.py). The MomentumMatrix class has some basic unit tests to make sure that frequency components of the density are correct by calculating <nk|exp(iGR)|nk> with some nonzero G (https://github.com/kylebystrom/pawpyseed/blob/6f5aa0b8ca8c28a0221e5256afeb939c3344560b/pawpyseed/core/tests/test_momentum.py#L77). You are right that this would be good though. I also have a test to check electron count normalization (https://github.com/kylebystrom/pawpyseed/blob/6f5aa0b8ca8c28a0221e5256afeb939c3344560b/pawpyseed/core/tests/test_core.py#L481). It is correct, but only to about 1e-2 (see Part 2 for why that is). Unfortunately, I have not done optical matrix element calculations before and do not currently have a VASP license, so I cannot do that on my own currently. I will possibly have a VASP license again in the near future though.

  2. Not quite. The main issue here is that the projector functions used to transform between pseudo wavefunctions and the AE wavefunction are not complete, and the formula used in the PAW formalism for expectation values and matrix elements is only exact in the complete basis set limit of the projectors. Therefore, a matrix element calculated as $\int d^3r \phi_i(r) \hat{O} \phi_j(r)$ will always have some numerical error compared to $<i|\hat{O}|j>$ in the PAW formalism, no matter how dense the grid is. This is also why the unit tests to check that the frequency components of the density are correct only goes over a few wavenumbers; the incompleteness of the partial wave basis set causes issues at higher frequencies (unless there's a significant bug I missed, which is possible, but I have proofread that function a few times). Sorry for the confusion on this issue; I should find a place in the docs to make this more clear so that people are not overly trusting of this info.

bernstei commented 3 years ago

Thanks for the thorough response. I appreciate the help, and will now have to spend some time thinking about your comments and the PAW formalism. I'll let you know if I have any followup questions.