Skip to content

bug(deltaspin): non-SOC LCAO spin rotation invariance breaks with genelpa #7913

Description

@Tao-Xia

Describe the bug

Non-SOC nspin 4 LCAO DeltaSpin calculations with ks_solver genelpa break global spin-rotation invariance. Two independent convention/solver defects contribute:

  1. cal_coeff_lambda constructs the DeltaSpin operator with the opposite sign in the y off-diagonal components from the pauli_to_moment convention. For a +y spinor and a positive lambda_y, the current operator gives

    <psi | H_lambda | psi> = -lambda_y M_y

    instead of +lambda_y M_y.

  2. The custom complex generalized ELPA transform uses PZGEMM on the whole Hamiltonian. LCAO supplies the authoritative upper triangle of a Hermitian matrix, so this reads stale/uninitialized lower-triangle entries. LAPACK and ScaLAPACK paths use the upper triangle and do not show this failure.

On bcc Fe without SOC, equivalent fully constrained x and y ferromagnetic states can therefore have solver failures or large spurious energy differences instead of being degenerate.

Expected behavior

  • The DeltaSpin operator must satisfy <psi | lambda dot sigma | psi> = lambda dot M for all Cartesian components under the same convention used by pauli_to_moment.
  • The complex genelpa path must use only the declared Hermitian triangle of the LCAO Hamiltonian.
  • Without SOC, globally rotated constrained magnetic states must have the same total energy within numerical convergence tolerance.

To Reproduce

  1. Build commit 439730086c76a749c162e0ee0d423184956b7481 with MPI, LCAO, LibXC, and ELPA enabled.
  2. Run an nspin 4, noncolin 1, lspinorb 0, sc_mag_switch 1, sc_direction_only 0, ks_solver genelpa LCAO calculation for the same bcc-Fe structure with the target moments globally oriented along x and then y.
  3. Alternatively, evaluate the current DeltaSpin coefficient matrix for lambda=(0,2,0) on psi=(1,i)/sqrt(2). pauli_to_moment returns M_y=+1, but the operator expectation is -2.
  4. For the solver defect, keep the upper triangle of a complex Hermitian generalized eigenproblem fixed, replace only the lower triangle of H with arbitrary values, and compare genelpa against LAPACK using UPLO='U'. The current solver changes the eigenvalues; in the added regression case the maximum error is 5.48e3 before the fix.

Environment

  • OS: Ubuntu 22.04.5 LTS
  • Compiler: GCC 11.4.0
  • MPI: OpenMPI 5.0.8
  • BLAS/LAPACK: OpenBLAS 0.3.30
  • ScaLAPACK: 2.2.2
  • ELPA: 2025.06.001, CPU/OpenMP
  • ABACUS: develop at 439730086c76a749c162e0ee0d423184956b7481

Additional Context

A candidate fix replaces the first complex generalized-transform PZGEMM with PZHEMM(..., UPLO='U') and restores the standard sigma_y=[[0,-i],[i,0]] DeltaSpin mapping. With both fixes, 12-MPI-rank bcc-Fe constrained calculations give:

  • x: -6440.443794099374 eV, total moment [4.20538, -2.03e-6, -4.36e-6] mu_B
  • y: -6440.443794117549 eV, total moment [3.90e-7, 4.20538, -4.72e-6] mu_B
  • absolute energy difference: 1.82e-8 eV

Related history: #7522, #7664, and #7832. This is not the same fixed state described in #7522: the DeltaSpin mapping was changed again by #7832, and the lower-triangle genelpa defect remains in current develop. The proposed invariant test avoids relying on a convention label alone and directly checks energy/operator consistency.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions