-
Notifications
You must be signed in to change notification settings - Fork 134
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
Refactor namespace Exx_Opt_Orb #5226
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this PR do some minor refactor on codes that add "this->" to instance named "orb_", which makes the code clearer, this is acceptable.
However, it also shows me very astonishing use of nested std::map (I had never known them before), and very long lambda function that makes me confused about the program design.
There are also parameters packed in struct and named as "info", which I think, will bring more difficulty on program maintainment, so I request a change on it.
The use of extern keyword seems confusing and needs more explanation.
There are also new code added which depends explicitly on instance of class LCAO_Orbitals (is it a to-be-deprecated class? @mohanchen ).
Because seems there are already many codes in this module, so an immediate thoroughful improvement on code structure is nearly impossible, I recommend not introduce more cognition complexity into codes.
Exx_Abfs::Jle::Lmax = PARAM.inp.exx_opt_orb_lmax; | ||
Exx_Abfs::Jle::Ecut_exx = PARAM.inp.exx_opt_orb_ecut; | ||
Exx_Abfs::Jle::tolerence = PARAM.inp.exx_opt_orb_tolerence; | ||
GlobalC::exx_info.info_opt_abfs.abfs_Lmax = PARAM.inp.exx_opt_orb_lmax; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use of GlobalC is highly discouraged
const LCAO_Orbitals &orb_in, | ||
const double kmesh_times ); | ||
static std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> change_orbs( | ||
extern std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> change_orbs( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you explain why you change all static
to extern
???
from https://en.cppreference.com/w/cpp/keyword/extern, which is the result want to get?
void Exx_Abfs::Jle::init_jle( const double kmesh_times, const LCAO_Orbitals& orb ) | ||
std::vector< std::vector< std::vector< Numerical_Orbital_Lm>>> | ||
Exx_Abfs::Jle::init_jle( | ||
const Exx_Info::Exx_Info_Opt_ABFs &info, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the "info" used here has very straight forward drawback: it is impossible to know what one function really needs according to its parameter list. This will brings difficulty to code maintaining, unless this code is not expected to be maintained by any other
const ModuleBase::Element_Basis_Index::IndexLNM &index_jles) const | ||
const std::vector<double>& orb_cutoff, | ||
const ModuleBase::Element_Basis_Index::Range &range_jles, | ||
const ModuleBase::Element_Basis_Index::IndexLNM &index_jles) | ||
{ | ||
auto print_header = [&]( std::ofstream &ofs ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why use lambda here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
|
||
|
||
auto print_Q = [&]( std::ofstream &ofs ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why use lambda here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
This PR is just to fix these codes from at least five years ago, making it can be run again under the LibRI framework. Many years ago, the codes of exx without LibRI were completely different from today. ============================== As for |
@PeizeLin Hi, I understand the historical reason you mentioned.
|
All the variables in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I retract my file change request presently
I have seen new PR, so this one will be closed. |
No description provided.