Skip to content

Commit cc0b5ed

Browse files
committed
bfgs_trad
1 parent a02316b commit cc0b5ed

File tree

3 files changed

+8
-26
lines changed

3 files changed

+8
-26
lines changed

source/module_relax/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ add_library(
1818
relax_old/lattice_change_basic.cpp
1919
relax_old/lattice_change_cg.cpp
2020
relax_old/lattice_change_methods.cpp
21-
2221
)
2322

2423
if(ENABLE_COVERAGE)

source/module_relax/relax_driver.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ void Relax_Driver::relax_driver(ModuleESolver::ESolver* p_esolver)
1616

1717
if (PARAM.inp.calculation == "relax" || PARAM.inp.calculation == "cell-relax" )
1818
{
19-
/*if(PARAM.inp.relax_method=="bfgs_trad")
20-
{
21-
bfgs_trad.allocate(GlobalC::ucell.nat);
22-
}
23-
else*/ if (!PARAM.inp.relax_new)
19+
if (!PARAM.inp.relax_new)
2420
{
2521
rl_old.init_relax(GlobalC::ucell.nat);
2622
}
@@ -30,7 +26,6 @@ void Relax_Driver::relax_driver(ModuleESolver::ESolver* p_esolver)
3026
}
3127
}
3228

33-
3429
this->istep = 1;
3530
int force_step = 1; // pengfei Li 2018-05-14
3631
int stress_step = 1;
@@ -82,12 +77,7 @@ void Relax_Driver::relax_driver(ModuleESolver::ESolver* p_esolver)
8277

8378
if (PARAM.inp.calculation == "relax" || PARAM.inp.calculation == "cell-relax")
8479
{
85-
/*if(PARAM.inp.relax_method == "bfgs_trad")
86-
{
87-
stop=bfgs_trad.relax_step(force,GlobalC::ucell);
88-
}
89-
90-
else*/ if (PARAM.inp.relax_new)
80+
if (PARAM.inp.relax_new)
9181
{
9282
stop = rl.relax_step(force, stress, this->etot);
9383
}
@@ -100,9 +90,7 @@ void Relax_Driver::relax_driver(ModuleESolver::ESolver* p_esolver)
10090
stress,
10191
force_step,
10292
stress_step); // pengfei Li 2018-05-14
103-
}
104-
105-
93+
}
10694
// print structure
10795
// changelog 20240509
10896
// because I move out the dependence on GlobalV from UnitCell::print_stru_file

source/module_relax/relax_old/bfgs.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,9 @@ void BFGS::allocate(const int _size) // initialize H0、H、pos0、force0、forc
3333

3434
void BFGS::relax_step(ModuleBase::matrix _force,UnitCell& ucell)
3535
{
36-
std::cout<<"enter Step"<<std::endl;
37-
if(sign)
38-
{
39-
40-
}
41-
std::cout<<"enter Step1"<<std::endl;
36+
//std::cout<<"enter Step"<<std::endl;
4237
ucell.ionic_position_updated = true;
43-
for(int i = 0; i < _force.nr; i++)
38+
/*for(int i = 0; i < _force.nr; i++)
4439
{
4540
4641
for(int j=0;j<_force.nc;j++)
@@ -49,15 +44,15 @@ void BFGS::relax_step(ModuleBase::matrix _force,UnitCell& ucell)
4944
std::cout<<force[i][j]<<' ';
5045
}
5146
std::cout<<std::endl;
52-
}
47+
}*/
5348
//std::cout<<"enter Step0"<<std::endl;
5449
//std::cout<<size<<std::endl;
5550
//GetPos(ucell);
5651
this->PrepareStep(force,pos,H,pos0,force0,steplength,dpos);
5752
//std::cout<<"enter Step1"<<std::endl;
5853
this->DetermineStep(steplength,dpos,maxstep);
5954

60-
std::cout<<"enter Step2"<<std::endl;
55+
//std::cout<<"enter Step2"<<std::endl;
6156
/*for(int i=0;i<size;i++)
6257
{
6358
for(int j=0;j<3;j++)
@@ -289,7 +284,7 @@ void BFGS::IsRestrain(std::vector<std::vector<double>>& dpos)
289284
}
290285
}
291286
}
292-
std::cout<<a<<std::endl;
287+
//std::cout<<a<<std::endl;
293288
Ions_Move_Basic::converged = a<0.00001;
294289
}
295290
// matrix methods

0 commit comments

Comments
 (0)