Skip to content

Fix: Output dipole moments in Cartesian coordinates for arbitrary lattices in RT-TDDFT - #8105

Merged
mohanchen merged 1 commit into
deepmodeling:developfrom
AsTonyshment:fix/dipole_cartesian
Oct 10, 2026
Merged

mohanchen merged 1 commit into
deepmodeling:developfrom
AsTonyshment:fix/dipole_cartesian

Conversation

@AsTonyshment

Copy link
Copy Markdown
Collaborator

Fix the shared RT-TDDFT dipole output to report Cartesian x/y/z components for arbitrary lattices. Previously, projections along reciprocal lattice directions were incorrectly labeled as Cartesian components.

Writing $\rho(\boldsymbol{r})$ as the signed charge density and $\widehat{\boldsymbol{g}}_1$ as the unit vector along the first reciprocal lattice vector, the x component changes from

$$p_x^{\mathrm{old}}=\int\rho(\boldsymbol{r})(\boldsymbol{r}\cdot\widehat{\boldsymbol{g}}_1)\ \mathrm{d}^{3}r\qquad\longrightarrow\qquad p_x^{\mathrm{new}}=\int\rho(\boldsymbol{r})x\ \mathrm{d}^{3}r$$

The same correction applies to y and z.

PR #6441 fixed a similar coordinate-transformation bug in the length-gauge electric field; the corresponding issue in dipole output remained unnoticed until now.

@AsTonyshment
AsTonyshment requested review from ESROAMER and mohanchen and a balanced review from Copilot October 9, 2026 14:58

This comment was marked as spam.

@mohanchen mohanchen added Refactor Refactor ABACUS codes Input&Output Suitable for coders without knowing too many DFT details labels Oct 10, 2026
@mohanchen
mohanchen merged commit 2b1f41e into deepmodeling:develop Oct 10, 2026
17 checks passed
@AsTonyshment
AsTonyshment deleted the fix/dipole_cartesian branch October 10, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Input&Output Suitable for coders without knowing too many DFT details Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants