Skip to content

fix(vasp): recover NWRITE = 2 symmetry on 2D meshes, conjugate subgroups and SYMPREC (#83) - #94

Merged
lllangWV merged 3 commits into
mainfrom
t3/resolve-important-issue-1
Oct 28, 2026
Merged

lllangWV merged 3 commits into
mainfrom
t3/resolve-important-issue-1

Conversation

@lllangWV

Copy link
Copy Markdown
Owner
film.mp4

Why

VASP's default NWRITE = 2 prints no operator table. pyprocar then recovers the operations by fitting subgroups of the crystal's point group to what the OUTCAR states. In three cases the fit found no single answer and raised "rerun VASP with NWRITE = 3". The non-collinear fermi2D path from user report #23 hit this with default settings. Closes #83.

What changed

  • The orbit test now follows VASP's IBZKPT (mkpoints.F in the VASP 6.5.0 source). An operation that does not keep the mesh's lattice still pairs the mesh points it maps onto the mesh. VASP's own S_6 table failed the old test on the 61x61x1 fixture.
  • When several conjugate subgroups fit, pyprocar keeps the one whose operations keep VASP's initial moments. The moments are MAGMOM from the INCAR echo, or VASP's default, turned from the SAXIS frame. spglib's get_magnetic_symmetry finds those operations.
  • spglib runs at the SYMPREC from the INCAR echo, not always 1e-5.

How it works

flowchart TD
  A[OUTCAR without operator table] --> B[spglib crystal operations at the INCAR SYMPREC]
  B --> C[subgroups with VASP's point group and operation count]
  C --> D{orbits cut to VASP's test points match the irreducible k-points?}
  D -->|exactly one fits| F[those operations]
  D -->|several fit| E[keep the subgroup whose operations keep the initial moments]
  E -->|exactly one left| F
  E -->|none or several| G[raise: rerun with NWRITE = 3 or ISYM = -1]
  D -->|none fits| G
Loading

Scope

  • Covers non-collinear and collinear runs whose OUTCAR echoes the INCAR (VASP 6).
  • VASP 5 OUTCARs echo no INCAR tags. There, MAGMOM is unknown, so a tie still raises. A test pins this.

Tradeoffs

  • The moments break ties only. They do not filter a unique fit. The point group, count and k-points are what VASP printed. The INCAR echo is what the user wrote, so it is the weaker evidence.
  • The test resources are 5 gzipped OUTCAR headers from real VASP runs (40 KB). They let CI check against VASP's own tables without data/.

Blast Radius

The change reaches Outcar.rotations, which VaspParser.ebs uses to unfold symmetry-reduced meshes (fermi2D, fermi3D, mesh band structures). A wrong tie-break would unfold a mesh with the wrong group without notice. It can only choose among subgroups that already fit every stated fact. VASP's group is the set of crystal operations that keep the moments, so a correct MAGMOM leaves exactly that group.

Verification

  • VASP's printed tables are recovered. I ran 9 VASP 6.5.0 spin-orbit runs with NWRITE = 3. Each varies MAGMOM, SAXIS or SYMPREC (CsCl-type and zinc-blende InP). I stripped each table and compared the recovery with the printed one. Head 22e8cae recovers 10 of 10 tables, the 9 runs and the 61x61x1 fixture. Main recovers 4 of 10.

    Case VASP group main PR
    default MAGMOM, 6x6x1 S_6 raises S_6
    MAGMOM along x C_4h raises C_4h
    SAXIS = x, MAGMOM along z C_4h raises C_4h
    SAXIS = 110, MAGMOM along z C_2h raises C_2h
    SYMPREC = 1e-3, P moved 1.7e-4 Å T_d raises T_d
    fixture fermi2d/non-colinear, 61x61x1 S_6 raises S_6
    4 cases with a unique fit S_2, S_2, S_2, O_h same same

    Each fix carries a case. The orbit rule takes default MAGMOM from 0 fits to 4. The moments take 4 or 2 fits down to VASP's one. Reading SYMPREC takes the T_d case from 0 fits to 1.

  • fermi2D works on default VASP output. I ran pyprocar.fermi2D(code="vasp", mode="plain") and mode="spin_texture" on a copy of fermi2d/non-colinear with the table stripped. On main, both raise. On head, both draw. The PNGs are byte-identical to the ones made with the printed table.

    main (before) and PR (after): fermi2D on the non-collinear SrVO3 fixture with the operator table stripped

  • Gates. These passed on head:

    • ruff_new_violations.py check and format, and ruff --select F821,F822,F823,NPY201.
    • ty_baseline.py with ty 0.0.92: 0 new, 0 stale.
    • pytest -m "not data": 3580 passed. The 7 test_ty_baseline.py tests failed only because the shared env has no ty. With ty 0.0.92 on PATH they pass.
    • pytest -m data: 484 passed.
    • red_green.py origin/main: ok. The new tests fail on main. The one guard test is marked.

Not verified

  • The collinear ISPIN = 2 tie-break. No VASP run here produced a collinear tie. It uses the same spglib call, with is_axial=False.
  • The SAXIS turn on frames other than x, 110, 111 and -110. Only the x and 110 cases needed it to break a tie.

Created with Claude Opus 5.5 in T3 Code, with Claude Opus 5.5 review subagents.

lllangWV and others added 3 commits October 28, 2026 13:28
…ups and SYMPREC (#83)

An OUTCAR without an operator table now yields VASP's operations in three
states where pyprocar raised the NWRITE = 3 / ISYM = -1 error:

- Orbits follow VASP's IBZKPT (mkpoints.F): test points are the mesh, plus
  their images under the lattice's operations only when all of those keep
  the mesh's lattice, and an orbit counts the images that are test points.
  VASP's own S_6 table failed the old rule on a 61x61x1 mesh.
- When conjugate subgroups all fit, the initial magnetic moments (MAGMOM,
  VASP's default, turned from the SAXIS frame) pick VASP's group.
- spglib runs at the SYMPREC the INCAR echo sets.

Tested against the operator tables of 9 VASP 6.5.0 runs and 2 fixtures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lllangWV
lllangWV merged commit 26fd30d into main Oct 28, 2026
5 checks passed
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.

VASP NWRITE = 2 symmetry recovery: break ties between conjugate subgroups, and read SYMPREC

1 participant