Skip to content

[BUG] nbspline gives wrong structure factors at low orders: #8092

Open

Description

@Cstandardlib

Describe the bug

Summary

Enabling nbspline (Cardinal B-spline structure factor) with a low order produces wrong structure factors S(G) in both OFDFT and KSDFT.

nbspline $E_{total}$ (eV) electrons from rho (correct: 28)
off −4200.2531231 28
2 +141273.06 224 = 8×
4 −3859.3156705 31.8133 = 1.136×
6 −4193.0982668 28.117 = 1.004×
8 −4200.1922371 28.0021
10 −4200.2580507 28
20 −4200.2532790 28

Details

Example: tests/01_PW/032_PW_15_CF_CS_bspline (GaAs, 28 electrons)

  1. Total energies are catastrophically wrong at n=2–6, from the first SCF step.
n=2
!FINAL_ETOT_IS 141273.0584391949523706 eV

n=4
!FINAL_ETOT_IS -3859.3156704751031612 eV

n=6
!FINAL_ETOT_IS -4193.0982667816042522 eV

n=8
!FINAL_ETOT_IS -4200.1922370850106745 eV

n=20
!FINAL_ETOT_IS -4200.2532789746392154 eV

no nbspline specified
!FINAL_ETOT_IS -4200.2531231037410180 eV
  1. The initial electron count is multiplied by exactly (1−1/n!)⁻³ (n = nbspline): 8× for n=2, 1.136× for n=4, 1.004× for n=6.Taken from warning.log:
n=2
Electron number from rho = 224

n=4
Electron number from rho = 31.8132653899894

n=6
Electron number from rho = 28.1169914924782

n=8
Electron number from rho = 28.0020834366776

n=20
Electron number from rho = 28.0000000000001

no nbspline specified
Electron number from rho = 28.0000000000001

Here,
224/28=8; (1-1/2!)⁻³=8
31.8132653899894/28=1.136188; (1-1/4!)⁻³=1.136188
28.1169914924782/28=1.004178; (1-1/6!)⁻³=1.004178
...

This implies a missing term leading to the wrong Structural Factor, while the orders $\ge$ 8–10 are numerically unaffected, so the existing integration tests (which use nbspline 10 and 20) pass with correct references.

Expected behavior

No response

To Reproduce

Change nbspline to a rather low order for case tests/01_PW/032_PW_15_CF_CS_bspline.

Environment

No response

Additional Context

No response

Task list for Issue attackers (only for developers)

  • Verify the issue is not a duplicate.
  • Describe the bug.
  • Steps to reproduce.
  • Expected behavior.
  • Error message.
  • Environment details.
  • Additional context.
  • Assign a priority level (low, medium, high, urgent).
  • Assign the issue to a team member.
  • Label the issue with relevant tags.
  • Identify possible related issues.
  • Create a unit test or automated test to reproduce the bug (if applicable).
  • Fix the bug.
  • Test the fix.
  • Update documentation (if necessary).
  • Close the issue and inform the reporter (if applicable).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

QuestionsRaise your quesiton! We will answer it.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions