Refactor istate_charge.cpp
to reduce dependence on other modules
#4086
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Linked Issue
Fix #4085.
What's changed?
This pull request introduces a series of refactoring and improvements aimed at enhancing code readability, performance, and modularity. Here are the major changes made:
Used
parse_expression
Template Function:parse_expression
template function to support direct parsing toint
types. This update eliminates the need for explicit type conversions previously present, reducing potential type conversion errors.Isolation of
bands_to_print
toout_band_kb
Conversion:bands_to_print
toout_band_kb
into a separate function. This change ensures that the process of obtainingout_band_kb
is handled internally within theINPUT
class, making the intermediate transformation process invisible and inaccessible from outside.Reduced Dependency on
pelec
:wg
directly into functions wherepelec
was previously required. This reduction in dependency decreases coupling across the codebase.Extended Functionality in
efermi
Struct:get_all_ef
, to theefermi
struct, which returns a vector of Fermi energies for all spins. This enhancement provides a more flexible and straightforward way to access all Fermi energy values across different spins.Expansion of
rhopw
Parameters:rhopw
parameter into six distinct input parameters.Expanded
bigpw
Parameters:bigpw
parameter into two separate input parameters.Reminder
Local Orbital Charge
(LOC) is due to the extensive use of its numerous member functions, which are currently tightly integrated into various parts of the codebase. Detaching this dependency now would be inefficient and could potentially destabilize critical functionalities.Future Plans for Refactoring
idmatrix
: