Repository navigation
Conversation
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Reviewed statically at 5477d6c4b16b22604fe33ff7902356fcf02c6cf4: the local phase sign, units and conversion-before-history/source-time logic are consistent with the inspected conventions. No confirmed new implementation defect; the two comments are non-blocking. Pinned governance, whitespace and a static merge check against 27bbd6cfa6ec40ef4c5699b0c46f2e7412b840b7 passed; build/runtime validation was not run and CI diagnostics were unavailable. This review does not establish restart-replay, atom-wrap or complete finite-field cell-stress support.
AsTonyshment
left a comment
There was a problem hiding this comment.
I'll review your PR when you tell me you're ready :) no need to reply to this one
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Static incremental review found a two-spin storage defect and a non-blocking documentation follow-up below. No builds or runtime checks were run; the reported numerical/reference results were not independently verified.
|
Oh, and don't forget to update branch and resolve inline comments (if the issue pointed out in the comment has been resolved, or if you believe that over engineering and does not want to solve it) so that I will know that the PR is ready. |
|
@AsTonyshment Updated the branch with develop and resolved your three inline comments. |
AsTonyshment
left a comment
There was a problem hiding this comment.
LGTM, @mohanchen please have a look
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Static incremental review of 7c4b5c76; no builds or tests were run.
Non-blocking: Please add or link the exact build, CTest, ASan and MPI commands, plus the tested commit or executable identity, for the spin-storage results.
|
Updated the branch. The generic LCAO solver no longer accesses TD_info for this EXX update; the field is obtained within the EXX interface. I also cleaned up the formatting. |
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Static incremental review of 3031383c; no new correctness defect found in the inspected changes. No build or runtime tests were run.
What's changed?
In LCAO RT-TDDFT using hybrid gauge (
td_stype=2), RI exact-exchange integrals are evaluated in the ordinary NAO basis, so the input density matrix must be expressed in the same representation.This PR converts each source density before RI contraction and history mixing:
Here$D^0$ is the ordinary-NAO density matrix, and $\mathbf A_{\mathrm{source}}$ is the vector potential at the density's source time. $\mathbf R$ is the actual Cartesian translation including the lattice scale
lat0, and the vector potential uses the code's Hartree atomic units.For a later electronic time step, the first iteration uses the left-endpoint density and vector potential; subsequent iterations and post-convergence EXX updates use the right endpoint. Resetting the mixer within a time step does not change the density's source time.
Each density is converted before entering the ordinary-NAO mixing history. The conversion leaves the cached original density unchanged.
Periodic-image phase correction
On a finite k-point mesh, RI must preserve the phase relating different periodic density images.
Write the actual translation as
where$\bar{\mathbf R}$ is the stored representative, $\mathbf B$ is a translation of the physical Born–von Karman supercell, and $\mathbf k_0$ is the origin of the regular k-point mesh. The input and image phases are combined in one multiplication:
The code expands the required actual images before they enter the mixing history. It sets the internal RI index period from the retained C/V integral supports to prevent these images from aliasing during contraction. Actual output translations are restored before EXX is assembled into HR, preserving contributions already written by other operators.
For
nspin=2,HamiltLCAOsynchronizes its two-spin storage after operator assembly grows HR. Both spin channels are remapped by atom pair and translation, preserving the active channel's newly assembled values and the inactive channel's existing values before spin switching.The physical k mesh, LibRI dependency and final output-phase formula are unchanged. Image expansion can increase memory use and computational cost.
Scope and compatibility
spencer,revised_spencer,limits) use the same input-phase conversion, image expansion and history-mixing treatment.massidda,carrier) retain their existing image treatment and are outside this extension.kpar=1. Stress calculations on this path are not yet supported.module_ri; ESolver only passes the required field state. Ordinary SCF and other gauges retain their existing mixing and image treatment.Unit Tests and/or Case Tests for my changes
Build and unit tests
The full CPU/MPI/LCAO/LibRI/Libxc executable builds successfully. All four focused CTest targets pass, comprising 38 GTests. The 14-test HContainer suite also passes with AddressSanitizer instrumentation of the container, atom-pair, matrix and test sources.
Coverage includes phase sign and units, source-time selection, plain/Pulay/Broyden mixing and resets, preservation of the original density, comparison against independent Fourier sums on Gamma-centered and shifted meshes, and configuration checks for enabling direct-kernel paths while leaving Ewald paths unchanged.
PBE0 integration test
The Si Gamma-centered
2x1x1case now uses references that include both input and periodic-image phase corrections.The preceding image-disabled version passes the original references. With the unified image correction enabled, the updated references pass with both 1 and 4 MPI ranks at unchanged tolerances. The image correction changes the final total energy of this case by approximately +0.01450 eV.
MoS2 physical case
A separate validation build with the input-phase correction completed 14 fs of fixed-ion MoS2 HSE/hybrid-gauge propagation under an applied electric field. All electronic steps converged, and the results were qualitatively consistent with expectations.
In a matched 14–15 fs continuation using isolated validation builds, the image-on/off difference was approximately 2.83 ppm in longitudinal-current relative L2 norm and at most$3.08\times10^{-11}\ \mathrm{C/m^2}$ in continuous polarization.
Spin-storage regression
The new
rt_tddft_hse_spin2integration case exercises HR image growth and spin switching through the production HSE/hybrid-gauge path. It passes with 1 and 4 MPI ranks at the standard tolerances. A two-rank control with the preceding build aborts with heap corruption; the corrected build completes the same input.Real and complex unit tests cover growth starting from either spin, remapping blocks whose offsets change, repeated growth and switching back to the previously assembled spin. Short
nspin=4tests with zero and tilted initial magnetization (noncollinear, without SOC) complete before and after this fix with identical printed currents and final energies.Supplementary tests
Short HSE, HF/Spencer and PBE0/revised-Spencer/limits runs completed. Fresh-process HSE/PBE0 restart tests reproduced the existing initialization defect reported separately in #8280.
Follow-up
Linked Issue
Related restart initialization defect: #8280, tracked separately.
Governance Notes
No INPUT syntax or default values are changed. The
exx_real_numberdescription documents the complex-RI requirement for hybrid-gauge exact exchange.New helper logic remains in RI; ESolver does not implement the low-level calculations. The PR's total number of global-configuration references does not increase. Whitespace and governance checks have no blocking findings, and no governance exception is requested.