Skip to content

fix: correct Fourier transform sign in k→R density matrix transform#7499

Open
dyzheng wants to merge 1 commit into
deepmodeling:developfrom
dyzheng:dm_norm_nspin4
Open

fix: correct Fourier transform sign in k→R density matrix transform#7499
dyzheng wants to merge 1 commit into
deepmodeling:developfrom
dyzheng:dm_norm_nspin4

Conversation

@dyzheng

@dyzheng dyzheng commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

The inverse Fourier transform from k-space to real-space density matrix used e^{+ikR} instead of the correct e^{-ikR} as specified in nao_lcao_force_stress_derivation.md Section 3.

This caused the stored DMR to be D_{μν}(-R) instead of the required trace-DM D̄_{μν}(R) = D_{νμ}(-R), leading to incorrect nonlocal pseudopotential forces for non-collinear (nspin=4) calculations with SOC.

Changes:

  • density_matrix.cpp: Fix sign in cal_DMR(), cal_DMR_td(), cal_DMR_full() from TK(cosp, sinp) to TK(cosp, -sinp)
  • dmr_complex.cpp: Fix sign in linear-response cal_DMR() specialization

Verified by Hermiticity check D(R) = D†(-R) at machine precision.

Reminder

  • Have you linked an issue with this pull request?
  • Have you added adequate unit tests and/or case tests for your pull request?
  • Have you noticed possible changes of behavior below or in the linked issue?
  • Have you explained the changes of codes in core modules of ESolver, HSolver, ElecState, Hamilt, Operator or Psi? (ignore if not applicable)

Linked Issue

Fix #...

Unit Tests and/or Case Tests for my changes

  • A unit test is added for each new feature or bug fix.

What's changed?

  • Example: My changes might affect the performance of the application under certain conditions, and I have tested the impact on various scenarios...

Any changes of core modules? (ignore if not applicable)

  • Example: I have added a new virtual function in the esolver base class in order to ...

The inverse Fourier transform from k-space to real-space density matrix
used e^{+ikR} instead of the correct e^{-ikR} as specified in
nao_lcao_force_stress_derivation.md Section 3.

This caused the stored DMR to be D_{μν}(-R) instead of the required
trace-DM D̄_{μν}(R) = D_{νμ}(-R), leading to incorrect nonlocal
pseudopotential forces for non-collinear (nspin=4) calculations with SOC.

Changes:
- density_matrix.cpp: Fix sign in cal_DMR(), cal_DMR_td(), cal_DMR_full()
  from TK(cosp, sinp) to TK(cosp, -sinp)
- dmr_complex.cpp: Fix sign in linear-response cal_DMR() specialization

Verified by Hermiticity check D(R) = D†(-R) at machine precision.
@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes Feature Discussed The features will be discussed first but will not be implemented soon labels Jun 21, 2026
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 Feature Discussed The features will be discussed first but will not be implemented soon Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants