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

Refactor: a better looking of SCF stdout #4183

Closed
8 tasks
kirk0830 opened this issue May 18, 2024 · 7 comments · Fixed by #4185 or #4460
Closed
8 tasks

Refactor: a better looking of SCF stdout #4183

kirk0830 opened this issue May 18, 2024 · 7 comments · Fixed by #4185 or #4460
Assignees
Labels
Input&Output Suitable for coders without knowing too many DFT details

Comments

@kirk0830
Copy link
Collaborator

kirk0830 commented May 18, 2024

Describe the Code Quality Issue

The stdout of ABACUS now looks not quite nice, user might be unhappy with that.
I have made minor changes on codes to improve how it looks. For a preview, see below:
nspin 1:

 -------------------------------------------
 SELF-CONSISTENT :
 -------------------------------------------
 START CHARGE      : atomic
 DONE(0.264623   SEC) : INIT SCF
 * * * * * *
 << Start SCF iteration.
 ITER     ETOT (eV)       EDIFF (eV)         DRHO      TIME (s)
 GE1    -2.13624914e+02  0.00000000e+00  1.70439302e-01  0.25
 GE2    -2.13662196e+02 -3.72813049e-02  3.46113271e-02  0.16
 GE3    -2.13664572e+02 -2.37640191e-03  2.96351118e-03  0.19
 GE4    -2.13664573e+02 -9.68028273e-07  1.36970525e-04  0.16
 GE5    -2.13664573e+02 -5.32790912e-08  1.96191242e-05  0.17
 GE6    -2.13664573e+02 -5.15153170e-10  1.55381956e-06  0.16
 GE7    -2.13664573e+02 -9.48447377e-10  5.01811506e-08  0.15
 >> Leave SCF iteration.
 * * * * * *
TIME STATISTICS
---------------------------------------------------------------------------------
    CLASS_NAME                NAME            TIME(Sec)  CALLS   AVG(Sec) PER(%)
---------------------------------------------------------------------------------

nspin 2:

 -------------------------------------------
 SELF-CONSISTENT :
 -------------------------------------------
 START CHARGE      : atomic
 DONE(0.297363   SEC) : INIT SCF
 * * * * * *
 << Start SCF iteration.
 ITER      TMAG        AMAG       ETOT (eV)       EDIFF (eV)         DRHO      TIME (s)
 GE1     1.0853e-02  4.3401e-02 -2.13583507e+02  0.00000000e+00  2.82013025e-01  0.40
 GE2    -2.1293e-03  1.4233e-02 -2.13715144e+02 -1.31636902e-01  1.68444610e-01  0.33
 GE3     1.7348e-05  4.7104e-04 -2.13650961e+02  6.41834121e-02  7.53530290e-02  0.33
 GE4    -3.7785e-05  3.6961e-03 -2.13664362e+02 -1.34014482e-02  6.51237357e-03  0.33
 GE5     3.8538e-06  7.1441e-04 -2.13664567e+02 -2.04456996e-04  3.94452926e-03  0.33
 GE6     2.1443e-06  2.2922e-04 -2.13664573e+02 -6.36287308e-06  6.77532507e-04  0.41
 GE7     8.9175e-07  5.1470e-05 -2.13664573e+02  1.49237323e-07  1.68961148e-04  0.32
 GE8    -1.2102e-06  7.4713e-05 -2.13664573e+02 -2.39959458e-07  1.39672028e-04  0.32
 GE9    -1.5426e-07  7.6799e-06 -2.13664573e+02 -2.11454244e-08  1.78769546e-05  0.31
 GE10    1.8781e-09  4.1379e-07 -2.13664573e+02 -4.91661315e-10  1.31938847e-06  0.33
 GE11   -4.0046e-10  5.1652e-07 -2.13664573e+02 -8.20305594e-10  5.14140869e-07  0.29
 >> Leave SCF iteration.
 * * * * * *
TIME STATISTICS
---------------------------------------------------------------------------------
    CLASS_NAME                NAME            TIME(Sec)  CALLS   AVG(Sec) PER(%)
---------------------------------------------------------------------------------

nspin 4 (for nspin == 4, I find there is a deprecated or just not-working code for outputting "tmagx", "tmagy" and "tmagz", so I restore it):

 -------------------------------------------
 START CHARGE      : atomic
 DONE(0.315732   SEC) : INIT SCF
 * * * * * *
 << Start SCF iteration.
 ITER     TMAGX       TMAGY       TMAGZ        AMAG       ETOT (eV)       EDIFF (eV)         DRHO      TIME (s)
 GE1     7.6499e-17 -1.0031e-16  9.5288e-02  1.1293e-01 -2.13209319e+02  0.00000000e+00  5.86023853e-01  0.72
 GE2    -2.7122e-16  5.3056e-16 -2.3659e-02  3.1021e-02 -2.13713550e+02 -5.04231243e-01  3.41100404e-01  0.56
 GE3    -4.1414e-16 -1.1636e-16  1.0642e-05  1.5932e-03 -2.13648289e+02  6.52614136e-02  8.90716712e-02  0.68
 GE4     8.1627e-17 -8.8394e-17 -1.1168e-04  6.1840e-03 -2.13664337e+02 -1.60484687e-02  1.45574368e-02  0.57
 GE5     3.5171e-16  1.1109e-16 -9.9009e-06  5.0520e-04 -2.13664545e+02 -2.07339521e-04  4.97225439e-03  0.62
 GE6     8.2980e-17 -2.6295e-17  1.3870e-05  5.8459e-04 -2.13664572e+02 -2.78174114e-05  2.79430571e-03  0.63
 GE7     2.1013e-16 -4.6386e-17  4.2084e-06  1.2309e-04 -2.13664573e+02 -9.82437408e-07  7.24148003e-04  0.69
 GE8    -2.5885e-17 -5.0067e-17  1.4966e-06  3.7482e-05 -2.13664573e+02  3.67573907e-07  2.89679296e-04  0.57
 GE9    -1.8402e-17  1.7343e-17 -6.2112e-07  8.1511e-06 -2.13664573e+02 -1.47343522e-07  1.09068317e-04  0.66
 GE10   -1.3253e-16 -1.7356e-16  6.1963e-08  2.8336e-06 -2.13664573e+02 -1.39887710e-08  5.54087176e-06  0.61
 GE11    2.9552e-17 -2.7688e-18 -4.0443e-08  2.1474e-06 -2.13664573e+02  9.34115412e-11  4.87326059e-06  0.58
 GE12    2.6994e-17 -7.6199e-17 -3.0442e-10  2.5348e-08 -2.13664573e+02  1.84599574e-10  1.83064020e-07  0.52
 >> Leave SCF iteration.
 * * * * * *
TIME STATISTICS
---------------------------------------------------------------------------------
    CLASS_NAME                NAME            TIME(Sec)  CALLS   AVG(Sec) PER(%)
---------------------------------------------------------------------------------

It is not absolutely wrong to judge one book from its cover.

Additional Context

No response

Task list for Issue attackers (only for developers)

  • Identify the specific code file or section with the code quality issue.
  • Investigate the issue and determine the root cause.
  • Research best practices and potential solutions for the identified issue.
  • Refactor the code to improve code quality, following the suggested solution.
  • Ensure the refactored code adheres to the project's coding standards.
  • Test the refactored code to ensure it functions as expected.
  • Update any relevant documentation, if necessary.
  • Submit a pull request with the refactored code and a description of the changes made.
@kirk0830 kirk0830 self-assigned this May 18, 2024
@kirk0830 kirk0830 added the Input&Output Suitable for coders without knowing too many DFT details label May 18, 2024
@kirk0830
Copy link
Collaborator Author

I am still not satisfied with the output of initialization information, will polish them later in other PRs

@WHUweiqingzhou
Copy link
Collaborator

WHUweiqingzhou commented May 20, 2024

@pxlxingliang could you have a look? Will this change affect abacus-test?

@pxlxingliang
Copy link
Collaborator

The new format is ok for abacustest, except for the table head. In the table head, it has a blank between the column name and brackets of unit, such as: "TIME (s)", and make index of column name and the column value mismatch.
I suggest do not add this blank in table head.

@dyzheng
Copy link
Collaborator

dyzheng commented May 27, 2024

I think the precision of magnetization can be a little bit lower. The length of massege of magnetization should not be too long in screen.

@dyzheng dyzheng reopened this May 27, 2024
@mohanchen
Copy link
Collaborator

I think the precision of magnetization can be a little bit lower.

I see, I agree

@kirk0830
Copy link
Collaborator Author

I think the precision of magnetization can be a little bit lower. The length of massege of magnetization should not be too long in screen.

@dyzheng I also agree but dont have clear idea about the precision. Maybe 6.2f instead of .4e? On the other hand I think I still have some doubt about whether it is necessary to output magmoms at each SCF step. Seems some discussions are needed.

@WHUweiqingzhou
Copy link
Collaborator

WHUweiqingzhou commented Jun 20, 2024

@kirk0830
please

  1. reduce the length of AMAG and TMAG to .2e
  2. reduce DRHO to .4e.

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
Projects
None yet
5 participants