Skip to content

fix(input): reject mem_saver resets in SCF and relaxation - #8186

Open
Stardust0831 wants to merge 1 commit into
deepmodeling:developfrom
Stardust0831:fix/input-mem-saver-validation
Open

Stardust0831 wants to merge 1 commit into
deepmodeling:developfrom
Stardust0831:fix/input-mem-saver-validation

Conversation

@Stardust0831

@Stardust0831 Stardust0831 commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Replace silent correction of an invalid, explicitly specified INPUT parameter with a clear input error. mem_saver=1 currently becomes 0 for SCF and relaxation and execution continues; other integers are accepted despite the documented 0/1 choices. This PR rejects these inputs, reporting the supplied value, the legal value or corrective action, and the parameter manual link.

#7719 tracks INPUT finalization that silently changes user-specified parameters and can make an explicit value behave differently from the equivalent default. Its central requirement is to preserve valid explicit input and replace silent correction of invalid or contradictory input with a clear error: name the offending parameters and values, explain the conflict, and provide legal values/corrective guidance and the relevant manual link. Intentional defaults for omitted parameters remain useful; they must not overwrite the user's explicit choices.

Linked Issue

Part of #7719. Independent of the other reset-cleanup PRs.

Unit Tests and/or Case Tests for my changes

Commands run with the GNU 13.4 conda toolchain on PATH, LD_LIBRARY_PATH=/home/stardust/miniconda3/envs/phono3py/lib, and OMP_NUM_THREADS=1:

cmake --build /tmp/abacus-7719-small-pr-build --target MODULE_IO_read_item_serial MODULE_IO_availability abacus_pw_omp -j8
ctest --test-dir /tmp/abacus-7719-small-pr-build --output-on-failure -R '^MODULE_IO_(read_item_serial|availability)$'
/tmp/abacus-7719-small-pr-build/abacus_pw_omp --version
/tmp/abacus-7719-small-pr-build/abacus_pw_omp -h mem_saver
/tmp/abacus-7719-small-pr-build/abacus_pw_omp --check-input
/tmp/abacus-7719-small-pr-build/abacus_pw_omp --generate-parameters-yaml > /tmp/abacus-7719-mem-saver-parameters.yaml
python3 docs/generate_input_main.py /tmp/abacus-7719-mem-saver-parameters.yaml --output /tmp/abacus-7719-mem-saver-input-main.md --verbose

Build and both CTest targets passed. Full-reader regressions cover eight invalid value/mode combinations, verify corrective diagnostics and the manual link, and cover default/zero values and PW/LCAO NSCF acceptance.

--check-input was run in eight case directories: SCF/relax with 1 and out-of-range -1/2 exit 1; default, explicit 0, PW NSCF 1, and LCAO NSCF 1 exit 0. Version reports v3.11.0-beta11; help and generated documentation contain the updated guidance (579 parameters, 37 categories). Validation uses a CPU/OpenMP build with MPI/LCAO backends disabled; MPI/GPU, numerical LCAO, and Wannier90 workflows were not run.

What's changed?

  • Replace the mem_saver reset hook with a const validation hook.
  • Require integer values 0 or 1; reject 1 for calculation=scf/relax and recommend 0.
  • Update registration metadata and reader tests. This PR follows the existing reset conditions; other mode/basis applicability is left for a separate review. In particular, to_w90_lcao_pw.cpp also consumes this option, so this change does not impose a new blanket LCAO rejection.

Governance Notes

  • INPUT/docs changes: mem_saver value and combination validation, diagnostics, and metadata updated. No documentation update required outside the Input_Item registration; generated YAML/Markdown are build artifacts.
  • Core module impact: shared INPUT validation only; no wavefunction storage, Wannier90, or numerical solver changes. No new global dependencies.
  • Verification: git diff --cached --check and python3 tools/03_code_analysis/agent_governance_check.py --staged --event-path /mnt/g/work/agent/abacus/issue-7719-pr-notes/mem-saver-event.json --format text passed. Whole-file quality scores remain 0/0 (baseline 0/0); the existing large implementation/test files remain below 60, and these additions increase their length.
  • Exceptions requested: none.

@Stardust0831 Stardust0831 added the Input&Output Suitable for coders without knowing too many DFT details label Oct 20, 2026
@Stardust0831
Stardust0831 marked this pull request as ready for review October 20, 2026 13:26

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

Input&Output Suitable for coders without knowing too many DFT details

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant