out_wfc_lcao 2
appends output wavefunction data to initial LCAO wavefunction file read by init_wfc nao
#5913
Labels
Questions
Raise your quesiton! We will answer it.
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 andout_wfc_lcao 2
to write the converged LCAO wavefunction back into the sameWFC_NAO_K*.dat
file. The output data is written in append mode ("a"
), resulting in theWFC_NAO_K*.dat
file being concatenated with the new wavefunction data. This behavior prevents the effective use ofinit_wfc nao
andout_wfc_lcao 2
to accelerate SCF convergence when working withase-abacus
andATST-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-out_wfc_lcao_2
, generates the LCAO wavefunction fileWFC_NAO_K1.dat
and the charge density fileSi-CHARGE-DENSITY.restart
.2_read_chg_wfc/OUT.Si
, and the calculation in2_read_chg_wfc
is executed. After completion, the size ofWFC_NAO_K1.dat
in2_read_chg_wfc
is 30744 bytes, exactly twice the size of the file in1-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");
inmodule_io/write_wfc_nao.cpp
(lines 60 and 136). Would it be appropriate to modify this toBinstream 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
Task list for Issue attackers (only for developers)
The text was updated successfully, but these errors were encountered: