Commit 69600dd
abacus_fixer
test(klist): fix broken semantics exposed by the nspin->spin_mult rename
After the rename of K_Vectors::nspin -> spin_mult, two kinds of latent
misuses in the tests became visible and are corrected here:
1. In klist_test_para.cpp, set() calls had been passing kv->spin_mult as
the nspin_in argument. That was only working by accident (both sides
happened to be 1). Since set() takes the *physical* nspin (1/2/4,
which it then maps to spin_mult internally), replace the member
argument with explicit physical-nspin literals, and remove the now-
redundant pre-set of the member (set() overwrites it anyway).
2. In klist_test.cpp (SetKupKdown test), the non-collinear case had
been written as kv->spin_mult = 4, which is not a legal spin_mult
value (only 1 and 2 are). K_Vectors maps nspin=4 -> 1 (non-
collinear does not double the k-point list); the 4 was only masking
a coincidentally matching renew(nkstot*4) size and a set_kup_and_kdw
default branch that did nothing. Change it to the correct mapped
value (1), add case A/B/C comments explaining the physical spin
source for each case, and remove the bogus isk[ik+5/10/15] checks
that relied on the accidentally oversized container.
All production call sites already pass the physical nspin correctly
(inp.nspin / inp_->nspin), so no source changes are needed there.1 parent 4fffc2f commit 69600dd
2 files changed
Lines changed: 14 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
632 | 632 | | |
633 | 633 | | |
634 | 634 | | |
| 635 | + | |
| 636 | + | |
635 | 637 | | |
636 | 638 | | |
637 | 639 | | |
638 | 640 | | |
639 | 641 | | |
640 | 642 | | |
641 | 643 | | |
642 | | - | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
643 | 650 | | |
644 | 651 | | |
645 | 652 | | |
646 | 653 | | |
647 | 654 | | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | 655 | | |
652 | 656 | | |
653 | 657 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
187 | | - | |
| 186 | + | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
310 | | - | |
311 | | - | |
| 310 | + | |
| 311 | + | |
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
| 334 | + | |
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| |||
0 commit comments