Skip to content

test(dfpt): test for DFPT phonon frequency output - #8308

Open
Zanthoxylum wants to merge 19 commits into
deepmodeling:developfrom
Zanthoxylum:test-dfpt-integration
Open

Zanthoxylum wants to merge 19 commits into
deepmodeling:developfrom
Zanthoxylum:test-dfpt-integration

Conversation

@Zanthoxylum

@Zanthoxylum Zanthoxylum commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Add the first PW-DFPT integration test (smoke test) and the
props_dfpt.sh property collector that brings phonon frequencies
into the standard result.ref comparison.

Test case dfpt_si_g: 2-atom Si, Gamma-only k-mesh, Gamma-only q,
8/32 Ry, nbands 4, no E-field — runs in ~4 seconds following the
suite's conventions (1-2 atoms, Gamma k, sub-second per case).

props_dfpt.sh: parses the per-q DFPT phonon frequencies blocks
from the test log, emitting dfpt_freq_q<i>_m<j> / dfpt_loto_q<i>_m<j>
key-value lines. Guarded by esolver_type == dfpt (case-insensitive),
with completeness checks (dense mode indices, cross-reference against
result.ref, nonnumeric token rejection). Autotest.sh applies a
dedicated 1e-4 threshold to the frequency keys while keeping the 1e-7
default for etot.

Autotest.sh: cases with esolver_type dfpt run with a single
MPI rank (the DFPT esolver is currently a serial implementation; MPI
domain decomposition is planned future work).

Verification

  • Runtime: ~4.3s per run (maintainer budget: ≤5s per case)
  • Deterministic: two identical runs produce bit-identical frequencies
  • End-to-end: catch_properties.sh → result.ref → regenerated
    result.out → 8/8 keys identical
  • Syntax: bash -n clean on all modified shell scripts

The full precision validation (20/80 Ry, 4×4×4 k, Γ+X q, E-field,
LO-TO) is maintained in a separate external campaign, not in CI.

Add the first PW-DFPT integration test and the props_dfpt.sh collector
that brings phonon frequencies into the result.ref comparison:

- props_dfpt.sh parses the per-q 'DFPT phonon frequencies' and the
  Gamma 'DFPT LO-TO corrected frequencies' blocks from the test log,
  emitting dfpt_freq_q<i>_m<j> / dfpt_loto_q<i>_m<j> keys; the mode
  index keeps its zero-based printing so keys stay stable across cell
  sizes. Guarded by esolver_type == dfpt so non-DFPT cases are
  untouched.
- catch_properties.sh sources the module and calls run_dfpt_props
  after run_basic_props (the documented extension point).
- 110_PW_DFPT_Si_X: 2-atom Si, ecutwfc 20 / ecutrho 80, fixed
  occupations, Gamma-centered 4x4x4, X-point q (0, 0.5, 0.5); the
  reference pins etot and the six X-point frequencies (133.44x2,
  407.6x2, 459.8x2 cm^-1 at CHECKACCURACY=2).

Verified end-to-end: fresh run, result.ref generated through
catch_properties.sh, regenerated result.out compared key-by-key at the
CHECKACCURACY=2 rounding (8/8 keys identical).
@Zanthoxylum Zanthoxylum added Tests/Examples Issues/PR related to unit tests and integrate tests DFPT Density Functional Perturbation Theory labels Nov 11, 2026

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two gaps currently weaken the new DFPT regression test: the normal suite does not select the case, and missing phonon output can pass comparison. The inline comments identify both and two nonblocking reproducibility details.

Static source/configuration review at 7e4a3d31e9e00b1d415092b178135a78ae684b00; whitespace, governance and shell syntax checks passed. No ABACUS/runtime or numerical checks were run, and CI diagnostics were unavailable.

Comment thread tests/01_PW/110_PW_DFPT_Si_X/README Resolved
Comment thread tests/01_PW/dfpt_si_x/result.ref Resolved
Comment thread tests/01_PW/110_PW_DFPT_Si_X/README Resolved
…x README

Review follow-up on all four comments:

- CASES_CPU.txt: register 110_PW_DFPT_Si_X so the normal CTest suite
  actually selects the case (the reference was never checked before).
- props_dfpt.sh: fail the collection (return 1) when a DFPT log contains
  no dfpt_freq_ key at all (truncated log, crashed solver, format
  drift); catch_properties.sh propagates the failure with exit 1, so
  the case can no longer pass on etot alone. The develop sync had also
  dropped the props_dfpt wiring from catch_properties.sh, making the
  collector a silent no-op; re-wired together with the propagation.
- README: fix the lattice constant (2 * 2.715 * 1.8897261255 = 10.2612
  Bohr = 5.4300 Angstrom, was misstated as 10.2) and name the pseudo
  file; document the intended tolerance: a per-case threshold file
  (1e-4) covers the cm^-1 keys — same-binary reruns reproduce the six
  printed decimals exactly, so the margin only absorbs last-digit
  rounding across toolchains (the Autotest.sh default 1e-7 would demand
  bit-identical output for ~500 cm^-1 values).

Verified: fresh Si_qmid log collects 12 keys (rc=0), an emptied log
fails with rc=1 through catch_properties.sh, bash -n clean.
…ly serial

The CI Test job runs Autotest.sh with -n 4; the DFPT esolver is currently a serial implementation (MPI domain decomposition is planned future work), so multiple ranks crash in the response-solve FFT gather-scatter (MPI_Alltoallv with rank-inconsistent stick maps, reproduced locally at -n 2 and -n 4). Mirror the of_ml_gene_data special case: cases with esolver_type dfpt run with a single MPI rank. README documents the limitation and the future plan.

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new launcher handles the checked-in case, but valid uppercase INPUT keywords bypass its one-rank restriction. The partial-spectrum issue remains in its existing thread.

Static source review at fdc78aadff4840906bad66864174c73ee07400ac; whitespace, governance and shell syntax checks passed. No ABACUS runtime or numerical checks were run; CI diagnostics were unavailable.

Comment thread tests/integrate/Autotest.sh Resolved
Comment thread tests/integrate/Autotest.sh Resolved
…case-insensitive match

1. Key-scoped threshold (1e-4 only for dfpt_* keys, etot keeps 1e-7)
2. Complete-spectrum guard (dense 0..N mode indices + cross-ref vs result.ref)
3. Case-insensitive esolver_type match (-qi)
4. README: per-key threshold + serial note + LibXC build provenance
5. Remove case-wide threshold file

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two collector gaps remain: initial/direct reference generation can accept partial spectra, and valid uppercase INPUT keywords can skip phonon comparison. A nonblocking inline suggestion covers malformed frequency values.

Static source review at f4fd288d32f1db5dbd0ff22cfb1888824a2ee657; whitespace, governance and three shell syntax checks passed. No ABACUS runtime or numerical checks were run; CI diagnostics were unavailable.

Comment thread tests/01_PW/CASES_CPU.txt Resolved
Comment thread tests/01_PW/110_PW_DFPT_Si_X/README Resolved
…okup, numeric guard

- Rename 110_PW_DFPT_Si_X to dfpt_x (maintainer: follow naming convention)
- Shorten README to 2 lines (maintainer request)
- props_common.sh: case-insensitive get_input_key_value (ESOLVER_TYPE DFPT no longer silently skips collection)
- props_dfpt.sh: reject nonnumeric frequency tokens

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The keyword lookup and malformed-frequency rejection are source-fixed at 39ba0c1; the separate first-reference completeness gap remains open in its existing discussion. The new feedback concerns diagnostic text, reference-build metadata and guidance for running the case individually.

Static source review of 39ba0c1 against 48e2494; exact-revision whitespace and LF checks passed. No collector or ABACUS runtime checks ran, and CI diagnostics were unavailable.

Comment thread tests/integrate/Autotest.sh Resolved
Maintainer feedback: 24 min is 288x over CI budget.
Reduce to Gamma-only k, Gamma-only q, 8/32 Ry, nbands 4, no E-field. Runtime ~4.3s.
@Zanthoxylum Zanthoxylum changed the title test(dfpt): integrate test 110_PW_DFPT_Si_X with frequency parsing test(dfpt): smoke test for DFPT phonon frequency output Nov 13, 2026

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new atom counter can reject valid mixed-species DFPT spectra, and first-time reference generation still accepts incomplete spectra. Both need collector corrections.

Static source review of c33ee19 against 173620a; exact-revision whitespace and LF checks passed. No collector or ABACUS runtime checks ran, and CI diagnostics were unavailable.

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The per-block checks fix the previously reported mode-0, empty-block and short LO-TO cases for a valid atom count. Two remaining atom-count cases are detailed in the existing thread.

Static review of 34bb3982 against 173620a1; exact-revision whitespace and LF checks passed. No collector or ABACUS runtime checks ran; CI diagnostics were unavailable.

@Zanthoxylum Zanthoxylum changed the title test(dfpt): smoke test for DFPT phonon frequency output test(dfpt): test for DFPT phonon frequency output Nov 14, 2026

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two reported atom-counter examples are source-corrected, and frequency-guard tests are now registered. Valid STRU whitespace still leaves a completeness gap, detailed in the existing thread.

Static source review at 069ef527 against 173620a1. No collector tests, ABACUS runs or builds were executed; CI diagnostics were unavailable.

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 069ef527 → 240ead3: the new STRU fixtures and zero-count guard address the earlier examples, but the remaining atom-count cases are detailed in the existing F4 thread. Static source review only; governance and git diff --check passed, while tests, builds and CI were not run.

This branch has not been deployed

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

Labels

DFPT Density Functional Perturbation Theory Tests/Examples Issues/PR related to unit tests and integrate tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants