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

Request: further refactor on out-dated functions write_chg_r_1 and those similar #5209

Open
kirk0830 opened this issue Oct 8, 2024 · 3 comments
Assignees
Labels
Input&Output Suitable for coders without knowing too many DFT details The Absolute Zero Reduce the "entropy" of the code to 0

Comments

@kirk0830
Copy link
Collaborator

kirk0830 commented Oct 8, 2024

For this function, I have comments in mainly two aspects:

  1. the function name seems not clear enough, and probably is not an appropriate enough choice.
    (1) If this is really write a file of charge density, then it should not be used to write other things. Obviously you want this function to write cube file for wavefunction too, so it will be better if you change the name to something like "write_vdata_cube" which means writing the volumetric data to cube file.
    (2) the suffix "r_1" is confusing...I can understand the "r" denotes realspace or something relevant, but what about "_1"? If it is merely for distinguishing this function from other similar implementation(s), I will say it cannot be a good idea.
  2. Please take care of the precision of data. You can dump cube from other software, see how many digits there are for each line, for instance, the voxel, the grid data, etc. You should leave a degree of freedom here to admit user change the precision of cube file, like how the charge density is printed. I suggest you use our formatter library to explicitly control the precision of each line, like
#include "module_base/formatter.h"

const std::string cube; // will be initialized as empty
// now print the voxel lines (in total 3)
cube += FmtCore::format("%d %10.8f %10.8f %10.8f", nx, dxx, dxy, dxz);
cube += //...

Originally posted by @kirk0830 in #5140 (comment)

@kirk0830 kirk0830 added The Absolute Zero Reduce the "entropy" of the code to 0 Input&Output Suitable for coders without knowing too many DFT details labels Oct 8, 2024
@WHUweiqingzhou
Copy link
Collaborator

@AsTonyshment, could you have further refactor plan?

1 similar comment
@WHUweiqingzhou
Copy link
Collaborator

@AsTonyshment, could you have further refactor plan?

@AsTonyshment
Copy link
Collaborator

I will handle this.

@AsTonyshment AsTonyshment self-assigned this Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Input&Output Suitable for coders without knowing too many DFT details The Absolute Zero Reduce the "entropy" of the code to 0
Projects
None yet
Development

No branches or pull requests

3 participants