Skip to content

Commit 2c6a855

Browse files
committed
update bfgs method
1 parent fbb27b3 commit 2c6a855

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

source/module_relax/relax_old/bfgs.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
void BFGS::allocate(const int _size) // initialize H0、H、pos0、force0、force
88
{
9-
alpha=70;
9+
alpha=70;//default value in ase is 70
1010
maxstep=PARAM.inp.relax_bfgs_rmax;
1111
size=_size;
1212
sign =true;
@@ -24,7 +24,7 @@ void BFGS::allocate(const int _size) // initialize H0、H、pos0、force0、forc
2424
steplength = std::vector<double>(size, 0.0);
2525
}
2626

27-
void BFGS::relax_step(ModuleBase::matrix& _force,UnitCell& ucell)
27+
void BFGS::relax_step(const ModuleBase::matrix _force,UnitCell& ucell)
2828
{
2929
GetPos(ucell,pos);
3030
GetPostaud(ucell,pos_taud);
@@ -359,7 +359,7 @@ void BFGS::IsRestrain(std::vector<std::vector<double>>& dpos)
359359
Ions_Move_Basic::converged = Ions_Move_Basic::largest_grad * ModuleBase::Ry_to_eV / 0.529177<PARAM.inp.force_thr_ev;
360360
}
361361

362-
void BFGS::CalculateLargestGrad(ModuleBase::matrix& _force,UnitCell& ucell)
362+
void BFGS::CalculateLargestGrad(const ModuleBase::matrix& _force,UnitCell& ucell)
363363
{
364364
std::vector<double> grad= std::vector<double>(3*size, 0.0);
365365
int iat = 0;

source/module_relax/relax_old/bfgs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ class BFGS
4949
* @param _size
5050
*/
5151
void allocate(const int _size);//initialize parameters
52-
void relax_step(ModuleBase::matrix& _force,UnitCell& ucell);//
52+
void relax_step(const ModuleBase::matrix _force,UnitCell& ucell);//
5353
void PrepareStep(std::vector<std::vector<double>>& force,std::vector<std::vector<double>>& pos,std::vector<std::vector<double>>& H,std::vector<double>& pos0,std::vector<double>& force0,std::vector<double>& steplength,std::vector<std::vector<double>>& dpos,UnitCell& ucell);
5454
void IsRestrain(std::vector<std::vector<double>>& dpos);
5555

5656
private:
5757
bool sign;
5858

59-
void CalculateLargestGrad(ModuleBase::matrix& _force,UnitCell& ucell);
59+
void CalculateLargestGrad(const ModuleBase::matrix& _force,UnitCell& ucell);
6060
void GetPos(UnitCell& ucell,std::vector<std::vector<double>>& pos);
6161
void GetPostaud(UnitCell& ucell,std::vector<std::vector<double>>& pos_taud);
6262
void Update(std::vector<double>& pos, std::vector<double>& force,std::vector<std::vector<double>>& H,UnitCell& ucell);

0 commit comments

Comments
 (0)