Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

out_wfc_lcao 2 appends output wavefunction data to initial LCAO wavefunction file read by init_wfc nao #5913

Open
1 of 10 tasks
ahxbcn opened this issue Feb 20, 2025 · 0 comments · May be fixed by #5914
Open
1 of 10 tasks
Labels
Questions Raise your quesiton! We will answer it.

Comments

@ahxbcn
Copy link

ahxbcn commented Feb 20, 2025

Details

Improved SCF Convergence with Proper Initial Charge and Wavefunction Handling

Reading a good initial charge density and wavefunction significantly aids in achieving SCF convergence. However, I encountered an issue when using init_wfc nao to read the LCAO wavefunction file (WFC_NAO_K*.dat) from a previously converged calculation and out_wfc_lcao 2 to write the converged LCAO wavefunction back into the same WFC_NAO_K*.dat file. The output data is written in append mode ("a"), resulting in the WFC_NAO_K*.dat file being concatenated with the new wavefunction data. This behavior prevents the effective use of init_wfc nao and out_wfc_lcao 2 to accelerate SCF convergence when working with ase-abacus and ATST-tools.

Reproducible Example

A minimal example demonstrating this issue is provided here. It includes two calculations for a Si crystal with the same structure:

  1. The first calculation, 1-out_wfc_lcao_2, generates the LCAO wavefunction file WFC_NAO_K1.dat and the charge density file Si-CHARGE-DENSITY.restart.
  2. These files are then copied to 2_read_chg_wfc/OUT.Si, and the calculation in 2_read_chg_wfc is executed. After completion, the size of WFC_NAO_K1.dat in 2_read_chg_wfc is 30744 bytes, exactly twice the size of the file in 1-out_wfc_lcao_2.

Proposed Fix

After reviewing the source code of ABACUS v3.9.0, I believe this issue stems from the use of Binstream ofs(name, "a"); in module_io/write_wfc_nao.cpp (lines 60 and 136). Would it be appropriate to modify this to Binstream ofs(name, "w"); to overwrite the initial LCAO wavefunction file (WFC_NAO_K*.dat) instead of appending to it?

Have you read FAQ on the online manual http://abacus.deepmodeling.com/en/latest/community/faq.html

  • Yes, I have read the FAQ part on online manual.

Task list for Issue attackers (only for developers)

  • Understand the problem or question described by the user.
  • Check if the issue is a known problem or has been addressed in the documentation.
  • Test the issue or problem on a similar system or environment, if possible.
  • Identify the root cause or provide clarification on the user's question.
  • Provide a step-by-step guide, including any necessary resources, to resolve the issue or answer the question.
  • If the issue is related to documentation, update the documentation to prevent future confusion (optional).
  • If the issue is related to code, consider implementing a fix or improvement (optional).
  • Review and incorporate any relevant feedback from users or developers.
  • Ensure the user's issue is resolved or their question is answered and close the ticket.
@ahxbcn ahxbcn added the Questions Raise your quesiton! We will answer it. label Feb 20, 2025
@YuLiu98 YuLiu98 linked a pull request Feb 20, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Questions Raise your quesiton! We will answer it.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant