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: Geometry Optimization Problem in Li1Si64 example #3002

Closed
7 of 16 tasks
QuantumMisaka opened this issue Sep 21, 2023 · 5 comments
Closed
7 of 16 tasks

Bug: Geometry Optimization Problem in Li1Si64 example #3002

QuantumMisaka opened this issue Sep 21, 2023 · 5 comments
Assignees
Labels
Bug Report (Exclude input and output) Bugs that only solvable with sufficient knowledge of DFT

Comments

@QuantumMisaka
Copy link

QuantumMisaka commented Sep 21, 2023

Describe the bug

In ABACUS Catalysis Practice Notebook:
https://nb.bohrium.dp.tech/detail/6316830243
The NEB example need to first do relax calculation for initial and final state

But for intial state in this example , when use CG method ,the force will be in flux:

 LARGEST GRAD (eV/A)  : 5.285e-02
 LARGEST GRAD (eV/A)  : 1.397e-01
 LARGEST GRAD (eV/A)  : 1.386e-01
 LARGEST GRAD (eV/A)  : 1.194e-01
 LARGEST GRAD (eV/A)  : 8.415e-02
 LARGEST GRAD (eV/A)  : 8.968e-02
 LARGEST GRAD (eV/A)  : 9.033e-02
 LARGEST GRAD (eV/A)  : 8.701e-02
 LARGEST GRAD (eV/A)  : 1.890e-01
 LARGEST GRAD (eV/A)  : 1.575e-01
 LARGEST GRAD (eV/A)  : 2.278e-01
 LARGEST GRAD (eV/A)  : 2.208e-01
 LARGEST GRAD (eV/A)  : 6.767e-01
 LARGEST GRAD (eV/A)  : 3.907e-01
 LARGEST GRAD (eV/A)  : 1.291e+00
 LARGEST GRAD (eV/A)  : 1.225e+00
 LARGEST GRAD (eV/A)  : 1.027e+00
 LARGEST GRAD (eV/A)  : 3.355e-01
 LARGEST GRAD (eV/A)  : 1.739e+00
 LARGEST GRAD (eV/A)  : 1.769e+00
 LARGEST GRAD (eV/A)  : 1.859e+00
 LARGEST GRAD (eV/A)  : 1.244e+00
 LARGEST GRAD (eV/A)  : 6.014e-01
 LARGEST GRAD (eV/A)  : 4.632e-01
 LARGEST GRAD (eV/A)  : 6.680e-01
 LARGEST GRAD (eV/A)  : 5.251e-01
 LARGEST GRAD (eV/A)  : 1.132e+00
 LARGEST GRAD (eV/A)  : 6.121e-01
 LARGEST GRAD (eV/A)  : 2.150e+00
 LARGEST GRAD (eV/A)  : 7.361e-01

And when use BFGS, the force will also fluctuate

 LARGEST GRAD (eV/A)  : 5.285e-02
 LARGEST GRAD (eV/A)  : 1.397e-01
 LARGEST GRAD (eV/A)  : 1.386e-01
 LARGEST GRAD (eV/A)  : 1.194e-01
 LARGEST GRAD (eV/A)  : 8.415e-02
 LARGEST GRAD (eV/A)  : 8.968e-02
 LARGEST GRAD (eV/A)  : 9.033e-02
 LARGEST GRAD (eV/A)  : 8.701e-02
 LARGEST GRAD (eV/A)  : 1.890e-01
 LARGEST GRAD (eV/A)  : 1.575e-01
 LARGEST GRAD (eV/A)  : 2.278e-01
 LARGEST GRAD (eV/A)  : 2.208e-01
 LARGEST GRAD (eV/A)  : 6.767e-01
 LARGEST GRAD (eV/A)  : 3.907e-01
 LARGEST GRAD (eV/A)  : 1.291e+00
 LARGEST GRAD (eV/A)  : 1.225e+00
 LARGEST GRAD (eV/A)  : 1.027e+00
 LARGEST GRAD (eV/A)  : 3.355e-01
 LARGEST GRAD (eV/A)  : 1.739e+00
 LARGEST GRAD (eV/A)  : 1.769e+00
 LARGEST GRAD (eV/A)  : 1.859e+00
 LARGEST GRAD (eV/A)  : 1.244e+00
 LARGEST GRAD (eV/A)  : 6.014e-01
 LARGEST GRAD (eV/A)  : 4.632e-01
 LARGEST GRAD (eV/A)  : 6.680e-01
 LARGEST GRAD (eV/A)  : 5.251e-01
 LARGEST GRAD (eV/A)  : 1.132e+00
 LARGEST GRAD (eV/A)  : 6.121e-01
 LARGEST GRAD (eV/A)  : 2.150e+00

and then break down:

 trust radius is too small! Break down.
 CHECK IN FILE : OUT.ABACUS/warning.log

But when use ASE-ABACUS to do optimization, force will normally converge

      Step     Time          Energy          fmax
BFGS:    0 13:51:20    -7073.123389         0.063117
BFGS:    1 13:52:37    -7073.123735         0.051192
BFGS:    2 13:53:49    -7073.124284         0.031589

The related files:
initial_stru_opt.tar.gz

likely problem
#2974

Expected behavior

The geometry relax job should be normally done by ABACUS itself within 3 steps like ASE-ABACUS do

To Reproduce

Download example, run it by ABACUS

Environment

  • ABACUS version: 3.3.4
  • Dependencies: Intel-OneAPI, ELPA, libxc
  • System: AMD-3950x, Ubuntu 20.04 - WSL2
  • Running: OMP_NUM_THREADS=16 mpirun -np 1 abacus

Additional Context

for ase-abacus, the optimization code is part of NEB code, so copy that and past here:

import os 
from ase.calculators.abacus import Abacus, AbacusProfile
from ase.optimize import FIRE, BFGS, QuasiNewton
from ase.io import read, write
#from pathlib import Path

# set pythonpath: not useful
# ROOTPATH=os.path.abspath("../..")
# os.environ['PYTHONPATH'] = f'{ROOTPATH}'

from abacus_neb import AbacusNEB

# setting
# optimizer = FIRE # suited for CI-NEB
optimizer = BFGS
init_directory = "INIT"
final_directory = "FINAL"
neb_directory = "OUT"
algorism = "improvedtangent" # IT-NEB is recommended
#dyneb=True  # default
interpolate = "linear" # linear or idpp
climb = True
n_max = 7
mpi = 1
omp = 16
abacus = 'abacus'
# example_dir = "/lustre/home/2201110432/example/abacus"
# pseudo_dir = f"{example_dir}/PP"
# basis_dir = f"{example_dir}/ORB"
pseudo_dir = "./src"
basis_dir = "./src"
pp = {"Li": "Li_ONCV_PBE-1.2.upf",
        "Si": "Si_ONCV_PBE-1.2.upf", }
basis = {"Li": "Li_gga_8au_100Ry_4s1p.orb",
            "Si": "Si_gga_8au_100Ry_2s2p1d.orb"}
kpts = [2, 2, 2]
parameters = {
    'calculation': 'scf',
    'xc': 'pbe',
    'ecutwfc': 100,
    'smearing_method': 'gaussian',
    'smearing_sigma': 0.002,
    'basis_type': 'lcao',
    'ks_solver': 'genelpa',
    'mixing_type': 'pulay',
    'scf_thr': 1e-6,
    'scf_nmax': 300,
    'out_chg': 1,
    'out_bandgap': 1,
    'kpts': kpts,
    'pp': pp,
    'basis': basis,
    'pseudo_dir': pseudo_dir,
    'basis_dir': basis_dir,
    'vdw_method': 'd3_bj',
    'cal_force': 1,
    'cal_stress': 1,
    'out_stru': 1,
    'out_chg': 0,
    'out_bandgap': 0,
}

os.environ['OMP_NUM_THREADS'] = f'{omp}'
profile = AbacusProfile(
    argv=['mpirun', '-np', f'{mpi}', abacus])

# Initial stru read from ABACUS, should do single point calculation
initial = read('./initial_stru', format='abacus')

# relax calculation by abacus
initial.calc = Abacus(profile=profile, directory=init_directory,
                     **parameters)
qn_init = optimizer(initial, trajectory='init_opt.traj')
qn_init.run(fmax=0.05)

Task list for Issue attackers

  • 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 added the Bug Report (Exclude input and output) Bugs that only solvable with sufficient knowledge of DFT label Sep 21, 2023
@QuantumMisaka QuantumMisaka changed the title Geometry Optimization Problem in Li1Si32 example in Colomb Academy Geometry Optimization Problem in Li1Si64 example in Colomb Academy Sep 21, 2023
@QuantumMisaka
Copy link
Author

Tried PW method in the advice of @kirk0830 ,BFGS will converge in 5 steps, CG will converge in 2 steps

initial_stru_opt_pw.tar.gz

It seems to be a LCAO problem in relax ?

Also, if turn of vdw_method d3, the force will directly below 0.05 eV/A and converge

@kirk0830
Copy link
Collaborator

#2974

@hongriTianqi
Copy link
Collaborator

@QuantumMisaka Do you have more updates on this issue?

@QuantumMisaka
Copy link
Author

@QuantumMisaka Do you have more updates on this issue?

no more now

@QuantumMisaka QuantumMisaka changed the title Geometry Optimization Problem in Li1Si64 example in Colomb Academy Bug: Geometry Optimization Problem in Li1Si64 example Nov 3, 2023
@LiuXiaohui123321 LiuXiaohui123321 self-assigned this Nov 6, 2023
@pxlxingliang
Copy link
Collaborator

Hi, @QuantumMisaka, the bug in BFGS have been fixed in #3658
I have used the latest codes to run this example, and it can be converged in 9 ION steps.

https://app.bohrium.dp.tech/abacustest/?request=GET%3A%2Fapplications%2Fabacustest%2Fjobs%2Fjob-abacustest-v0.3.106-02c2bf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report (Exclude input and output) Bugs that only solvable with sufficient knowledge of DFT
Projects
None yet
Development

No branches or pull requests

6 participants