Skip to content

Feature: backport SOC magnetic symmetry and extend LibRPA exports - #4

Merged
AroundPeking merged 17 commits into
AroundPeking:master_ghjfrom
bhjia-phys:codex/librpa-msg-interface-20260921
Sep 24, 2026
Merged

AroundPeking merged 17 commits into
AroundPeking:master_ghjfrom
bhjia-phys:codex/librpa-msg-interface-20260921

Conversation

@bhjia-phys

@bhjia-phys bhjia-phys commented Sep 20, 2026 •

Copy link
Copy Markdown

Enable the master_ghj RI/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_out also 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_ghj at 584c4cfedf92. 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 upstream develop.

On top of those dependencies:

  • Export magnetic operation tables and spin_symmetry metadata for the compatible LibRPA spinor reader.
  • Add optional raw active-ABF overlap output and an offline matrix analyzer, with input validation and tests.
  • Conjugate scalar-ABF tensors under antiunitary restoration, and retain the production checks rejecting malformed tensor shapes and duplicate restored keys.
  • Set all band_out numeric precision before writing the first occupation/Fermi energy.
  • Preserve this branch's existing high-angular-momentum Wigner correction, grey-group rotation caching, scalar coefficient/density phase convention and short/long split-Ewald exchange. The SOC caller restores and accumulates each Coulomb channel separately.

Two small pre-existing build defects were isolated against the target and corrected separately: Flag_Finish::Cs must be C for 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.

Check Result
Target baseline release build, with the two build-only fixes above Pass
Baseline focused CTest targets 7/7 primary targets (30 cases), plus 4/4 cell/API targets (90 cases)
Baseline native SOC reference cases 3/3 cases, 13 properties
Candidate release build and primary CTest targets 13/13 targets, 70 C++ cases
Candidate cell/API targets 4/4 targets, 90 C++ cases
Python ABF analyzer 12/12 tests
Candidate native integration 6/6 cases, 34 compared properties
Native Bi producer-to-LibRPA checks Pass: both exports, ABF analyzers and EXX reader runs; common-density PBE max difference 3.91694e-9 eV across 2700 star-state pairs
Native FePt producer-to-LibRPA checks Both exports, ABF analyzers and EXX readers pass on the 1 MPI × 48 thread retry; PBE energy max 1.05950e-9 eV across 5184 star-state pairs; strict occupation postcheck fails as detailed below
SOC split-Ewald operational probe Pass; both short/long channels active, deliberately loose SCF, no physical convergence claim

Native cases are scf_angle_spin4, scf_out_dos_spin4, scf_u_spin4, scf_out_elf, scf_out_hsr_spin4, and 15_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_spin4 carries upstream's original 1e-5 eV 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 0bd33e37e build. 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_required pending 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-12 versus 1e-12. The separately solved Fermi levels differ by 2.69651e-12 eV. Recomputing the executed Gaussian occupations explains the observed differences within 3.25e-14; at one common Fermi level the maximum difference becomes 2.06e-13. This is a diagnostic, not altered producer output or a relaxed gate. The unchanged Occupy::efermig electron-count convergence tolerance is 1e-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.

maki49 and others added 17 commits September 21, 2026 02:27
…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.
@AroundPeking
AroundPeking merged commit 40ec201 into AroundPeking:master_ghj Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants