Skip to content

Bug: Geometry Optimization Problem in Li1Si64 example #3002

@QuantumMisaka

Description

@QuantumMisaka

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).

Metadata

Metadata

Assignees

Labels

BugsBugs that only solvable with sufficient knowledge of DFT

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions