Skip to content

Fix(pw): suppress spurious warning when no plane waves exist for a k-point#7282

Merged
mohanchen merged 2 commits into
deepmodeling:developfrom
Cstandardlib:fix/pw-warnings
Apr 28, 2026
Merged

Fix(pw): suppress spurious warning when no plane waves exist for a k-point#7282
mohanchen merged 2 commits into
deepmodeling:developfrom
Cstandardlib:fix/pw-warnings

Conversation

@Cstandardlib
Copy link
Copy Markdown
Collaborator

@Cstandardlib Cstandardlib commented Apr 25, 2026

Linked Issue

Refs #7201

Description

This PR fixes the spurious no plane waves warning that occur during SCF calculations when certain k-points have zero plane waves due to insufficient wavefunction cutoff energy (ecutwfc).

When performing calculations with small simulation cells and low energy cutoffs,
k-points located far from reciprocal lattice points (requiring large |k+G| vectors)
may fall outside the kinetic energy cutoff sphere,
resulting in zero plane waves for those k-points. In such regimes:

  • At low ecutwfc (50–60 Ry), the code immediately aborted with "no plane waves".
  • At medium ecutwfc (70–130 Ry), plane waves existed but npwx < nbands,
    leading to rank deficiency and psi_norm <= 0 during CG diagonalization in diago_cg.cpp.

These k-points with zero plane waves are valid edge cases. This PR adds the
necessary zero-count guards so the code reports energy/k-points issue instead of reducing the cores.

What's Changed

  • Fix the warning message logic in PW_Basis_K::setuptransform() when no plane waves are available for a k-point.
  • Distinguish between two cases and emit appropriate warnings:
    1. Globally empty: No plane waves exist for this k-point across the entire MPI pool.
      Prompts the user to increase ecutwfc or check KPT settings.
    2. Locally empty (parallel): The current MPI rank has zero plane waves, but other ranks in the pool still have some.
      Prompts the user to reduce the number of cores.

Unit Tests and/or Case Tests for my changes

  • Add two unit tests to cover both scenarios:
    • test_no_plane_wave_message_global_empty_k
    • test_no_plane_wave_message_parallel_local_empty

Copilot AI review requested due to automatic review settings April 25, 2026 02:32
@Cstandardlib Cstandardlib changed the title Fix warning when there is no plane wave for current k point Fix(pw): suppress spurious warning when no plane waves exist for a k-point Apr 25, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@mohanchen mohanchen added Refactor Refactor ABACUS codes Bugs Bugs that only solvable with sufficient knowledge of DFT labels Apr 28, 2026
@mohanchen mohanchen merged commit 4ff7cff into deepmodeling:develop Apr 28, 2026
15 checks passed
@Cstandardlib Cstandardlib deleted the fix/pw-warnings branch April 28, 2026 03:04
@Cstandardlib Cstandardlib restored the fix/pw-warnings branch April 28, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants