Repository navigation
Fix RT-TDDFT MD fractional wrapping to [0, 1) and restore MD_dump atom ordering - #8207
Conversation
Gather frame text through CommunicationDomain and write rows by the stable type-major index. Emit frame separators once, including when some MPI ranks own no atoms. Add serial-launch and four-rank tests for reversed ownership, an empty rank, empty frames, and append mode. No documentation update needed: this restores trajectory ordering without changing INPUT parameters, units, or columns.
Use two synthetic atoms and Gamma plus a non-Gamma point. Exercise the real MD update and backing-cell sync for sub-roundoff negative motion, and check H/S/coefficient phase covariance for all axes, both crossing directions, both atoms, and clearing a previous shift. Verify the test fails when the coordinate fix is reverted or the Bloch phase sign is reversed. Restore both mutations and pass six related CTest targets, including the new single- and four-rank RT tests. No documentation update required: tests only.
…del" This reverts commit 62cf361.
Add INPUT, STRU and KPT for two H atoms on a periodic face with one non-Gamma k point and a supplied sub-roundoff transverse velocity. Register the case in CASES_CPU.txt and check post-initial SCF iterations and convergence through an opt-in md_scf.ref collector. Original beta11 fails Autotest.sh with both one and four MPI ranks: step 2 reaches scf_nmax=8 without convergence. The fixed binary and beta11 with only the coordinate patch pass with one step-2 iteration. Existing 16_NO_vel_TDDFT and the four focused MD CTest targets also pass. Document the trigger and commands in the case README.
Raise scf_nmax to 100, remove the opt-in SCF collector and its reference file, and keep the case README to its single purpose sentence. With one and four MPI ranks, the fixed case passes in one second-step iteration. Original beta11 takes ten iterations but reaches an energy about 79 eV away from the reference, so the existing Autotest.sh energy comparison fails without a custom validator or timeout.
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Static review of d2f1f5fb00c8 completed with independent verification. Two conditional P2 issues and one nonblocking naming note are below. No builds or runtime tests were run; the H2 energy/trigger and reported beta11 comparison remain unverified, and CI diagnostics were unavailable.
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Static follow-up of d4028da3410d with independent verification found the three prior issues addressed. No new product defect is confirmed; the remaining notes are nonblocking.
Non-blocking: please update the integration command to ^10_NO_MD_boundary_shift$ and state which revision the reported results cover. The old ^29_NO_MD_boundary_shift$ filter now selects no cases, and Autotest can report a zero-case pass, so the documented command does not exercise this revision. (8207-A3)
No builds or runtime tests were run. The H2 reference, actual boundary trigger, beta11 comparison, MPI/serial/GPU execution and CI remain unverified.
Critsium-xy
left a comment
There was a problem hiding this comment.
The title overstates the fix. This PR keeps wrapped fractional coordinates in [0, 1), which removes the spurious boundary crossing. It does not restore reset_matrix_boundary itself:
reset_matrix_boundaryapplies phases only whenboundary_shiftis nonzero (source_lcao/module_rt/boundary_fix.cpp:23).boundary_shiftis written only inunitcell::periodic_boundary_adjustment(source_cell/update_cell.cpp:490-503). The new MD path no longer calls it, andMDCell::sync_backing_unitcell()does not fill it.
So a genuine boundary crossing in LCAO RT-TDDFT MD (finite displacement, non-Gamma k) still gets no phase correction. The new case 10 does not cross a boundary after the fix, so it does not cover this. The gap predates this PR, so a fix is not required here. Please retitle the PR, e.g. "Fix MD fractional wrapping to [0, 1) and restore MD_dump atom ordering", and track the boundary_shift gap in a follow-up issue.
|
Thanks for catching this! I've updated the title. I'll open a separate issue for the |
|
Thanks for the careful investigation and for preparing this fix. The wrapping and MD_dump regressions are well isolated. For the planned follow-up on genuine boundary crossings, it may also be worth handling the ionic-position update state explicitly. Currently, One possible implementation is to add a per-atom backing_unitcell_->ionic_position_updated = true;
The wrapping logic should preserve the old two-step behavior: handle values below zero first, then handle values greater than or equal to one. This is important for the tiny-negative-displacement case, where adding one may round to exactly 1.0; the second check should canonicalize it back to 0.0 without recording a spurious boundary shift.
It would be useful to add focused tests for:
- a tiny negative displacement, producing coordinate 0.0 and zero boundary shift;
- genuine positive and negative boundary crossings, producing the expected wrapped coordinate and shift;
- synchronization of both boundary_shift and ionic_position_updated from MDCell to the backing UnitCell. |
|
Thanks for the suggestions! We'll incorporate them into the follow-up PR for #8221, including the position-update flag and the proposed tests. |

Linked Issue
Fixes #8206.
What's changed?
[0, 1).MD_dump, using bounded collective batches for large frames.Unit Tests and/or Case Tests for my changes
CPU build passed at
04a1ba3a26f3; MD tests were rebuilt and passed ate3714fdad546after moving MPI tests to the standardunittests/directory, with unchanged test lists. The merged RT case was verified atd4028da3410dusing the same executable.ctest --test-dir build-fix --output-on-failure \ -R '^MODULE_MD_(func|verlet|dump_mpi(_np4)?)$'From
tests/05_rtTDDFT, using the fixed executable:The merged case passes with both 1 and 4 MPI ranks, requiring one electronic iteration at the second step. Unmodified beta11 still fails the existing energy comparison by approximately 79 eV.
20_NO_MIXED_EFIELD_TDDFTalso passes with 4 MPI ranks.MD tests cover one-row and small-byte batches, aggregate overflow with individually fitting rank payloads, empty ranks, and appended frames. The 4-rank CTest also passes with nonempty
MPIEXEC_PREFLAGSandMPIEXEC_POSTFLAGS;16_NO_vel_TDDFTpasses with 4 MPI ranks.No documentation update required: no INPUT parameters or output fields change.
The include is required by the new CommunicationDomain API.