Skip to content

fix(input): reject invalid DFT+U lists before resizing - #40

Draft
Stardust0831 wants to merge 1 commit into
review/input-reset-base-20261107from
fix/input-vector-cardinality
Draft

Stardust0831 wants to merge 1 commit into
review/input-reset-base-20261107from
fix/input-vector-cardinality

Conversation

@Stardust0831

Copy link
Copy Markdown
Owner

Explicit orbital_corr and hubbard_u lists are currently resized before their length is checked. With ntype=1, orbital_corr 2 99 and hubbard_u 4 -7 silently become 2 and 4, hiding the invalid trailing values. Short lists are silently padded as well.

Following deepmodeling#7719 and deepmodeling#8192, this change rejects these inputs instead of rewriting them. A shared vector-size declaration requires exactly ntype complete, correctly typed values. Token validation runs before reading callbacks; length validation uses the original tokens after STRU resolves ntype, before any vector resize. Errors identify the supplied input, explain the requirement, link to the parameter manual, and reach every MPI rank.

Omitted lists retain their defaults. Complete valid lists retain their supplied values. The existing physical element-range checks are preserved. This initial use of the shared declaration covers these two literal-vector parameters; the same declaration also supplies the count requirement to CLI help and generated documentation.

Validation

$build and $mpi_build denote configured serial and MPI build directories; runtime tests use OMP_NUM_THREADS=1.

  • cmake --build "$build" --target abacus_basic_omp MODULE_IO_input_domain_reader MODULE_IO_read_item_serial MODULE_IO_input_domain MODULE_IO_availability -j 12 and ctest --test-dir "$build" -V -R '^MODULE_IO_(input_domain(_reader)?|read_item_serial|availability)$': 4 targets / 85 tests passed, covering malformed tokens, excess/missing entries, inferred ntype, valid lists and omitted defaults.
  • cmake --build "$mpi_build" --target MODULE_IO_input_error_mpi -j 12 and env OMPI_MCA_pml=ob1 OMPI_MCA_btl=self,sm ctest --test-dir "$mpi_build" -V -R '^MODULE_IO_input_error_mpi_': all 12 four-rank cases passed. Shared-memory transport avoids a host-specific MPI initialization delay; the existing timeout and all-rank shutdown assertions are unchanged.
  • abacus_basic_omp --check-input and the production reader passed 12 acceptance/rejection scenarios. abacus_basic_omp --version, abacus_basic_omp -h orbital_corr, and abacus_basic_omp -h hubbard_u passed; help remains within 80 columns.
  • python3 -m unittest discover -s docs -p test_generate_input_main.py -v: 4 tests passed. abacus_basic_omp --generate-parameters-yaml followed by python3 docs/generate_input_main.py parameters.yaml --output input-main.md generated the reference with linked vector-count requirements.
  • C++11 compilation of input_domain.cpp, python3 tools/03_code_analysis/agent_governance_check.py --staged, and git diff --cached --check passed.

INPUT and implementation notes

The two Input_Item registrations document the input requirement. YAML and Markdown are generated from this metadata and are not committed. Changes affect input validation and help generation; DFT+U numerical algorithms are unchanged. No governance exception is requested.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant