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

Bug: BFGS breakdown for Fe5C2(510) slab system due to weird magmom-flip #5006

Closed
1 of 16 tasks
QuantumMisaka opened this issue Aug 26, 2024 · 5 comments · Fixed by #5007
Closed
1 of 16 tasks

Bug: BFGS breakdown for Fe5C2(510) slab system due to weird magmom-flip #5006

QuantumMisaka opened this issue Aug 26, 2024 · 5 comments · Fixed by #5007
Assignees

Comments

@QuantumMisaka
Copy link
Collaborator

QuantumMisaka commented Aug 26, 2024

Describe the bug

When doing BFGS using MGGA_X_R2SCAN+MGGA_C_R2SCAN in Fe5C2(510) surfaces (and adsobate-surface) systems, the BFGS tend to breakdown:

ETOT DIFF (eV)       : 4.882167
 LARGEST GRAD (eV/A)  : 1.174840
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                         NOTICE                           
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 trust radius is too small! Break down.
 CHECK IN FILE : OUT.ABACUS/warning.log
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                         NOTICE                           
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I've done some test and found that:

  • BFGS and CG will have this problem, FIRE will not.
  • ABACUS 3.7.3 will have this problem, ABACUS 3.7.0 will not (so which version and commits is this problem begin ?)
  • Change smearing_sigma will have no help
  • Change chg_extrap from first-order to atomic can alleviate this problem, but has no help for the final relaxation process
  • This problem originates from the magnetic monents abnormally filp in some Fe atoms, for an example STRU_ION_D:
ATOMIC_SPECIES
C  12.0110 C_ONCV_PBE-1.0.upf upf201
Fe  55.8450 Fe_ONCV_PBE-1.0.upf upf201

NUMERICAL_ORBITAL
C_gga_7au_100Ry_2s2p1d.orb
Fe_gga_8au_100Ry_4s2p2d1f.orb

LATTICE_CONSTANT
1.8897260000

LATTICE_VECTORS
        9.9796610000        0.0000000000        0.0000000000
        0.0000000000       19.6401260000        0.0000000000
       -0.7639470000        0.0000000000       12.6615980000

ATOMIC_POSITIONS
Direct

C #label
0.0000   #magnetism
36 #number of atoms
        0.0294440000        0.0094620000        0.6901720000 m 0 0 0 mag  0.1213
        0.5294440000        0.0094620000        0.6901720000 m 0 0 0 mag  0.1583
        0.2536650000        0.0207980000        0.0891950000 m 0 0 0 mag -0.2226
        0.7536650000        0.0207980000        0.0891950000 m 0 0 0 mag -0.4450
        0.0908060000        0.0234150000        0.4841370000 m 0 0 0 mag  0.1385
        0.5908060000        0.0234150000        0.4841370000 m 0 0 0 mag  0.1850
        0.4914740000        0.0655790000        0.8917110000 m 0 0 0 mag -0.1141
        0.9914740000        0.0655790000        0.8917110000 m 0 0 0 mag -0.0609
        0.3233360000        0.0748560000        0.2983940000 m 0 0 0 mag -0.1509
        0.8233360000        0.0748560000        0.2983940000 m 0 0 0 mag  0.0162
        0.2337999947        0.1024979939        0.7694040050 m 1 1 1 mag -0.1677
        0.7338049946        0.1024989939        0.7693860051 m 1 1 1 mag  0.1024
        0.0616790135        0.1192859812        0.1760729936 m 1 1 1 mag -0.0312
        0.5616830136        0.1192859812        0.1760719937 m 1 1 1 mag -0.0323
        0.4696049724        0.1722250144        0.5689890132 m 1 1 1 mag -0.0664
        0.9696369722        0.1722800144        0.5690030133 m 1 1 1 mag -0.0815
        0.2938589967        0.1873559943        0.9741050056 m 1 1 1 mag -0.1583
        0.7938389972        0.1873559942        0.9740990056 m 1 1 1 mag  0.0178
        0.2091259942        0.2048370061        0.4500140003 m 1 1 1 mag -0.0820
        0.7091509937        0.2048340061        0.4500260003 m 1 1 1 mag -0.0290
        0.0325600365        0.2177929856        0.8539809870 m 1 1 1 mag  0.0031
        0.5325610365        0.2177879856        0.8539929869 m 1 1 1 mag -0.1926
        0.4410879786        0.2717620201        0.2474950060 m 1 1 1 mag -0.1372
        0.9410859785        0.2717850200        0.2475010059 m 1 1 1 mag -0.1738
        0.2685850072        0.2888160073        0.6542789905 m 1 1 1 mag -0.1168
        0.7685940072        0.2888310073        0.6542899905 m 1 1 1 mag -0.0789
        0.1790129979        0.3176060072        0.1259380103 m 1 1 1 mag -0.1898
        0.6790129978        0.3175940072        0.1259480103 m 1 1 1 mag -0.1029
        0.0106470037        0.3250870014        0.5334270011 m 1 1 1 mag -0.1236
        0.5106310037        0.3250350016        0.5334270010 m 1 1 1 mag -0.0760
        0.4114509966        0.3691190152        0.9410769935 m 1 1 1 mag -0.4402
        0.9114379966        0.3691130152        0.9410749934 m 1 1 1 mag -0.1111
        0.2496200048        0.3699010215        0.3359670002 m 1 1 1 mag -0.2070
        0.7496020048        0.3698930215        0.3359800001 m 1 1 1 mag  0.1199
        0.4731369969        0.3845850013        0.7335249725 m 1 1 1 mag -0.1980
        0.9731449968        0.3845980013        0.7335329725 m 1 1 1 mag  0.2280

Fe #label
0.0000   #magnetism
80 #number of atoms
        0.1318040000        0.0257890000        0.8125750000 m 0 0 0 mag -2.5225
        0.6318040000        0.0257890000        0.8125750000 m 0 0 0 mag -2.4741
        0.2521520000        0.0307370000        0.4194370000 m 0 0 0 mag  2.9200
        0.7521520000        0.0307370000        0.4194370000 m 0 0 0 mag -2.8820
        0.1895550000        0.0307950000        0.6185430000 m 0 0 0 mag -2.8129
        0.6895550000        0.0307950000        0.6185430000 m 0 0 0 mag -2.7622
        0.0811100000        0.0339920000        0.0194580000 m 0 0 0 mag  2.8751
        0.5811100000        0.0339920000        0.0194580000 m 0 0 0 mag  2.7836
        0.1678690000        0.0373640000        0.2140330000 m 0 0 0 mag -2.3489
        0.6678690000        0.0373640000        0.2140330000 m 0 0 0 mag  2.5055
        0.3832370000        0.0380610000        0.7627750000 m 0 0 0 mag  2.4580
        0.8832370000        0.0380610000        0.7627750000 m 0 0 0 mag  2.4038
        0.4378660000        0.0396710000        0.5640350000 m 0 0 0 mag -2.8805
        0.9378660000        0.0396710000        0.5640350000 m 0 0 0 mag -2.7858
        0.3247340000        0.0449020000        0.9604720000 m 0 0 0 mag  2.7868
        0.8247340000        0.0449020000        0.9604720000 m 0 0 0 mag  2.6892
        0.4128340000        0.0483620000        0.1645910000 m 0 0 0 mag  2.6348
        0.9128340000        0.0483620000        0.1645910000 m 0 0 0 mag  2.5923
        0.0009670000        0.0499200000        0.3574790000 m 0 0 0 mag -2.7505
        0.5009670000        0.0499200000        0.3574790000 m 0 0 0 mag  2.6111
        0.1076300170        0.1266370044        0.4958320266 m 1 1 1 mag -2.1965
        0.6076460169        0.1266250046        0.4958270266 m 1 1 1 mag -2.3864
        0.2235349905        0.1329290344        0.0903269763 m 1 1 1 mag  2.6450
        0.7235439904        0.1329240344        0.0903219763 m 1 1 1 mag  2.6764
        0.0574039950        0.1360300372        0.6983439772 m 1 1 1 mag  2.8399
        0.5573919950        0.1360300371        0.6983609771 m 1 1 1 mag -2.7035
        0.1415830129        0.1390649695        0.8913460690 m 1 1 1 mag  2.1044
        0.6415890129        0.1390589696        0.8913440690 m 1 1 1 mag -2.0975
        0.3593790171        0.1407969938        0.4424139806 m 1 1 1 mag  2.4642
        0.8594030170        0.1408019937        0.4424459804 m 1 1 1 mag -2.5235
        0.1719569994        0.1439220136        0.3061130151 m 1 1 1 mag -2.5529
        0.6719609995        0.1439160136        0.3061280150 m 1 1 1 mag -2.6257
        0.3033970068        0.1471200063        0.6456790193 m 1 1 1 mag  2.7975
        0.8034120068        0.1471180062        0.6456610193 m 1 1 1 mag  2.7501
        0.3858669841        0.1489450336        0.8510159081 m 1 1 1 mag  2.1609
        0.8858679842        0.1489480336        0.8510009081 m 1 1 1 mag -2.1445
        0.4696900018        0.1503159793        0.0414780098 m 1 1 1 mag -2.7385
        0.9696950017        0.1503179793        0.0414700099 m 1 1 1 mag  2.6975
        0.4143979683        0.1599220426        0.2503419936 m 1 1 1 mag  2.5254
        0.9143949683        0.1599220426        0.2503469936 m 1 1 1 mag  2.5130
        0.0884010314        0.2319299581        0.1725570050 m 1 1 1 mag  2.4650
        0.5884150313        0.2319159581        0.1725640051 m 1 1 1 mag  2.4462
        0.0330860017        0.2410840175        0.3823209893 m 1 1 1 mag  2.6943
        0.5330800018        0.2410820175        0.3823499891 m 1 1 1 mag  2.6960
        0.1167500114        0.2426689642        0.5735530861 m 1 1 1 mag  2.1216
        0.6167530115        0.2426309644        0.5736000859 m 1 1 1 mag  2.1424
        0.1987059906        0.2472529922        0.7802119859 m 1 1 1 mag  2.7498
        0.6987099906        0.2472419922        0.7802109859 m 1 1 1 mag  2.7612
        0.3302270020        0.2477489888        0.1166679858 m 1 1 1 mag  2.5340
        0.8302340021        0.2477489888        0.1166719858 m 1 1 1 mag  2.5536
        0.1427139806        0.2515620019        0.9800390189 m 1 1 1 mag  2.4820
        0.6427129806        0.2515560019        0.9800430189 m 1 1 1 mag  2.5812
        0.3618579843        0.2520980281        0.5336329314 m 1 1 1 mag  2.0881
        0.8618359845        0.2521270280        0.5336179316 m 1 1 1 mag  2.1728
        0.2790910120        0.2583599687        0.3339100187 m 1 1 1 mag  2.5540
        0.7790780122        0.2583529686        0.3339100187 m 1 1 1 mag  2.5294
        0.4451670010        0.2584369583        0.7280200272 m 1 1 1 mag  2.7362
        0.9451740011        0.2584199583        0.7279820273 m 1 1 1 mag -2.7357
        0.3957969853        0.2659489962        0.9270439740 m 1 1 1 mag  2.3381
        0.8957969853        0.2659459962        0.9270369740 m 1 1 1 mag -2.2769
        0.0016890207        0.3423150095        0.0670429767 m 1 1 1 mag  2.4982
        0.5016900207        0.3423060095        0.0670439766 m 1 1 1 mag  2.6987
        0.0901379797        0.3430229976        0.2600720104 m 1 1 1 mag  2.5972
        0.5901219798        0.3430099975        0.2600820104 m 1 1 1 mag -2.5775
        0.1774250001        0.3476630041        0.4645159846 m 1 1 1 mag  2.8963
        0.6774140001        0.3476490041        0.4645309845 m 1 1 1 mag -2.8656
        0.1193750259        0.3537510180        0.6622780123 m 1 1 1 mag -2.5435
        0.6193610258        0.3537380179        0.6622680122 m 1 1 1 mag  2.6010
        0.3350009836        0.3531820010        0.2114929755 m 1 1 1 mag -2.4277
        0.8349769837        0.3531800011        0.2115009754 m 1 1 1 mag -2.5958
        0.0647910405        0.3578230127        0.8611510205 m 1 1 1 mag -2.8492
        0.5648090403        0.3578220127        0.8611530204 m 1 1 1 mag  2.6744
        0.4225700157        0.3562159987        0.4050629876 m 1 1 1 mag  2.9398
        0.9225670157        0.3562029988        0.4050419875 m 1 1 1 mag  2.8379
        0.2499439600        0.3613810041        0.0051010063 m 1 1 1 mag  2.8249
        0.7499479599        0.3613720041        0.0051120063 m 1 1 1 mag  2.7689
        0.3131909318        0.3646680082        0.8066229882 m 1 1 1 mag  2.9234
        0.8131819319        0.3646530082        0.8066129883 m 1 1 1 mag  2.7714
        0.3711119978        0.3652380057        0.6122869618 m 1 1 1 mag -2.4141
        0.8711209978        0.3652620055        0.6122929617 m 1 1 1 mag -2.4115

Where the positive magmom for Fe are normal, the negative are abnormal. ant these negative magmom will arise in relaxation process. (often occur at the 2nd and 3rd ion step)

Expected behavior

The relaxation process for R2SCAN in Fe5C2(510) slab be robustly normal

Also:

  • I'd like to know how and why this abnormal magmom filp happened
  • As an optimizer, FIRE is in the MD module of ABACUS, which is not easy for use. I consider that FIRE should be moved to relax part, and these relaxation optimizer should be usable inside ABACUS (for NEB usage, this process is needed)

To Reproduce

Attachments:
Fe5C2-SCAN-opt.tar.gz

Environment

No response

Additional Context

No response

Task list for Issue attackers (only for developers)

  • Verify the issue is not a duplicate.
  • Describe the bug.
  • Steps to reproduce.
  • Expected behavior.
  • Error message.
  • Environment details.
  • Additional context.
  • Assign a priority level (low, medium, high, urgent).
  • Assign the issue to a team member.
  • Label the issue with relevant tags.
  • Identify possible related issues.
  • Create a unit test or automated test to reproduce the bug (if applicable).
  • Fix the bug.
  • Test the fix.
  • Update documentation (if necessary).
  • Close the issue and inform the reporter (if applicable).
@QuantumMisaka QuantumMisaka changed the title Bug: R2SCAN BFGS breakdown for Fe5C2(510) slab system Bug: BFGS breakdown for Fe5C2(510) slab system Aug 26, 2024
@QuantumMisaka QuantumMisaka changed the title Bug: BFGS breakdown for Fe5C2(510) slab system Bug: BFGS breakdown for Fe5C2(510) slab system due to weird magmom-flip Aug 26, 2024
@QuantumMisaka
Copy link
Collaborator Author

PBE have the same problem:
COpbe-opt-down.tar.gz

@QuantumMisaka
Copy link
Collaborator Author

This problem seems to be a charge extrapolation problem, I've check commits and found that commit 844e0e0 introduce this problem.

                              ABACUS v3.7.3

               Atomic-orbital Based Ab-initio Computation at UStc                    

                     Website: http://abacus.ustc.edu.cn/                             
               Documentation: https://abacus.deepmodeling.com/                       
                  Repository: https://github.com/abacusmodeling/abacus-develop       
                              https://github.com/deepmodeling/abacus-develop         
                      Commit: 844e0e0ac (Tue Aug 13 20:41:57 2024 +0800)

 Tue Aug 27 09:16:36 2024
 MAKE THE DIR         : OUT.ABACUS/
 RUNNING WITH DEVICE  : CPU / Intel(R) Xeon(R) Platinum 8358 CPU @ 2.60GHz

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 Warning: the number of valence electrons in pseudopotential > 8 for Fe: [Ar] 3d6 4s2
 Pseudopotentials with additional electrons can yield (more) accurate outcomes, but may be less efficient.
 If you're confident that your chosen pseudopotential is appropriate, you can safely ignore this warning.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 UNIFORM GRID DIM        : 125 * 240 * 160
 UNIFORM GRID DIM(BIG)   : 25 * 48 * 32
 DONE(0.21133    SEC) : SETUP UNITCELL
 DONE(0.22911    SEC) : INIT K-POINTS
 ---------------------------------------------------------
 Ion relaxation calculations
 ---------------------------------------------------------
 SPIN    KPOINTS         PROCESSORS  NBASE       
 2       8               16          2628        
 ---------------------------------------------------------
 Use Systematically Improvable Atomic bases
 ---------------------------------------------------------
 ELEMENT ORBITALS        NBASE       NATOM       XC          
 C       2s2p1d-7au      13          36          
 Fe      4s2p2d1f-8au    27          80          
 ---------------------------------------------------------
 Initial plane wave basis and FFT box
 ---------------------------------------------------------
 DONE(0.271773   SEC) : INIT PLANEWAVE
 -------------------------------------------
 STEP OF ION RELAXATION : 1
 -------------------------------------------
 START CHARGE      : file
 DONE(4.49763    SEC) : INIT SCF
 * * * * * *
 << Start SCF iteration.
 ITER      TMAG       AMAG        ETOT/eV          EDIFF/eV         DRHO     TIME/s
 GE1      1.45e+02   1.58e+02  -2.63158549e+05   0.00000000e+00   9.0148e-08  11.61
 >> Leave SCF iteration.
 * * * * * *
----------------------------------------------------------------
 TOTAL-STRESS (KBAR)                                            
----------------------------------------------------------------
       -11.1411001496         0.0355865282         0.1114624902 
         0.0355865282        -0.2145545272         0.4202546190 
         0.1114624902         0.4202546190        -4.2414869081 
----------------------------------------------------------------
 TOTAL-PRESSURE: -5.199047 KBAR

 ETOT DIFF (eV)       : 0.000000
 LARGEST GRAD (eV/A)  : 0.109787
 BFGS TRUST (Bohr)    : 0.200000
 -------------------------------------------
 STEP OF ION RELAXATION : 2
 -------------------------------------------
 DONE(29.723532  SEC) : INIT SCF
 * * * * * *
 << Start SCF iteration.
 ITER      TMAG       AMAG        ETOT/eV          EDIFF/eV         DRHO     TIME/s
 GE1      1.30e+02   1.44e+02  -2.62544257e+05   0.00000000e+00   6.9903e-02  11.59
 GE2      3.99e+01   4.75e+01  -2.62587408e+05  -4.31505559e+01   2.4681e-01  10.15
 GE3      5.34e+01   6.24e+01  -2.62865581e+05  -2.78172764e+02   1.3146e-01  10.10
 GE4      4.89e+01   5.78e+01  -2.62894323e+05  -2.87427618e+01   1.3715e-01  10.12
 GE5      6.39e+01   7.36e+01  -2.63064097e+05  -1.69773192e+02   8.3735e-02  10.13
 GE6      5.97e+01   6.87e+01  -2.63047039e+05   1.70575782e+01   8.7927e-02  10.24
 GE7      6.88e+01   7.64e+01  -2.63083683e+05  -3.66437688e+01   6.7433e-02  10.12
 GE8      7.35e+01   8.12e+01  -2.63102855e+05  -1.91722415e+01   5.4760e-02  10.15
 GE9      7.45e+01   8.14e+01  -2.63126756e+05  -2.39011300e+01   5.5691e-02  10.18

And chg_extrap set to atomic, 1st or 2nd all seems to lead to this problem

For test and reproduce, I output a high-precision CHG file by SCF from 3.7.4 ABACUS, one can access via:

https://www.jianguoyun.com/p/DYH1Q3YQrZ-XCRjiqdMFIAA

And the file Fe5C2-slab-chg.tar.gz march this issue.

@YuLiu98 @mohanchen Any comments ?

@YuLiu98 YuLiu98 self-assigned this Aug 27, 2024
@YuLiu98
Copy link
Collaborator

YuLiu98 commented Aug 27, 2024

PBE have the same problem: COpbe-opt-down.tar.gz

I have tested this example using ABACUS v3.7.3 and v3.7.0. And I got the same result.

Note that I used C_gga_8au_100Ry_2s2p1d.orb and Fe_gga_9au_100Ry_4s2p2d1f.orb instead of C_gga_7au_100Ry_2s2p1d.orb and Fe_gga_8au_100Ry_4s2p2d1f.orb. It seems to be influenced by the orbitals.

@QuantumMisaka You can also test it using my files provided here: liuyu_test_first_order.tar.gz

@QuantumMisaka
Copy link
Collaborator Author

@YuLiu98 You can have more test for ABACUS in the commit 844e0e0

@YuLiu98
Copy link
Collaborator

YuLiu98 commented Aug 28, 2024

@YuLiu98 You can have more test for ABACUS in the commit 844e0e0

I have fixed this bug in PR #5007. Please feel free to follow it if you want.

And this is my test result for your example: liuyu_bug_fixed.tar.gz

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 a pull request may close this issue.

2 participants