Implements L-BFGS optimization algorithm for structural relaxation.
More...
#include <lbfgs.h>
|
void | prepare_step (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< std::vector< double > > &dpos, UnitCell &ucell, const double &etot) |
| Prepare optimization step parameters.
|
|
void | is_restrain (std::vector< std::vector< double > > &dpos) |
| Judge if the cell is restrain.
|
|
void | calculate_largest_grad (const ModuleBase::matrix &_force, UnitCell &ucell) |
| Calculate maximum gradient component.
|
|
void | get_pos (UnitCell &ucell, std::vector< std::vector< double > > &pos) |
| Extract atomic positions from unit cell.
|
|
void | get_pos_taud (UnitCell &ucell, std::vector< std::vector< double > > &pos_taud) |
| Get fractional positions from unit cell.
|
|
void | update (std::vector< std::vector< double > > &pos_taud, std::vector< double > &pos_taud0, std::vector< double > &force, std::vector< double > &force0, UnitCell &ucell, int iteration, int memory, std::vector< std::vector< double > > &s, std::vector< std::vector< double > > &y, std::vector< double > &rho) |
| Update L-BFGS history buffers.
|
|
void | determine_step (std::vector< double > &steplength, std::vector< std::vector< double > > &dpos, double &maxstep) |
| Determine optimal step lengths.
|
|
void | update_pos (UnitCell &ucell) |
| Update atomic positions in unit cell.
|
|
|
double | alpha |
| Initial Hessian diagonal element.
|
|
double | maxstep |
| Maximum allowed step length.
|
|
int | size |
| Number of atoms in system.
|
|
int | memory |
| Number of previous steps to store.
|
|
double | H0 |
| Initial inverse Hessian approximation.
|
|
int | iteration |
| Current iteration count.
|
|
double | energy |
| Current system energy.
|
|
double | alpha_k |
| Step size parameter.
|
|
ModuleESolver::ESolver * | solver |
| Structure solver.
|
|
std::vector< std::vector< double > > | H |
| Inverse Hessian approximation.
|
|
std::vector< double > | force0 |
| Previous step forces.
|
|
std::vector< std::vector< double > > | force |
| Force history.
|
|
std::vector< double > | pos0 |
| Previous positions.
|
|
std::vector< std::vector< double > > | pos |
| Position history.
|
|
std::vector< double > | pos_taud0 |
| Previous fractional positions.
|
|
std::vector< std::vector< double > > | pos_taud |
| Fractional position history.
|
|
std::vector< std::vector< double > > | dpos |
| Position displacements.
|
|
std::vector< std::vector< double > > | s |
| Position difference vectors.
|
|
std::vector< std::vector< double > > | y |
| Force difference vectors.
|
|
std::vector< double > | rho |
| Scalar products for L-BFGS update.
|
|
std::vector< double > | steplength |
| Step lengths for each atom.
|
|
Implements L-BFGS optimization algorithm for structural relaxation.
◆ allocate()
void LBFGS::allocate |
( |
const int |
_size | ) |
|
Initialize L-BFGS parameters.
- Parameters
-
_size | Number of atoms in system |
◆ calculate_largest_grad()
Calculate maximum gradient component.
- Parameters
-
_force | Current force matrix |
ucell | Unit cell being optimized |
◆ determine_step()
void LBFGS::determine_step |
( |
std::vector< double > & |
steplength, |
|
|
std::vector< std::vector< double > > & |
dpos, |
|
|
double & |
maxstep |
|
) |
| |
|
private |
Determine optimal step lengths.
- Parameters
-
steplength | Output step lengths |
dpos | Position displacements |
maxstep | Maximum allowed step length |
◆ get_pos()
void LBFGS::get_pos |
( |
UnitCell & |
ucell, |
|
|
std::vector< std::vector< double > > & |
pos |
|
) |
| |
|
private |
Extract atomic positions from unit cell.
- Parameters
-
ucell | Unit cell to read |
pos | Output position vector |
◆ get_pos_taud()
void LBFGS::get_pos_taud |
( |
UnitCell & |
ucell, |
|
|
std::vector< std::vector< double > > & |
pos_taud |
|
) |
| |
|
private |
Get fractional positions from unit cell.
- Parameters
-
ucell | Unit cell to read |
pos_taud | Output fractional positions |
◆ is_restrain()
void LBFGS::is_restrain |
( |
std::vector< std::vector< double > > & |
dpos | ) |
|
|
private |
Judge if the cell is restrain.
- Parameters
-
dpos | Position displacements to constrain |
◆ prepare_step()
void LBFGS::prepare_step |
( |
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< std::vector< double > > & |
dpos, |
|
|
UnitCell & |
ucell, |
|
|
const double & |
etot |
|
) |
| |
|
private |
Prepare optimization step parameters.
◆ relax_step()
Perform one L-BFGS relaxation step.
- Parameters
-
_force | Current force |
ucell | Unit cell to optimize |
etot | Current total energy |
p_esolver | Structure solver |
◆ update()
void LBFGS::update |
( |
std::vector< std::vector< double > > & |
pos_taud, |
|
|
std::vector< double > & |
pos_taud0, |
|
|
std::vector< double > & |
force, |
|
|
std::vector< double > & |
force0, |
|
|
UnitCell & |
ucell, |
|
|
int |
iteration, |
|
|
int |
memory, |
|
|
std::vector< std::vector< double > > & |
s, |
|
|
std::vector< std::vector< double > > & |
y, |
|
|
std::vector< double > & |
rho |
|
) |
| |
|
private |
Update L-BFGS history buffers.
- Parameters
-
pos_taud | Current fractional positions |
pos_taud0 | Previous fractional positions |
force | Current forces |
force0 | Previous forces |
ucell | Unit cell being optimized |
iteration | Current step number |
memory | History buffer size |
s | Position differences buffer |
y | Force differences buffer |
rho | Scalar products buffer |
◆ update_pos()
void LBFGS::update_pos |
( |
UnitCell & |
ucell | ) |
|
|
private |
Update atomic positions in unit cell.
- Parameters
-
◆ alpha
Initial Hessian diagonal element.
◆ alpha_k
◆ dpos
std::vector<std::vector<double> > LBFGS::dpos |
|
private |
◆ energy
◆ force
std::vector<std::vector<double> > LBFGS::force |
|
private |
◆ force0
std::vector<double> LBFGS::force0 |
|
private |
std::vector<std::vector<double> > LBFGS::H |
|
private |
Inverse Hessian approximation.
◆ H0
Initial inverse Hessian approximation.
◆ iteration
◆ maxstep
Maximum allowed step length.
◆ memory
Number of previous steps to store.
◆ pos
std::vector<std::vector<double> > LBFGS::pos |
|
private |
◆ pos0
std::vector<double> LBFGS::pos0 |
|
private |
◆ pos_taud
std::vector<std::vector<double> > LBFGS::pos_taud |
|
private |
Fractional position history.
◆ pos_taud0
std::vector<double> LBFGS::pos_taud0 |
|
private |
Previous fractional positions.
◆ rho
std::vector<double> LBFGS::rho |
|
private |
Scalar products for L-BFGS update.
std::vector<std::vector<double> > LBFGS::s |
|
private |
Position difference vectors.
◆ size
Number of atoms in system.
◆ solver
◆ steplength
std::vector<double> LBFGS::steplength |
|
private |
Step lengths for each atom.
std::vector<std::vector<double> > LBFGS::y |
|
private |
Force difference vectors.
The documentation for this class was generated from the following files:
- /home/runner/work/abacus-develop/abacus-develop/source/source_relax/lbfgs.h
- /home/runner/work/abacus-develop/abacus-develop/source/source_relax/lbfgs.cpp