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

Flip the sign of einspline twist input #3797

Merged
merged 5 commits into from
Feb 2, 2022

Conversation

ye-luo
Copy link
Contributor

@ye-luo ye-luo commented Feb 1, 2022

Proposed changes

h5 from DFT has [0 0.5 0.25]
Before this PR, we input twist="0.0 -0.5 -0.25"

Super twist #0:  [   0.00000   0.00000   0.00000 ]
Super twist #1:  [  -0.00000   0.50000  -0.25000 ]
  Using supercell twist 1:  [  -0.00000   0.50000  -0.25000]

Now we should input twist="0.0 0.5 0.25" as DFT.

Super twist #0:  [   0.00000   0.00000   0.00000 ]
Super twist #1:  [   0.00000   0.50000   0.25000 ]
  Using supercell twist 1:  [   0.00000   0.50000   0.25000]

This change breaks backward compatibility. Tools generating input for QMCPACK should be updated.

The fix in splines is in the builders, updating all the spline implementation is to much more involving. Thus kept the old sign.
We may change that after delete EinsplineSet but that doesn't affect users.

I also changed the convention in MomentumEstimator.
closes #1386.

I also deleted code that was commented out.

What type(s) of changes does this code introduce?

  • Bugfix

Does this introduce a breaking change?

  • No

What systems has this change been tested on?

epyc-server

Checklist

  • Yes. This PR is up to date with current the current state of 'develop'

The sign convention has been changed in EinsplineSetBuilder and thus this is a user facing change.
In the new choice is aligned with DFT codes.
EinsplineSet and BsplineSet internal kPoints keep the old sign.
@ye-luo ye-luo requested a review from jtkrogel February 1, 2022 20:10
@jtkrogel
Copy link
Contributor

jtkrogel commented Feb 1, 2022

I will review/comment here, but likely not until tomorrow.

@ye-luo
Copy link
Contributor Author

ye-luo commented Feb 1, 2022

Test this please

@jtkrogel
Copy link
Contributor

jtkrogel commented Feb 2, 2022

The sign issue is only partly an input problem. Does this just change the sign on the input, but retain the inverted sign internally during orbital construction or evaluation?

If the inverted sign is retained internally, this is a problem because a Bloch state with inverted wavevector exists in the wavefunction. The actual wavevector of the Bloch state is probed with the momentum distribution, and this can result in no signal in the case of inconsistency.

@ye-luo
Copy link
Contributor Author

ye-luo commented Feb 2, 2022

The issue of momentum distribution is a pure input problem.
Because orbital saves the twist to ParticleSet and then momentum distribution reads from it.
However ElectronGasBuilder and EinsplineSetBuilder doesn't store the twist in the same convention. By flipping the sign in EinsplineSetBuilder, momentum distribution always take twists in the usual DFT convention.
Note that EinsplineSetBuilder is an object different from EinsplineSet. Momentum distribution doesn't and shouldn't know what underlying SPOSet is.

About EinsplineSet/BsplineSet internal. kPoints are stored as -twist with some additional lattice shift. When evaluating an orbital. A bloch state is e^(i twist r)u(r). u(r) is the spline orbital. Because kPoints carries opposite sign. The evaluation function computes e^(- i k r). See

qmcplusplus::sincos(-(x * kX + y * kY + z * kZ), &s, &c);

How is u(r) is constructed. It is first fft from planewave coefficient. Then it is rotated. Rotating a phase doesn't change the physics of orbital itself and there is neither phase imposed from QE. The rotation angle determination is empirical and it needs to evaluate orbitals and there seems to be a sign flip see einspline_helper.hpp. but as long as rotation doesn't change physics, it should not hurt. Change it requires updating unit test references.

We need to anatomize the overall issue and take incremental steps.

@jtkrogel
Copy link
Contributor

jtkrogel commented Feb 2, 2022

Probably best to have a quick chat/call on this.

@ye-luo
Copy link
Contributor Author

ye-luo commented Feb 2, 2022

Test this please

Copy link
Contributor

@jtkrogel jtkrogel left a comment

Choose a reason for hiding this comment

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

LGTM. It seems that Einspline* and Momentum* were correcting for the inverted sign independently, so this changes here should not affect the functioning of n(k) estimators.

The changes here should fix #1386. Someone should rerun the inputs provided in that issue and check after this PR goes in.

@ye-luo ye-luo merged commit 630f904 into QMCPACK:develop Feb 2, 2022
@ye-luo ye-luo deleted the fix-einspline-twist-input branch February 2, 2022 22:46
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.

Inconsistent twist directions between electron gas and einspline wavefunctions
2 participants