Implements L-BFGS optimization algorithm for structural relaxation.
More...
#include <ions_move_lbfgs.h>
|
| void | prepare_step (std::vector< ModuleBase::Vector3< double > > &force, std::vector< ModuleBase::Vector3< double > > &pos, std::vector< std::vector< double > > &H, std::vector< double > &pos0, std::vector< double > &force0, std::vector< ModuleBase::Vector3< double > > &dpos, UnitCell &ucell, const double &etot) |
| | Prepare optimization step parameters.
|
| bool | is_restrain (const Relax_Criteria &criteria) |
| | Judge if the relaxation has converged.
|
| void | calculate_largest_grad (const ModuleBase::matrix &_force, UnitCell &ucell) |
| | Calculate maximum gradient component.
|
| void | get_pos (UnitCell &ucell, std::vector< ModuleBase::Vector3< double > > &pos) |
| | Extract atomic positions from unit cell.
|
| void | get_pos_taud (UnitCell &ucell, std::vector< ModuleBase::Vector3< double > > &pos_taud) |
| | Get fractional positions from unit cell.
|
| void | update (std::vector< ModuleBase::Vector3< 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< ModuleBase::Vector3< double > > &dpos, double &maxstep) |
| | Determine optimal step lengths.
|
| void | update_pos (UnitCell &ucell) |
| | Update atomic positions in unit cell.
|
Implements L-BFGS optimization algorithm for structural relaxation.
◆ allocate()
| void Ions_Move_LBFGS::allocate |
( |
const int | _size, |
|
|
const double | relax_bfgs_rmax, |
|
|
const std::string & | out_level ) |
Initialize L-BFGS parameters.
- Parameters
-
| _size | Number of atoms in system |
| relax_bfgs_rmax | Maximum allowed step length (from INPUT) |
| out_level | Output verbosity level (from INPUT) |
◆ calculate_largest_grad()
Calculate maximum gradient component.
- Parameters
-
| _force | Current force matrix |
| ucell | Unit cell being optimized |
◆ determine_step()
| void Ions_Move_LBFGS::determine_step |
( |
std::vector< double > & | steplength, |
|
|
std::vector< ModuleBase::Vector3< double > > & | dpos, |
|
|
double & | maxstep ) |
|
private |
Determine optimal step lengths.
- Parameters
-
| steplength | Output step lengths |
| dpos | Position displacements |
| maxstep | Maximum allowed step length |
◆ get_pos()
Extract atomic positions from unit cell.
- Parameters
-
| ucell | Unit cell to read |
| pos | Output position vector |
◆ get_pos_taud()
Get fractional positions from unit cell.
- Parameters
-
| ucell | Unit cell to read |
| pos_taud | Output fractional positions |
◆ is_restrain()
Judge if the relaxation has converged.
- Parameters
-
| criteria | Convergence thresholds passed from the driver |
- Returns
- true if converged, false otherwise
◆ prepare_step()
| void Ions_Move_LBFGS::prepare_step |
( |
std::vector< ModuleBase::Vector3< double > > & | force, |
|
|
std::vector< ModuleBase::Vector3< double > > & | pos, |
|
|
std::vector< std::vector< double > > & | H, |
|
|
std::vector< double > & | pos0, |
|
|
std::vector< double > & | force0, |
|
|
std::vector< ModuleBase::Vector3< 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 |
| ofs_running | Output stream for running log |
◆ update()
| void Ions_Move_LBFGS::update |
( |
std::vector< ModuleBase::Vector3< 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 Ions_Move_LBFGS::update_pos |
( |
UnitCell & | ucell | ) |
|
|
private |
Update atomic positions in unit cell.
- Parameters
-
◆ alpha
| double Ions_Move_LBFGS::alpha |
|
private |
Initial Hessian diagonal element.
◆ alpha_k
| double Ions_Move_LBFGS::alpha_k |
|
private |
◆ dpos
◆ energy
| double Ions_Move_LBFGS::energy |
|
private |
◆ force
◆ force0
| std::vector<double> Ions_Move_LBFGS::force0 |
|
private |
| std::vector<std::vector<double> > Ions_Move_LBFGS::H |
|
private |
◆ H0
| double Ions_Move_LBFGS::H0 |
|
private |
Initial inverse Hessian approximation.
◆ iteration
| int Ions_Move_LBFGS::iteration |
|
private |
◆ maxstep
| double Ions_Move_LBFGS::maxstep |
|
private |
Maximum allowed step length.
◆ memory
| int Ions_Move_LBFGS::memory |
|
private |
Number of previous steps to store.
◆ out_level
| std::string Ions_Move_LBFGS::out_level |
|
private |
◆ pos
◆ pos0
| std::vector<double> Ions_Move_LBFGS::pos0 |
|
private |
◆ pos_taud
◆ pos_taud0
| std::vector<double> Ions_Move_LBFGS::pos_taud0 |
|
private |
◆ rho
| std::vector<double> Ions_Move_LBFGS::rho |
|
private |
Scalar products for L-BFGS update.
| std::vector<std::vector<double> > Ions_Move_LBFGS::s |
|
private |
Position difference vectors.
◆ size
| int Ions_Move_LBFGS::size |
|
private |
Number of atoms in system.
◆ solver
◆ steplength
| std::vector<double> Ions_Move_LBFGS::steplength |
|
private |
| std::vector<std::vector<double> > Ions_Move_LBFGS::y |
|
private |
Force difference vectors.
The documentation for this class was generated from the following files: