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

Implement a new BFGS optimizer, used for geometry relaxation #5467

Merged
merged 31 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cf1d4cf
bfgs
19hello Nov 12, 2024
710c6ce
bfgs1
19hello Nov 12, 2024
37461e5
Update bfgs method
19hello Nov 15, 2024
8baf4e8
Merge branch 'develop' of https://gitee.com/deepmodeling/abacus-devel…
19hello Nov 15, 2024
1899f53
bfgs_trad
19hello Nov 15, 2024
2c4cb0a
new bfgs method
19hello Nov 15, 2024
e5c4282
new bfgs_trad method
19hello Nov 15, 2024
97211a5
new bfgs_trad
19hello Nov 17, 2024
12f8b4a
Merge branch 'develop' into mybfgs
19hello Nov 17, 2024
39f9cb1
bfgs2
19hello Nov 17, 2024
ef98545
bfgs_trad3
19hello Nov 17, 2024
d8dfacb
bfgs_trad2
19hello Nov 18, 2024
af4ea04
bfgs_trad
19hello Nov 18, 2024
7bb9786
bfgs_trad
19hello Nov 18, 2024
4c75875
bfgs_trad
19hello Nov 18, 2024
978dae0
Merge branch 'develop' into mybfgs
19hello Nov 18, 2024
d5b1c14
bfgs_trad
19hello Nov 18, 2024
e2c386f
Merge branch 'mybfgs' of https://github.com/19hello/myrepo into mybfgs
19hello Nov 18, 2024
73a8136
bfgs_trad
19hello Nov 18, 2024
ca6e24e
Merge branch 'develop' of https://github.com/deepmodeling/abacus-deve…
19hello Nov 19, 2024
a02316b
bfgs_trad
19hello Nov 19, 2024
cc0b5ed
bfgs_trad
19hello Nov 20, 2024
55ee2c0
bfgs_trad
19hello Nov 20, 2024
8e9f2d8
bfgs_trad
19hello Nov 20, 2024
9c3c405
bfgs_trad
19hello Nov 21, 2024
caac72a
Use force_ev_thr to judge optimization
19hello Nov 23, 2024
12d607e
remove 108_PW_RE_MB_NEW
19hello Nov 25, 2024
c4a9719
Add determine whether an atom is movable code and modify the value of…
19hello Nov 29, 2024
7166b1b
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Nov 29, 2024
f12109b
bfgs_trad
19hello Dec 1, 2024
d0bd693
Merge branch 'mybfgs' of https://github.com/19hello/myrepo into mybfgs1
19hello Dec 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ OBJS_RELAXATION=bfgs_basic.o\
relax_old.o\
relax.o\
line_search.o\
bfgs.o\


OBJS_SURCHEM=surchem.o\
H_correction_pw.o\
Expand Down
4 changes: 2 additions & 2 deletions source/module_io/read_input_item_relax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ void ReadInput::item_relax()
item.annotation = "cg; bfgs; sd; cg; cg_bfgs;";
read_sync_string(input.relax_method);
item.check_value = [](const Input_Item& item, const Parameter& para) {
const std::vector<std::string> relax_methods = {"cg", "bfgs", "sd", "cg_bfgs"};
if (std::find(relax_methods.begin(), relax_methods.end(), para.input.relax_method) == relax_methods.end())
const std::vector<std::string> relax_methods = {"cg", "bfgs", "sd", "cg_bfgs","bfgs_trad"};
kirk0830 marked this conversation as resolved.
Show resolved Hide resolved
if (std::find(relax_methods.begin(),relax_methods.end(), para.input.relax_method)==relax_methods.end())
{
const std::string warningstr = nofound_str(relax_methods, "relax_method");
ModuleBase::WARNING_QUIT("ReadInput", warningstr);
Expand Down
6 changes: 4 additions & 2 deletions source/module_relax/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ add_library(

relax_new/relax.cpp
relax_new/line_search.cpp


relax_old/bfgs.cpp
relax_old/relax_old.cpp
relax_old/bfgs_basic.cpp
relax_old/ions_move_basic.cpp
Expand All @@ -27,5 +28,6 @@ if(BUILD_TESTING)
if(ENABLE_MPI)
add_subdirectory(relax_new/test)
add_subdirectory(relax_old/test)
endif()
endif()

endif()
6 changes: 3 additions & 3 deletions source/module_relax/relax_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void Relax_Driver::relax_driver(ModuleESolver::ESolver* p_esolver)
ModuleBase::TITLE("Ions", "opt_ions");
ModuleBase::timer::tick("Ions", "opt_ions");

if (PARAM.inp.calculation == "relax" || PARAM.inp.calculation == "cell-relax")
if (PARAM.inp.calculation == "relax" || PARAM.inp.calculation == "cell-relax" )
{
if (!PARAM.inp.relax_new)
{
Expand All @@ -25,7 +25,7 @@ void Relax_Driver::relax_driver(ModuleESolver::ESolver* p_esolver)
rl.init_relax(GlobalC::ucell.nat);
}
}

this->istep = 1;
int force_step = 1; // pengfei Li 2018-05-14
int stress_step = 1;
Expand Down Expand Up @@ -90,7 +90,7 @@ void Relax_Driver::relax_driver(ModuleESolver::ESolver* p_esolver)
stress,
force_step,
stress_step); // pengfei Li 2018-05-14
}
}
// print structure
// changelog 20240509
// because I move out the dependence on GlobalV from UnitCell::print_stru_file
Expand Down
6 changes: 5 additions & 1 deletion source/module_relax/relax_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "module_esolver/esolver_ks.h"
#include "relax_new/relax.h"
#include "relax_old/relax_old.h"

#include "relax_old/bfgs.h"
class Relax_Driver
{

Expand All @@ -26,6 +26,10 @@ class Relax_Driver

// old relaxation method
Relax_old rl_old;

BFGS bfgs_trad;


};

#endif
5 changes: 3 additions & 2 deletions source/module_relax/relax_new/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ AddTest(

AddTest(
TARGET relax_new_relax
SOURCES relax_test.cpp ../relax.cpp ../line_search.cpp ../../../module_base/tool_quit.cpp ../../../module_base/global_variable.cpp ../../../module_base/global_file.cpp ../../../module_base/memory.cpp ../../../module_base/timer.cpp
SOURCES relax_test.cpp ../relax.cpp ../line_search.cpp ../../../module_base/tool_quit.cpp ../../../module_base/global_variable.cpp ../../../module_base/global_file.cpp ../../../module_base/memory.cpp ../../../module_base/timer.cpp
../../../module_base/matrix3.cpp ../../../module_base/intarray.cpp ../../../module_base/tool_title.cpp
../../../module_base/global_function.cpp ../../../module_base/complexmatrix.cpp ../../../module_base/matrix.cpp
../../../module_base/complexarray.cpp ../../../module_base/tool_quit.cpp ../../../module_base/realarray.cpp ../../../module_base/blas_connector.cpp
LIBS parameter ${math_libs}
)
)

Loading
Loading