Skip to content

Upload simplified hybrid gauge rt-tddft#7429

Open
ESROAMER wants to merge 9 commits into
deepmodeling:developfrom
ESROAMER:develop
Open

Upload simplified hybrid gauge rt-tddft#7429
ESROAMER wants to merge 9 commits into
deepmodeling:developfrom
ESROAMER:develop

Conversation

@ESROAMER
Copy link
Copy Markdown
Collaborator

@ESROAMER ESROAMER commented Jun 4, 2026

What's changed?

1.Simplified the formulas and implementation for the hybrid gauge.
2.Replaced some functions for current calculation with the new density matrix tool.
3.class TD_info no longer depends on or stores the ucell pointer.

Copy link
Copy Markdown
Collaborator

@AsTonyshment AsTonyshment left a comment

Choose a reason for hiding this comment

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

LGTM! Just have a few minor questions I am curious about.

double sinp = 0.0, cosp = 0.0;
ModuleBase::libm::sincos(arg, &sinp, &cosp);
std::complex<double> kphase = std::complex<double>(cosp, sinp);
kphase *= phase_hybrid.at(r_index);
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.

Passing and accessing std::map phase_hybrid using .at(r_index) inside the loops in folding_HR_td and cal_DMR_td introduces an $\sim O(\log N)$ overhead and breaks memory contiguity. This will somehow impact CPU cache performance. Is the performance of this implementation tested? BTW, is it possible to flatten this into a 1D std::vector indexed by ir to ensure $O(1)$ contiguous access?

{
hr_mat_p[ipol * step_trace] += tmp_r * Et;
hr_mat_p[ipol * step_trace] -= ((dtau + tau1) * Et) * sr_p[ipol * step_trace] * this->ucell->lat0;
hr_mat_p[ipol * step_trace] -= (dR * Et) * sr_p[ipol * step_trace] * this->ucell->lat0;
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.

I found that (dtau + tau1) was simplified to dR. Is this identical?

@mohanchen mohanchen added the Refactor Refactor ABACUS codes label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants