Skip to content

Refactor: Improve stability of KSDFT-generated ML descriptors - #7431

Merged
mohanchen merged 6 commits into
deepmodeling:developfrom
sunliang98:enhance_mlkedf
Jun 8, 2026
Merged

Refactor: Improve stability of KSDFT-generated ML descriptors#7431
mohanchen merged 6 commits into
deepmodeling:developfrom
sunliang98:enhance_mlkedf

Conversation

@sunliang98

Copy link
Copy Markdown
Collaborator

Reminder

  • Have you linked an issue with this pull request?
  • Have you added adequate unit tests and/or case tests for your pull request?
  • Have you noticed possible changes of behavior below or in the linked issue?
  • Have you explained the changes of codes in core modules of ESolver, HSolver, ElecState, Hamilt, Operator or Psi? (ignore if not applicable)

Linked Issue

Fix #...

Unit Tests and/or Case Tests for my changes

  • A unit test is added for each new feature or bug fix.

What's changed?

This PR introduces two main improvements:

  • Add check for of_ml_gene_data
    A validation step has been added to ensure that of_ml_gene_data is only used with single-core PW basis set KSDFT calculations. If the current calculation does not meet this requirement, an error will be raised with an appropriate message, preventing invalid or unsupported usage.

  • Add integrated example 01_PW/103_PW_Gene_Descriptors

Any changes of core modules? (ignore if not applicable)

  • Example: I have added a new virtual function in the esolver base class in order to ...

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens correctness/stability around KSDFT-generated ML descriptor output by (1) enforcing valid runtime conditions for of_ml_gene_data and (2) extending the integration test harness to record/compare summary statistics of generated .npy descriptors, along with a new PW test case exercising that path.

Changes:

  • Add an input validation check that rejects of_ml_gene_data unless running KSDFT + PW on a single MPI rank (NPROC=1).
  • Extend integration tooling to compute and compare mean absolute values of ML descriptor .npy outputs.
  • Add a new integrated example/test case 01_PW/103_PW_Gene_Descriptors and include it in the CPU case list.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/integrate/tools/collect_npy_means.py New helper to compute per-.npy mean(abs(values)) and print as key/value pairs for reference comparison.
tests/integrate/tools/catch_properties.sh Appends collected descriptor mean metrics to result.out/result.ref when descriptor output directory exists.
tests/integrate/Autotest.sh Adds a descriptor-specific threshold path and forces single-rank execution when of_ml_gene_data=1 is detected.
tests/01_PW/CASES_CPU.txt Registers the new 103_PW_Gene_Descriptors test case.
tests/01_PW/103_PW_Gene_Descriptors/STRU New structure input for descriptor-generation case.
tests/01_PW/103_PW_Gene_Descriptors/KPT New k-point mesh for the descriptor-generation case.
tests/01_PW/103_PW_Gene_Descriptors/INPUT Enables of_ml_gene_data and related ML-KEDF descriptor parameters.
tests/01_PW/103_PW_Gene_Descriptors/result.ref Adds reference outputs including descriptor mean keys for regression testing.
tests/01_PW/103_PW_Gene_Descriptors/README Documents intent/constraints of the new descriptor-generation case.
source/source_io/module_parameter/read_input_item_ofdft.cpp Adds check_value validation for of_ml_gene_data (KSDFT+PW+single-rank only).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/source_io/module_parameter/read_input_item_ofdft.cpp
Comment thread source/source_io/module_parameter/read_input_item_ofdft.cpp
Comment thread tests/integrate/Autotest.sh Outdated
@mohanchen mohanchen added Refactor Refactor ABACUS codes Input&Output Suitable for coders without knowing too many DFT details Machine Learning & AI Issues related to AI labels Jun 5, 2026
sunliang98 and others added 3 commits June 5, 2026 12:05
@mohanchen
mohanchen merged commit 6320309 into deepmodeling:develop Jun 8, 2026
15 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 Machine Learning & AI Issues related to AI Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants