Skip to content

Commit e394d58

Browse files
committed
update bfgs method
1 parent d0bd693 commit e394d58

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,7 @@ These variables are used to control the geometry relaxation.
13651365
- **Description**: The methods to do geometry optimization.
13661366
- cg: using the conjugate gradient (CG) algorithm. Note that there are two implementations of the conjugate gradient (CG) method, see [relax_new](#relax_new).
13671367
- bfgs: using the Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm.
1368+
- bfgs_trad: using the BFGS algorithm with logic consistent with the BFGS in ASE.
13681369
- cg_bfgs: using the CG method for the initial steps, and switching to BFGS method when the force convergence is smaller than [relax_cg_thr](#relax_cg_thr).
13691370
- sd: using the steepest descent (SD) algorithm.
13701371
- fire: the Fast Inertial Relaxation Engine method (FIRE), a kind of molecular-dynamics-based relaxation algorithm, is implemented in the molecular dynamics (MD) module. The algorithm can be used by setting [calculation](#calculation) to `md` and [md_type](#md_type) to `fire`. Also ionic velocities should be set in this case. See [fire](../md.md#fire) for more details.

docs/advanced/opt.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ The [BFGS method](https://en.wikipedia.org/wiki/Broyden%E2%80%93Fletcher%E2%80%9
2424

2525
In ABACUS, we implemented the BFGS method for doing fixed-cell structural relaxation.
2626

27+
### BFGS_TRAD method
28+
29+
The BFGS_TRAD method is an algorithm implemented in ABACUS, referencing the BFGS method from ASE. The previous BFGS method in Abacus did not perform well for some tests and the updated BFGS_TRAD method now produces results that are consistent with the BFGS method in ASE. In cases where the previous BFGS method could not converge within a limited number of steps, the BFGS_TRAD method can successfully converge.
30+
2731
### SD method
2832

2933
The [SD (steepest descent) method](https://en.wikipedia.org/wiki/Gradient_descent) is one of the simplest first-order optimization methods, where in each step the motion is along the direction of the gradient, where the function descents the fastest.

source/module_relax/relax_old/bfgs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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(ModuleBase::matrix& _force,UnitCell& ucell)
2828
{
2929
GetPos(ucell,pos);
3030
GetPostaud(ucell,pos_taud);

source/module_relax/relax_old/bfgs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ 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(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

0 commit comments

Comments
 (0)