Skip to content

Fix(io): improve module_hs sparse matrix output safety#7465

Closed
goodchong wants to merge 8 commits into
deepmodeling:developfrom
goodchong:inandout
Closed

Fix(io): improve module_hs sparse matrix output safety#7465
goodchong wants to merge 8 commits into
deepmodeling:developfrom
goodchong:inandout

Conversation

@goodchong

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?

Summary

  • Add compatibility coverage for write_HS_R-related CSR output contracts.
  • Fix legacy sparse binary header writing.
  • Fix non-MPI save_mat text stream opening.
  • Fix write_Vxc_R object ownership leaks.
  • Make AngularMomentumCalculator robust to null log streams.
  • Remove an unused sparse-map-to-HContainer helper.

Tests

  • ctest --test-dir build-phase0 -R MODULE_IO_write_hs_r_compat_test -V
  • ctest --test-dir build-phase0 -R MODULE_IO_cal_pLpR_test -V
  • ctest --test-dir build-phase0 -R MODULE_IO_single_R_test -V
  • ctest --test-dir build-phase0 -R MODULE_IO_sparse_matrix_test -V

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 ...

Add a Phase 0 compatibility test suite for write_HS_R-related output contracts and save the refactor plan.

Tests: ctest --test-dir build-phase0 -R MODULE_IO_write_hs_r_compat_test -V
Fix sparse binary header writing, non-MPI save_mat stream opening, Vxc(R) ownership, and AngularMomentumCalculator null logging.

Extend write_HS_R compatibility coverage for legacy binary sparse headers and update the refactor plan with Phase 1 status.

Tests: ctest --test-dir build-phase0 -R MODULE_IO_write_hs_r_compat_test -V

Tests: ctest --test-dir build-phase0 -R MODULE_IO_cal_pLpR_test -V

Tests: ctest --test-dir build-phase0 -R MODULE_IO_single_R_test -V

Tests: ctest --test-dir build-phase0 -R MODULE_IO_sparse_matrix_test -V

Builds: cmake --build build-phase0 --target io_advanced -j8

Builds: cmake -B build-phase1-nompi -DBUILD_TESTING=OFF -DENABLE_MPI=OFF && cmake --build build-phase1-nompi --target io_advanced -j8
Keep the local markdown file untracked while removing it from the remote branch contents.
@goodchong goodchong requested a review from mohanchen June 12, 2026 08:23
if (binary) {
int nlocal = PARAM.globalv.nlocal;
const int step = std::max(istep, 0);
const int nlocal = PARAM.globalv.nlocal;

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.

This parameter can be passed into the function instead of using a global variable.

@goodchong goodchong closed this Jun 15, 2026
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.

2 participants