Skip to content

Feature: use new format of CSR file for out_mat_hs2 and out_mat_ds, out_mat_t, out_mat_r, out_mat_xc2#6991

Open
dyzheng wants to merge 3 commits intodeepmodeling:developfrom
dyzheng:out_mat_hs2_refactor
Open

Feature: use new format of CSR file for out_mat_hs2 and out_mat_ds, out_mat_t, out_mat_r, out_mat_xc2#6991
dyzheng wants to merge 3 commits intodeepmodeling:developfrom
dyzheng:out_mat_hs2_refactor

Conversation

@dyzheng
Copy link
Collaborator

@dyzheng dyzheng commented Mar 2, 2026

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?

  • Example: My changes might affect the performance of the application under certain conditions, and I have tested the impact on various scenarios...

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

@mohanchen mohanchen requested a review from zhubonan March 4, 2026 04:58
@mohanchen mohanchen added Features Needed The features are indeed needed, and developers should have sophisticated knowledge Refactor Refactor ABACUS codes Input&Output Suitable for coders without knowing too many DFT details labels Mar 4, 2026
@mohanchen mohanchen requested a review from ErjieWu March 4, 2026 05:00
Copy link
Collaborator

@zhubonan zhubonan left a comment

Choose a reason for hiding this comment

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

Please move the parameter description update to the read_input_item_oputput.cpp source code file regenerate parameters.yaml and input-main.md. See also: https://abacus.deepmodeling.com/en/latest/CONTRIBUTING.html#how-to-regenerate

item.category = "Output information";
item.type = "Boolean";
item.type = R"(Boolean \[Integer\](optional))";
item.description = "Whether to print files containing the Hamiltonian matrix and overlap matrix into files in the directory OUT.${suffix}. For more information, please refer to hs_matrix.md."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps useful to mention that the second item is used for the floating-point precision in the output file.

type: "Boolean \\[Integer\\](optional)"
description: |
Whether to print files containing the Hamiltonian matrix and overlap matrix into files in the directory OUT.${suffix}. For more information, please refer to hs_matrix.md.
Output H(R) and S(R) matrices in CSR format with optional precision. Optional second parameter specifies output precision (default 8). For more information, please refer to hs_matrix.md.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file should be autogenerated instead of being edited by hand. You can regenerate with abacus --generate-parameters-yaml > docs/parameters.yaml, after moving the description into read_input_item_output.cpp file. Then python3 docs/generate_input_main.py docs/parameters.yaml --output docs/advanced/input_files/input-main.md to propagate the changes to the input-main.md. In fact, input-main.md will be regenerated on-the-fly from parameters.yaml. Nevertheless, it is useful to commit the up-to-date documentation in the repository.

### out_mat_hs2

- **Type**: Boolean
- **Type**: Boolean \[Integer\](optional)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please commit the changes after updating the .cpp file and regenerate (see comments for parameters.yaml).

@dyzheng dyzheng force-pushed the out_mat_hs2_refactor branch from be54bb1 to f7cce86 Compare March 4, 2026 07:50

/// Get HR as a vector of HContainer pointers (one per spin).
/// For nspin=2, creates temporary HContainers wrapping each spin half of hRS2.
/// Caller must delete returned pointers when nspin=2.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this delete operation for nspin=2 a temporary solution during refactor? It seems rather strange here.

@ErjieWu
Copy link
Collaborator

ErjieWu commented Mar 5, 2026

Format of reference files in integration tests should be updated as well. LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Features Needed The features are indeed needed, and developers should have sophisticated knowledge 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.

4 participants