Skip to content

Commit a36355c

Browse files
authored
Merge branch 'develop' into hotfix
2 parents 8c130a8 + 2b23c18 commit a36355c

File tree

17 files changed

+742
-327
lines changed

17 files changed

+742
-327
lines changed

source/Makefile.Objects

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,10 @@ OBJS_RELAXATION=bfgs_basic.o\
443443
lattice_change_methods.o\
444444
relax_old.o\
445445
relax.o\
446-
line_search.o\
447446
bfgs.o\
447+
lbfgs.o\
448+
matrix_methods.o\
449+
line_search.o\
448450

449451

450452
OBJS_SURCHEM=surchem.o\

source/module_hamilt_general/module_vdw/vdwd3_autoset_xcparam.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
#include "module_hamilt_general/module_vdw/vdwd3_parameters.h"
7070

7171
// DFT-D3(BJ)
72-
const std::map<std::string, std::vector<double>> bj = {
72+
const std::pair<const char*, std::vector<double>> bj_data[] = {
7373
{"__default__", {1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 14.0, 0.0}},
7474
{"bp", {1.0, 0.3946, 0.3946, 3.2822, 4.8516, 4.8516, 1.0, 14.0, 0.0}},
7575
{"blyp", {1.0, 0.4298, 0.4298, 2.6996, 4.2359, 4.2359, 1.0, 14.0, 0.0}},
@@ -230,8 +230,10 @@ const std::map<std::string, std::vector<double>> bj = {
230230
{"dodhsep86", {0.69, 0.0, 0.0, 0.0, 5.4, 5.4, 1.0, 14.0, 0.0}},
231231
{"dodpbehb95", {0.67, 0.0, 0.0, 0.0, 6.0, 6.0, 1.0, 14.0, 0.0}},
232232
};
233+
const std::map<std::string, std::vector<double>> bj = {std::begin(bj_data), std::end(bj_data)};
234+
233235
// DFT-D3(0)
234-
const std::map<std::string, std::vector<double>> zero = {
236+
const std::pair<const char*, std::vector<double>> zero_data[] = {
235237
{"__default__", {1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 14.0, 0.0}},
236238
{"slaterdirac", {1.0, 0.999, 0.999, -1.957, 0.697, 0.697, 1.0, 14.0, 0.0}},
237239
{"bp", {1.0, 1.139, 1.139, 1.683, 1.0, 1.0, 1.0, 14.0, 0.0}},
@@ -318,8 +320,10 @@ const std::map<std::string, std::vector<double>> zero = {
318320
{"mn15l", {1.0, 3.3388, 3.3388, 0.0, 1.0, 1.0, 1.0, 14.0, 0.0}},
319321
{"pwp", {1.0, 2.104, 2.104, 0.8747, 1.0, 1.0, 1.0, 14.0, 0.0}},
320322
};
323+
const std::map<std::string, std::vector<double>> zero = {std::begin(zero_data), std::end(zero_data)};
324+
321325
// DFT-D3M(BJ): not implemented for beta
322-
const std::map<std::string, std::vector<double>> bjm = {
326+
const std::pair<const char*, std::vector<double>> bjm_data[] = {
323327
{"__default__", {1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 14.0, 0.0}},
324328
{"bp", {1.0, 0.82185, 0.82185, 3.140281, 2.728151, 2.728151, 1.0, 14.0, 0.0}},
325329
{"blyp", {1.0, 0.448486, 0.448486, 1.875007, 3.610679, 3.610679, 1.0, 14.0, 0.0}},
@@ -330,8 +334,10 @@ const std::map<std::string, std::vector<double>> bjm = {
330334
{"b2plyp", {0.64, 0.486434, 0.486434, 0.67282, 3.656466, 3.656466, 1.0, 14.0, 0.0}},
331335
{"lcwpbe", {1.0, 0.563761, 0.563761, 0.906564, 3.59368, 3.59368, 1.0, 14.0, 0.0}},
332336
};
337+
const std::map<std::string, std::vector<double>> bjm = {std::begin(bjm_data), std::end(bjm_data)};
338+
333339
// DFT-D3M(0): not implemented for beta
334-
const std::map<std::string, std::vector<double>> zerom = {
340+
const std::pair<const char*, std::vector<double>> zerom_data[] = {
335341
{"__default__", {1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 14.0, 0.0}},
336342
{"bp", {1.0, 1.23346, 1.23346, 1.945174, 1.0, 1.0, 1.0, 14.0, 0.0}},
337343
{"blyp", {1.0, 1.279637, 1.279637, 1.841686, 1.0, 1.0, 1.0, 14.0, 0.01437}},
@@ -342,8 +348,10 @@ const std::map<std::string, std::vector<double>> zerom = {
342348
{"b2plyp", {0.64, 1.313134, 1.313134, 0.717543, 1.0, 1.0, 1.0, 14.0, 0.016035}},
343349
{"lcwpbe", {1.0, 1.366361, 1.366361, 1.280619, 1.0, 1.0, 1.0, 14.0, 0.00316}},
344350
};
351+
const std::map<std::string, std::vector<double>> zerom = {std::begin(zerom_data), std::end(zerom_data)};
352+
345353
// DFT-D3(OptimizedPower)
346-
const std::map<std::string, std::vector<double>> op = {
354+
const std::pair<const char*, std::vector<double>> op_data[] = {
347355
// {'s6', 'rs6', 'a1', 's8', 'rs8', 'a2', 's9', 'alp', 'bet'}
348356
{"__default__", {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 14.0, 0.0}},
349357
{"blyp", {1.0, 0.425, 0.425, 1.31867, 3.5, 3.5, 1.0, 14.0, 2.0}},
@@ -361,6 +369,7 @@ const std::map<std::string, std::vector<double>> op = {
361369
{"ms2", {1.0, 0.7, 0.7, 0.90743, 4.0, 4.0, 1.0, 14.0, 2.0}},
362370
{"ms2h", {1.0, 0.65, 0.65, 1.69464, 4.75, 4.75, 1.0, 14.0, 0.0}},
363371
};
372+
const std::map<std::string, std::vector<double>> op = {std::begin(op_data), std::end(op_data)};
364373

365374
std::vector<double> _search_impl(const std::string& xc,
366375
const std::map<std::string, std::vector<double>>& dict)

source/module_io/read_input_item_relax.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void ReadInput::item_relax()
1212
item.annotation = "cg; bfgs; sd; cg; cg_bfgs;";
1313
read_sync_string(input.relax_method);
1414
item.check_value = [](const Input_Item& item, const Parameter& para) {
15-
const std::vector<std::string> relax_methods = {"cg", "bfgs", "sd", "cg_bfgs","bfgs_trad"};
15+
const std::vector<std::string> relax_methods = {"cg", "bfgs", "sd", "cg_bfgs","bfgs_trad","lbfgs"};
1616
if (std::find(relax_methods.begin(),relax_methods.end(), para.input.relax_method)==relax_methods.end())
1717
{
1818
const std::string warningstr = nofound_str(relax_methods, "relax_method");

source/module_relax/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ add_library(
88
relax_new/line_search.cpp
99

1010
relax_old/bfgs.cpp
11+
relax_old/lbfgs.cpp
1112
relax_old/relax_old.cpp
1213
relax_old/bfgs_basic.cpp
1314
relax_old/ions_move_basic.cpp
@@ -18,6 +19,7 @@ add_library(
1819
relax_old/lattice_change_basic.cpp
1920
relax_old/lattice_change_cg.cpp
2021
relax_old/lattice_change_methods.cpp
22+
relax_old/matrix_methods.cpp
2123
)
2224

2325
if(ENABLE_COVERAGE)

source/module_relax/relax_driver.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
#include "module_cell/print_cell.h"
1313

1414
void Relax_Driver::relax_driver(ModuleESolver::ESolver* p_esolver, UnitCell& ucell)
15-
{
15+
{
1616
ModuleBase::TITLE("Ions", "opt_ions");
1717
ModuleBase::timer::tick("Ions", "opt_ions");
18-
1918
if (PARAM.inp.calculation == "relax" || PARAM.inp.calculation == "cell-relax" )
2019
{
2120
if (!PARAM.inp.relax_new)
@@ -27,7 +26,6 @@ void Relax_Driver::relax_driver(ModuleESolver::ESolver* p_esolver, UnitCell& uce
2726
rl.init_relax(ucell.nat);
2827
}
2928
}
30-
3129
this->istep = 1;
3230
int force_step = 1; // pengfei Li 2018-05-14
3331
int stress_step = 1;
@@ -90,7 +88,8 @@ void Relax_Driver::relax_driver(ModuleESolver::ESolver* p_esolver, UnitCell& uce
9088
force,
9189
stress,
9290
force_step,
93-
stress_step); // pengfei Li 2018-05-14
91+
stress_step,
92+
p_esolver); // pengfei Li 2018-05-14
9493
}
9594
// print structure
9695
// changelog 20240509

0 commit comments

Comments
 (0)