Fix test_run_te_no_geometry convergence at degenerate band - #3308
Fix test_run_te_no_geometry convergence at degenerate band#3308yorickreum wants to merge 1 commit into
Conversation
|
Looking at the CI again, just changing the tolerance won't fix it reliably on all platforms. |
MPB carries the previous k-point's fields into the next solve. At k=(0.5,0,0), where bands 1 and 2 of the empty lattice are degenerate (|k+G| = 0.5 for both G=(0,0,0) and G=(-1,0,0)), that guess is close enough to invariant that the eigensolver stops after two iterations with band 2 at 0.545 instead of 0.5. The band minimum then moves to the next k-point and comes out as |(0.5,0.1,0)| = 0.50990. Whether the stopping criterion is met before the pair settles depends on BLAS, FFTW and libm; this is among the test_mpb failures reported in NanoComp#1853 and NanoComp#2244. The tolerance is not the lever -- it only changes what earlier k-points hand over, so tightening it fixes one machine and breaks another. Randomizing the fields at each k-point removes the inherited basis instead. All eight bands then match the analytic |k+G| to 8e-09. Band 8's expected maximum was the one value that did not: 1.80278 is an eigenvalue at k=(0.5,0,0) but not the eighth, which is 1.5. Over the path band 8 peaks at 1.64012 at k=(0.3,0,0); the inherited guess misses one of the two 1.5 states there and records an 1.80278 state in its place.
7374971 to
0867b1f
Compare
|
Replaced the approach in this PR. The original one (tightening The tolerance is not the right lever. MPB seeds each k-point with the previous k-point's fields, so changing the tolerance changes what earlier k-points hand over, and its effect on the degenerate pair has no consistent sign:
What actually happens at k=(0.5,0,0), from the CI log: The whole k-point is unconverged. Bands 3-6 should be 1.118034 four-fold. And the eigensolver stops after two iterations because the inherited basis is close enough to invariant to satisfy the stopping criterion. The next k-point then needs 12 iterations to recover. So the PR now randomizes the fields at each k-point and leaves the tolerance at 1e-7. With that, all eight bands match the analytic empty-lattice |k+G| to under 1e-08. The one expected value that had to change is band 8's maximum: 1.80278 is an eigenvalue at k=(0.5,0,0) but not the eighth, which is 1.5. The inherited guess misses one of the two 1.5 states and picks up an 1.80278 state instead. The randomized approach finds the correct states imo, |
| ( | ||
| (1.4142135623752818, mp.Vector3(0.0, 0.0, 0.0)), | ||
| (1.8027756376524435, mp.Vector3(0.5, 0.0, 0.0)), | ||
| (1.6401219539085534, mp.Vector3(0.3, 0.0, 0.0)), |
There was a problem hiding this comment.
Why not change this line to (1.5, mp.Vector3(0.5, 0.0, 0.0)), since this is the correct result for the eighth eigenvalue which randomizing the fields actually uncovers (as you described in your bug report)?
Bands 1 and 2 of the empty lattice are degenerate at k=(0.5,0,0): |k+G| is 0.5 for both G=(0,0,0) and G=(-1,0,0). The sweep reaches that k-point carrying the previous point's fields as its initial guess, which is a poor basis for the pair, and at 1e-7 -- the only run in this file not using 1e-12 -- the solver stops with band 2 still at 0.5447. That exceeds the frequency at the next k-point, so the band minimum relocates there and comes out as |(0.5,0.1,0)| = 0.50990 instead of 0.5.
Solving that k-point on its own converges correctly at any tolerance, so what fails is the stopping criterion during the sweep; whether it is met before band 2 settles depends on details of BLAS, FFTW and libm. The expected values are accurate to 1e-11, four orders tighter than a 1e-7 criterion can justify, so ask for that much convergence. The assertions are unchanged.
Same class of defect as #2298: a test asserting more precision than its convergence resolves at a degeneracy. Reported among the test_mpb failures on Apple silicon in #1853 and in #2244.