Skip to content

Support binary LCAO wavefunction input - #7863

Merged
mohanchen merged 5 commits into
deepmodeling:developfrom
goodchong:codex/lcao-binary-wfc-read
Sep 9, 2026
Merged

Support binary LCAO wavefunction input#7863
mohanchen merged 5 commits into
deepmodeling:developfrom
goodchong:codex/lcao-binary-wfc-read

Conversation

@goodchong

@goodchong goodchong commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • replace read_wfc_lcao with an explicit two-value init_wfc syntax: init_wfc file txt and init_wfc file binary
  • keep the existing init_wfc method field internally while storing the normalized file format separately, so existing PW, LCAO, TDDFT, LR, and EXX flow checks remain stable
  • retain the legacy one-value init_wfc file input for backward compatibility (LCAO defaults to text, PW defaults to binary) while canonicalizing INPUT.info to the explicit two-value form
  • read the native out_wfc_lcao 2 layout for Gamma-only and multi-k calculations, including type conversion and file/index/dimension validation
  • generate binary fixtures at test runtime with the existing writer and cover double, float, complex, skipped bands, mismatched formats, truncated input, and existing text input

Input behavior

  • LCAO accepts init_wfc file txt and init_wfc file binary.
  • PW accepts init_wfc file binary and rejects init_wfc file txt because no PW text reader exists.
  • The selected format is used directly, with no automatic detection or fallback.
  • User documentation and CLI help show only the explicit two-value file syntax.

Binary compatibility

The reader intentionally follows the existing native int/double writer protocol. It does not add magic/version fields or cross-ABI, cross-endian compatibility, and it does not read files accumulated with out_app_flag.

Verification

  • cmake --build build -j2 (full serial build passed)
  • OMP_NUM_THREADS=1 ctest --test-dir /tmp/abacus_wfc_binary_mpi_mpicxx --output-on-failure -R '^(MODULE_IO_read_item_serial|MODULE_IO_write_wfc_nao|MODULE_IO_write_wfc_nao_para|MODULE_IO_read_wfc_nao_test|MODULE_IO_read_wfc_nao_test_parallel)$' (5/5 passed, including 2-rank MPI outside the restricted sandbox)
  • OMP_NUM_THREADS=1 two-stage end-to-end runs passed for text Gamma, binary Gamma, and binary 8-k-point LCAO wavefunctions; source/readback energies differed by at most 5.5e-13 eV
  • legacy one-value LCAO input read the text file successfully and wrote init_wfc file txt to INPUT.info
  • OMP_NUM_THREADS=1 ./build/abacus_basic_omp --check-input: PW file binary passed; PW file txt failed with the expected unsupported-format error
  • ./build/abacus_basic_omp -h init_wfc: only the explicit file txt and file binary forms are documented
  • ./build/abacus_basic_omp -h read_wfc_lcao: returned Unknown parameter
  • regenerated docs/parameters.yaml and docs/advanced/input_files/input-main.md; a fresh YAML generation matched byte-for-byte
  • git diff --check
  • python3 tools/03_code_analysis/agent_governance_check.py --staged (no findings)

#6206

@mohanchen mohanchen added Refactor Refactor ABACUS codes Input&Output Suitable for coders without knowing too many DFT details labels Aug 26, 2026
@mohanchen
mohanchen self-requested a review August 29, 2026 02:45
Comment thread source/source_io/module_parameter/read_inp_sys.cpp
@mohanchen
mohanchen merged commit 402aa8d into deepmodeling:develop Sep 9, 2026
17 checks passed
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 Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants