|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
Basic utilities and shared state for ionic relaxation algorithms. More...
Functions | |
| void | setup_gradient (const UnitCell &ucell, const ModuleBase::matrix &force, double *pos, double *grad, std::ofstream &ofs) |
| Setup gradient from atomic forces. | |
| void | move_atoms (UnitCell &ucell, double *move, double *pos, std::ofstream &ofs, const int test_relax_method) |
| Move atoms according to displacement vector. | |
| bool | check_converged (const UnitCell &ucell, const double *grad, int &update_iter, std::ofstream &ofs, std::vector< double > &etot_info, const double &force_thr, const double &force_thr_ev, const std::string &out_level, const int test_relax_method) |
| Check convergence based on gradient threshold. | |
| void | terminate (const bool converged, const int update_iter, const UnitCell &ucell, const int istep, std::ofstream &ofs) |
| Terminate geometry optimization and output results. | |
| void | setup_etot (const double &energy_in, const int istep, std::vector< double > &etot_info) |
| Update energy values and compute energy difference. | |
| double | dot_func (const double *a, const double *b, const int &dim_in) |
| Compute dot product of two vectors. | |
| void | third_order () |
| Third-order polynomial interpolation for line search. | |
Variables | |
| double | trust_radius = 0.0 |
| Current trust radius. | |
| double | trust_radius_old = 0.0 |
| Previous trust radius. | |
| double | relax_bfgs_rmax = -1.0 |
| Maximum trust radius (default: 0.8 Bohr). | |
| double | relax_bfgs_rmin = -1.0 |
| Minimum trust radius (default: 1e-5 Bohr). | |
| double | relax_bfgs_init = -1.0 |
| Initial trust radius (default: 0.5 Bohr). | |
| double | best_xxx = 1.0 |
| Last step length from CG, used as BFGS initial guess. | |
Basic utilities and shared state for ionic relaxation algorithms.
This namespace provides common functions and parameters used by all ion movement methods (BFGS, CG, SD, etc.). It shares core state variables through references to Relax_Data, ensuring consistent data across different optimization algorithms.
| bool Ions_Move_Basic::check_converged | ( | const UnitCell & | ucell, |
| const double * | grad, | ||
| int & | update_iter, | ||
| std::ofstream & | ofs, | ||
| std::vector< double > & | etot_info, | ||
| const double & | force_thr, | ||
| const double & | force_thr_ev, | ||
| const std::string & | out_level, | ||
| const int | test_relax_method ) |
Check convergence based on gradient threshold.
| ucell | Unit cell containing lattice information |
| grad | Gradient array (dimension: dim) |
| update_iter | Number of successfully updated iterations (will be incremented if converged) |
| ofs | Output stream for logging |
| etot_info | Energy information array [etot, etot_p, ediff] |
| force_thr | Force convergence threshold in Ry/Bohr |
| force_thr_ev | The same threshold in eV/Angstrom, as reconciled by ReadInput |
| out_level | Output verbosity level ("ie" prints per-step energy to stdout) |
| test_relax_method | Verbosity level for relaxation debug output |
| double Ions_Move_Basic::dot_func | ( | const double * | a, |
| const double * | b, | ||
| const int & | dim_in ) |
Compute dot product of two vectors.
| a | First vector |
| b | Second vector |
| dim_in | Dimension of vectors |
| void Ions_Move_Basic::move_atoms | ( | UnitCell & | ucell, |
| double * | move, | ||
| double * | pos, | ||
| std::ofstream & | ofs, | ||
| const int | test_relax_method ) |
Move atoms according to displacement vector.
| ucell | Unit cell to update |
| move | Displacement vector (dimension: dim) |
| pos | Current position array (dimension: dim) |
| ofs | Output stream for logging |
| test_relax_method | Verbosity level for relaxation debug output |
| void Ions_Move_Basic::setup_etot | ( | const double & | energy_in, |
| const int | istep, | ||
| std::vector< double > & | etot_info ) |
Update energy values and compute energy difference.
| energy_in | Input energy value |
| judgement | Flag for SD method (true) or BFGS (false) |
| istep | Current ionic step index |
| etot_info | Energy information array [etot, etot_p, ediff] |
| void Ions_Move_Basic::setup_gradient | ( | const UnitCell & | ucell, |
| const ModuleBase::matrix & | force, | ||
| double * | pos, | ||
| double * | grad, | ||
| std::ofstream & | ofs ) |
Setup gradient from atomic forces.
| ucell | Unit cell containing atomic information |
| force | Force matrix (nat x 3) |
| pos | Output position array (dimension: dim) |
| grad | Output gradient array (dimension: dim) |
| ofs | Output stream for logging |
| void Ions_Move_Basic::terminate | ( | const bool | converged, |
| const int | update_iter, | ||
| const UnitCell & | ucell, | ||
| const int | istep, | ||
| std::ofstream & | ofs ) |
Terminate geometry optimization and output results.
| converged | Convergence flag |
| update_iter | Number of successfully updated iterations |
| ucell | Unit cell to output |
| istep | Current ionic step index |
| ofs | Output stream for logging |
| void Ions_Move_Basic::third_order | ( | ) |
Third-order polynomial interpolation for line search.
|
extern |
Last step length from CG, used as BFGS initial guess.
|
extern |
Initial trust radius (default: 0.5 Bohr).
|
extern |
Maximum trust radius (default: 0.8 Bohr).
|
extern |
Minimum trust radius (default: 1e-5 Bohr).
|
extern |
Current trust radius.
|
extern |
Previous trust radius.