Skip to content

Fix: Support out_current=2 with multiple MPI processes#7624

Open
AsTonyshment wants to merge 1 commit into
deepmodeling:developfrom
AsTonyshment:out_current_2
Open

Fix: Support out_current=2 with multiple MPI processes#7624
AsTonyshment wants to merge 1 commit into
deepmodeling:developfrom
AsTonyshment:out_current_2

Conversation

@AsTonyshment

Copy link
Copy Markdown
Collaborator

Linked Issue

No linked issue. The bug was reproduced locally.

What's changed?

out_current = 2 was introduced in PR #6886 as a matrix-commutation method for calculating current. Its multi-process path was already known to crash when it was introduced, and this bug has remained unresolved since then.

out_current = 2 incorrectly used global orbital and band indices to access MPI-local distributed matrices, causing heap corruption with multiple MPI ranks. It also did not reduce rank-local current contributions.

This PR:

  • uses local indices when constructing the position matrices;
  • converts global band indices to the local ScaLAPACK layout;
  • reduces current contributions across MPI ranks.

out_current = 2 now works with multiple MPI ranks and remains numerically consistent with the single-rank result. The related parameter and developer documentation was also clarified.

Unit Tests and/or Case Tests for my changes

Case test: the same LCAO RT-TDDFT calculation (bulk Si with 2×2×2 k-point sampling) was run with one MPI rank and 32 OpenMP threads, and with four MPI ranks and 8 OpenMP threads per rank. The currents in current_tot_comm.txt overlap throughout all 10 time steps.

result_efield_current

Governance Notes

  • INPUT/docs changes: Description only; the accepted values and default are unchanged. The runtime metadata, YAML, and input reference are synchronized.
  • Core module impact: Limited to the source_io RT-TDDFT current-output path; no core interfaces or workflows are changed.
  • Exceptions requested: None.

@ESROAMER ESROAMER left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work!

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.

2 participants