deepmodeling / abacus-develop

An electronic structure package based on either plane wave basis or numerical atomic orbitals.
http://abacus.ustc.edu.cn
GNU Lesser General Public License v3.0
173 stars 134 forks source link

Feature&Refactor: plan to change datatypes of all flags `out_*` from `bool/int` to `std::vector<int>` inside ABACUS to support seperate output precision control #3456

Closed kirk0830 closed 3 months ago

kirk0830 commented 10 months ago

Describe the Code Quality Issue

The output of Hamiltonian and overlap matrix with precision 5 is actually unacceptable for scientific calculation purpose, the same problem also exists in out_chg, the loss of precision would cause extra number of scf loops in restarted run. Postprocessing like Bader charge analysis also needs relatively high precision of cube file. Based on PR #3454 , after changing from bool/int to std::vector<int> which contains two elements, the first element in vector would be identical with the original, for selecting option, the second would be precision. Default value will give the second.

Keywords to support: Keyword Description
out_mul Mulliken charges
out_chg charge density cube file
out_pot potential cube file
out_dm density matrix (gamma-only)
out_dm1 density matrix (multiple k points)
out_wfc_pw wavefunctions in plane wave basis
out_wfc_r wavefunctions in real space
out_wfc_lcao wavefunctions in LCAO basis
out_dos density of states
out_band band structure
out_proj_band projected band structure
out_mat_hs Hamiltonian H(k) and overlap S(k) matrices
out_mat_r H(R) and S(R)
out_mat_t T(R)
out_mat_dh dH(R)/dR
out_mat_xc exchange-correlation matrix

Checklist:

WHUweiqingzhou commented 10 months ago

Very good refactor!