ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
ions_move_basic.h
Go to the documentation of this file.
1#ifndef IONS_MOVE_BASIC_H
2#define IONS_MOVE_BASIC_H
3
4#include "relax_data.h"
7
8#include <fstream>
9#include <iostream>
10
20namespace Ions_Move_Basic
21{
22static int &dim = Relax_Data::dim;
23static double &largest_grad = Relax_Data::largest_grad;
24
25// Ions-specific parameters (not shared with lattice change)
26extern double trust_radius;
27extern double trust_radius_old;
28extern double relax_bfgs_rmax;
29extern double relax_bfgs_rmin;
30extern double relax_bfgs_init;
31extern double best_xxx;
32
42 const UnitCell &ucell,
43 const ModuleBase::matrix &force,
44 double *pos,
45 double *grad,
46 std::ofstream &ofs);
47
56void move_atoms(
57 UnitCell &ucell,
58 double *move,
59 double *pos,
60 std::ofstream &ofs,
61 const int test_relax_method);
62
77 const UnitCell &ucell,
78 const double *grad,
79 int &update_iter,
80 std::ofstream &ofs,
81 std::vector<double> &etot_info,
82 const double &force_thr,
83 const double &force_thr_ev,
84 const std::string &out_level,
85 const int test_relax_method);
86
95void terminate(
96 const bool converged,
97 const int update_iter,
98 const UnitCell &ucell,
99 const int istep,
100 std::ofstream &ofs);
101
109void setup_etot(const double &energy_in, const int istep, std::vector<double> &etot_info);
110
118double dot_func(const double *a, const double *b, const int &dim_in);
119
124
125} // namespace Ions_Move_Basic
126#endif
Definition matrix.h:15
static int dim
Dimension of free variables (3 * number of atoms) for ion movement.
Definition relax_data.h:34
static double largest_grad
Largest gradient component (force) in current step.
Definition relax_data.h:37
Provide the basic information about unitcell.
Definition unitcell.h:16
Basic utilities and shared state for ionic relaxation algorithms.
void setup_gradient(const UnitCell &ucell, const ModuleBase::matrix &force, double *pos, double *grad, std::ofstream &ofs)
Setup gradient from atomic forces.
Definition ions_move_basic.cpp:18
double trust_radius
Current trust radius.
Definition ions_move_basic.cpp:11
double dot_func(const double *a, const double *b, const int &dim_in)
Compute dot product of two vectors.
Definition ions_move_basic.cpp:244
void move_atoms(UnitCell &ucell, double *move, double *pos, std::ofstream &ofs, const int test_relax_method)
Move atoms according to displacement vector.
Definition ions_move_basic.cpp:60
double trust_radius_old
Previous trust radius.
Definition ions_move_basic.cpp:12
void setup_etot(const double &energy_in, const int istep, std::vector< double > &etot_info)
Update energy values and compute energy difference.
Definition ions_move_basic.cpp:226
void third_order()
Third-order polynomial interpolation for line search.
void terminate(const bool converged, const int update_iter, const UnitCell &ucell, const int istep, std::ofstream &ofs)
Terminate geometry optimization and output results.
Definition ions_move_basic.cpp:186
double best_xxx
Last step length from CG, used as BFGS initial guess.
Definition ions_move_basic.cpp:16
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.
Definition ions_move_basic.cpp:120
double relax_bfgs_rmin
Minimum trust radius (default: 1e-5 Bohr).
Definition ions_move_basic.cpp:14
double relax_bfgs_rmax
Maximum trust radius (default: 0.8 Bohr).
Definition ions_move_basic.cpp:13
double relax_bfgs_init
Initial trust radius (default: 0.5 Bohr).
Definition ions_move_basic.cpp:15