Feature: backport SOC magnetic symmetry and extend LibRPA exports - #4
Merged
AroundPeking merged 17 commits intoSep 24, 2026
Conversation
…modeling#7692) * SOC symmetry: magmom filter, charge&DM symmetrization * Hexx(R) rotation * Feat: magnetic (Shubnikov) group * remove TRS_first_ * Fix rhog_symmetry: anti-unitary ops (used for reducing k-points) should be included * Perf: antiunitary ops are also used to reduce Hexx(R) * do not autoset magmom at symmetry=1 * Fix SOC bug: θ=π branch of so3_to_su2, and M⊗U convention * fix the phase factor: compatible with the formula * Fix: enable mixing_restart for EXX (instead of segfault) * print magnetic space group * doc and testing * refactor: parameterize symmetry in module_cell * refactor: remove default values of new parameters * fix parameter description out-of-sync * fix: if symmetry is not set, default -1 at lspinorb=1 (as before) * Fix: explicitly set mag 1 for nspin-2+symmetry test cases (was autoset to 1 before) * fix a UT format * refine the warning lines skipping autoset magmom * update results of nspin4+sym1 cases (wrong before spin-mixed charge density symmetrization is implemented) (cherry picked from commit 11d1112)
Port deepmodeling/abacus-develop PR deepmodeling#7832 (f29968d) onto the magnetic LibRPA producer baseline. Correct both density-extraction templates and the DeltaSpin driving field. Include the prerequisite deepmodeling#7748 pauli_to_moment sign correction absent from this older baseline. Preserve the existing cubic and hexagonal spin-rotation tests and LibRPA exports. Adapt the upstream physical-spinor tests to the legacy filenames; make the DeltaSpin unit test call the production measurement helper. The old baseline has no deepmodeling#7804 yflip rotation compensation to remove. Validation on dongfang: release MPI build, 84 C++ cases in 14 CTest targets, 12 ABF Python tests, and all three deepmodeling#7832 integration references passed with unchanged acceptance thresholds. Separate material comparisons are retained in workspace/symmetry/runs/20260919-abacus-msg-upstream-r1 in the GW topic. (cherry picked from commit f29968d) (cherry picked from commit 07d0470b1610eb44b7b6cb4a8009229f3b8b6e0f)
…tru_out Port the 708bbfd09 writer semantics onto the master_ghj-based merge tree. out_struc now writes, for nspin=4, the spatial parts of the full Shubnikov group (unitary block first, then the nrotk_anti antiunitary spatial parts) followed by a 'spin_symmetry <grey> 2' trailer with one antiunitary flag per operation. grey=1 for non-magnetic nspin=4 (LibRPA appends the Theta copies internally); grey=0 with explicit eta flags for magnetic nspin=4. spin_action_source=2 lets LibRPA reconstruct U_s = U[det(Q)Q] per operation. nspin=1/2 output is unchanged. Reader side: LibRPA feature/spin-space-symmetry-20260726 (6fee0835). (cherry picked from commit 0795988)
(cherry picked from commit fd911b11c723dd86b4292343bba362cc2579284c)
Retain the target grey-group matrix cache and scalar coefficient/density phase convention. Adapt the production SOC short/long exchange-channel integration from 07d0470b1610, with explicit scalar and grey-group compatibility tests.
The target branch references Flag_Finish::Cs, while its declared LibRI v0.2.1.1 dependency exposes Flag_Finish::C. Correct the member name without changing the prepared tensors or exchange route.
Preserve the production 07d0470b1610 failure behavior instead of silently skipping malformed tensor blocks or overwriting duplicate restored keys. The existing imported regressions exercise both cases.
…xtures Adapt the source corrections from upstream 698e187 (deepmodeling#7513), by dyzheng, required alongside the corrected conjugate-first density convention. Retain the current deepmodeling#7832 density conversion and reference values. Restore the upstream scf_angle_spin4 threshold file and the upstream carbon-cell STRU paired with the imported reference. These are upstream fixtures, not regenerated candidate references. The prior strict-threshold and mismatched-cell failures remain in external validation evidence.
Use the H, S, and position-matrix references accompanying the upstream 1.5-bohr cell. Convert only the H/S header and line wrapping to master_ghj CSR syntax; all numeric tokens are preserved. No candidate output is used to generate expected values.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enable the
master_ghjRI/LibRPA producer to preserve SOC magnetic-group information, with the upstream conjugate-first spin-density correction. Magnetic exports now include unitary/antiunitary operations and the spin-action trailer;band_outalso initializes precision before the first occupation and Fermi energy, avoiding a default-six-digit first row.Linked upstream work and scope
This targets
AroundPeking/abacus-develop:master_ghjat584c4cfedf92. That branch does not contain the SOC magnetic-group core, so this PR necessarily includes an adapted backport of deepmodeling/abacus-develop#7692, with the original author and source commit retained, the complementary #7513 Pauli-Hamiltonian corrections, and the applicable #7832 spin-density correction. It is not a merge of current upstreamdevelop.On top of those dependencies:
spin_symmetrymetadata for the compatible LibRPA spinor reader.band_outnumeric precision before writing the first occupation/Fermi energy.Two small pre-existing build defects were isolated against the target and corrected separately:
Flag_Finish::Csmust beCfor the declared LibRI dependency, and the existing RI I/O test needs the header defining the helper it calls. The comparison baseline includes only these two build fixes.Core-module behavior
The upstream symmetry implementation handles coupled spin-density components and magnetic operation tables. The density-matrix change corrects extraction of the physical y magnetization from the stored conjugate-first matrix. Solver call sites dispatch the three spin components together. Cell setup forwards the symmetry setting to retain explicitly zero initial moments with symmetry enabled. The corresponding local/Hubbard Pauli-to-spinor conversions, noncollinear force factors and missing ELPA context are backported from deepmodeling#7513; existing target DeltaSpin moment/operator signs are retained.
The RI layer adds the SOC rotation/restoration path while retaining the target's scalar and split-Ewald behavior. The optional overlap export is off by default. See the interface documentation for the file layout, input settings and validation boundaries.
Unit and case tests
Validation uses Intel oneAPI 2024.2, MPI, LibRI v0.2.1.1, LibXC 6.1.0 and matched dependencies on dongfang.
Native cases are
scf_angle_spin4,scf_out_dos_spin4,scf_u_spin4,scf_out_elf,scf_out_hsr_spin4, and15_KP_HSE_SOC_symm. The first five use 4 MPI ranks and one thread; so does the HSE case. In the H/S-output case, the inherited comparator checks S and position matrices, energy and symmetry metadata; H-matrix comparison remains disabled in the original driver.The initial port failed SOC DFT+U by 0.13964911 eV because the density correction was not yet paired with deepmodeling#7513's Hamiltonian fixes. The old producer passed the same input, and the complete backport now passes energy, force and stress. The carbon fixture now includes the full upstream cell and matching H/S/r references (H/S numeric tokens preserved, formatting adapted to the target's CSR format).
scf_angle_spin4carries upstream's original1e-5eV threshold file, previously absent from this target. No candidate-generated numerical reference or newly selected tolerance is used.The last commit changes only the carbon reference fixtures; the executable code is identical to the tested
0bd33e37ebuild. The five unchanged cases passed together, followed by the carbon case with the complete fixture. Native consumer runs use fresh SOC SCFs, symmetry-on/off exports at a common density, explicit first-occupation checks, spin trailers, active-ABF analysis, and a LibRPA EXX reader smoke test.Upstream GitHub workflows are currently
action_requiredpending maintainer approval (for example workflow run); the local results above do not establish upstream CI success.The FePt retry finished in 1 h 51 min 48 s without OOM. Its retained postcheck fails only the normalized occupation criterion:
5.52014e-12versus1e-12. The separately solved Fermi levels differ by2.69651e-12eV. Recomputing the executed Gaussian occupations explains the observed differences within3.25e-14; at one common Fermi level the maximum difference becomes2.06e-13. This is a diagnostic, not altered producer output or a relaxed gate. The unchangedOccupy::efermigelectron-count convergence tolerance is1e-10. The draft retains this strict-gate qualification; no new band-symmetry or reader failure is identified by this check.Remaining limits
This submission concerns the producer, symmetry components and native consumer interface. It does not claim to repair the separately observed material-dependent reduced-input RPA/GW discrepancies or establish physically converged SOC-GW bands. Native producer-to-consumer checks are additional interface tests; LibRPA's archived-input regression workflow is unchanged. GPU, Python bindings and the complete ABACUS integration suite are outside this focused validation.