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

Fix: add energy_stable_count to ensure energy threshold is really achieved #5012

Closed
wants to merge 8 commits into from

Conversation

hongriTianqi
Copy link

@hongriTianqi hongriTianqi commented Aug 28, 2024

Reminder

  • Have you linked an issue with this pull request?
  • Have you noticed possible changes of behavior below or in the linked issue?
    if scf_ene_thr is set in INPUT, the energy is converged only when the scf_ene_thr has been fulfilled twice.
  • Have you explained the changes of codes in core modules of ESolver, HSolver, ElecState, Hamilt, Operator or Psi? (ignore if not applicable)
    an int stable_energy_count is added in ESolver_FP

Linked Issue

Fix #5011

@hongriTianqi hongriTianqi requested review from maki49, YuLiu98, PeizeLin and WHUweiqingzhou and removed request for maki49 and YuLiu98 August 28, 2024 09:31
@hongriTianqi hongriTianqi changed the title Fix: add energy_stable count to energy threshold Fix: add energy_stable_count to ensure energy threshold is really achieved Aug 28, 2024
@QuantumMisaka
Copy link
Collaborator

@hongriTianqi Sometimes we can encounter another situation: drho reached 1e-7 while EDIFF only reached 1e-4, can we do something to detect it ?

@hongriTianqi
Copy link
Author

@QuantumMisaka You can set scf_ene_thr now to a small value. oh, no. scf_thr and scf_ene_thr are or relationship. In this case, you have to increase scf_thr currently. Maybe you need to raise another issue.

@hongriTianqi
Copy link
Author

hongriTianqi commented Aug 28, 2024

I have tested this PR. The case in the issue can be solved now:

<< Start SCF iteration.
 ITER     TMAGX      TMAGY      TMAGZ       AMAG        ETOT/eV          EDIFF/eV         DRHO     TIME/s
 DA1      3.73e+00   2.28e-06  -4.25e-01   3.94e+00  -1.37072042e+04   0.00000000e+00   1.0581e+00 110.92
 DA2      3.93e+00  -2.03e-06  -3.44e-01   4.10e+00  -1.37085247e+04  -1.32057816e+00   7.5903e-01  86.72
 DA3      4.02e+00   6.13e-06  -4.77e-01   4.21e+00  -1.37094467e+04  -9.21918555e-01   7.0412e-02  73.85
 DA4      4.19e+00  -1.15e-05  -5.19e-01   4.38e+00  -1.37095188e+04  -7.21822904e-02   6.1596e-03  77.59
 DA5      4.31e+00   6.05e-05  -6.10e-01   4.54e+00  -1.37095291e+04  -1.02978001e-02   2.4583e-03 121.19
 DA6      4.32e+00  -7.12e-05  -5.52e-01   4.56e+00  -1.37095291e+04   5.90551582e-07   1.6169e-03 114.86
 DA7      4.36e+00   8.06e-05  -6.48e-01   4.62e+00  -1.37095329e+04  -3.72805275e-03   5.6930e-04 120.51
 DA8      4.36e+00  -6.43e-05  -5.83e-01   4.61e+00  -1.37095343e+04  -1.37836281e-03   6.8844e-05 124.19
 DA9      4.34e+00   1.17e-04  -6.40e-01   4.60e+00  -1.37095343e+04  -9.78010849e-05   4.0596e-05 154.60
 DA10     4.34e+00  -5.10e-05  -5.96e-01   4.59e+00  -1.37095352e+04  -8.66692188e-04   1.5723e-05 154.82
 DA11     4.34e+00   1.19e-04  -6.05e-01   4.59e+00  -1.37095352e+04   3.23685862e-05   6.7233e-06 174.19
 DA12     4.34e+00  -2.40e-04  -5.89e-01   4.59e+00  -1.37095354e+04  -2.33666558e-04   2.9344e-06 181.47
 DA13     4.34e+00   6.62e-04  -6.07e-01   4.59e+00  -1.37095355e+04  -9.88559794e-05   6.0822e-07 185.89
 DA14     4.34e+00  -5.62e-04  -6.04e-01   4.59e+00  -1.37095357e+04  -1.64176245e-04   1.1672e-07 199.03
 DA15     4.34e+00   1.06e-03  -5.98e-01   4.59e+00  -1.37095357e+04  -1.73131651e-05   1.2087e-07 209.72
 DA16     4.34e+00  -1.36e-03  -5.98e-01   4.59e+00  -1.37095357e+04   2.24533143e-05   1.1272e-07 207.90
 DA17     4.34e+00   7.59e-04  -6.02e-01   4.59e+00  -1.37095357e+04  -4.45663877e-05   2.6705e-08 208.12
 DA18     4.34e+00  -2.01e-03  -6.02e-01   4.59e+00  -1.37095357e+04   2.00607770e-05   6.4388e-08 226.55
 DA19     4.35e+00   8.08e-04  -6.01e-01   4.59e+00  -1.37095357e+04  -1.78516579e-05   1.9266e-08 227.23
 DA20     4.35e+00  -3.63e-04  -6.00e-01   4.59e+00  -1.37095357e+04  -4.39093428e-06   1.7010e-08 222.09
 DA21     4.35e+00  -2.08e-04  -6.03e-01   4.59e+00  -1.37095357e+04  -1.82939792e-06   1.3425e-08 220.43
 DA22     4.35e+00   2.59e-04  -6.02e-01   4.59e+00  -1.37095357e+04   7.47567967e-06   8.3377e-09 219.63
 >> Leave SCF iteration.
 * * * * * *

The corresponding INPUT parameters are:

calculation   scf
ecutwfc 130
scf_thr    1.0e-8
scf_ene_thr    1.0e-6
scf_nmax 100

@WHUweiqingzhou
Copy link
Collaborator

@maki49 could you have a look about EXX part?

source/module_ri/Exx_LRI_interface.hpp Outdated Show resolved Hide resolved
@WHUweiqingzhou
Copy link
Collaborator

This PR will cause all calculations to run an additional SCF step with finite scf_ene_thr. I believe the current strategy comes at too high a cost and requires further discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Energy is converge to 1e-7, but drho only to 1e-3
6 participants