ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
relax_driver.h
Go to the documentation of this file.
1#ifndef RELAX_DRIVER_H
2#define RELAX_DRIVER_H
3
4#include "relax_nsync.h"
5#include "relax_sync.h"
10
11#include <fstream>
12#include <string>
13#include <vector>
14
22{
23
24 public:
27
40 void relax_driver(
41 ModuleESolver::ESolver *p_esolver,
42 UnitCell &ucell,
43 const Input_para &inp,
44 std::ofstream &ofs_running);
45
46 private:
55
60
62 std::string out_dir_;
64 bool deepks_setorb_ = false;
66 int my_rank_ = 0;
67
74 void init_relax(const int nat, const Input_para &inp);
75
82 void iter_info(const std::vector<int> &steps, const Input_para &inp);
83
95 void esolve(
96 const int istep,
97 ModuleESolver::ESolver *p_esolver,
98 UnitCell &ucell,
99 const Input_para &inp,
100 ModuleBase::matrix &force,
101 ModuleBase::matrix &stress,
102 double &etot);
103
118 bool relax_step(
119 std::vector<int> &steps,
120 ModuleESolver::ESolver *p_esolver,
121 UnitCell &ucell,
122 const Input_para &inp,
123 const ModuleBase::matrix &force,
124 const ModuleBase::matrix &stress,
125 const double etot,
126 std::ofstream &ofs_running);
127
138 void stru_out(
139 const int istep,
140 UnitCell &ucell,
141 const Input_para &inp,
142 const double etot,
143 const ModuleBase::matrix &stress,
144 const ModuleBase::matrix &force,
145 std::ofstream &ofs_running);
146
156 void json_out(
157 ModuleESolver::ESolver *p_esolver,
158 UnitCell &ucell,
159 const Input_para &inp,
160 const ModuleBase::matrix &force,
161 const ModuleBase::matrix &stress);
162
177 void final_out(
178 const int istep,
179 const RelaxStopReason stop_reason,
180 UnitCell &ucell,
181 const Input_para &inp,
182 const double etot,
183 const ModuleBase::matrix &stress,
184 const ModuleBase::matrix &force,
185 const bool geometry_evaluated,
186 std::ofstream &ofs_running);
187
199 void print_not_converged_summary(const int ionic_steps, const Input_para &inp, std::ofstream &ofs_running) const;
200
204 void print_dry_run_message() const;
205};
206
207#endif
Optimizer for ionic position relaxation and cell parameter optimization.
Definition relax_nsync.h:26
Definition matrix.h:15
Definition esolver.h:13
void esolve(const int istep, ModuleESolver::ESolver *p_esolver, UnitCell &ucell, const Input_para &inp, ModuleBase::matrix &force, ModuleBase::matrix &stress, double &etot)
Perform energy solving for the current step.
Definition relax_driver.cpp:165
Relax rl
New relaxation optimizer (Relax class).
Definition relax_driver.h:57
void print_dry_run_message() const
Print the dry-run success message to screen.
Definition relax_driver.cpp:403
void stru_out(const int istep, UnitCell &ucell, const Input_para &inp, const double etot, const ModuleBase::matrix &stress, const ModuleBase::matrix &force, std::ofstream &ofs_running)
Output structure files before relaxation move.
Definition relax_driver.cpp:227
bool deepks_setorb_
Cached DeePKS setorb flag (read once from PARAM at relax_driver entry).
Definition relax_driver.h:64
bool relax_step(std::vector< int > &steps, ModuleESolver::ESolver *p_esolver, UnitCell &ucell, const Input_para &inp, const ModuleBase::matrix &force, const ModuleBase::matrix &stress, const double etot, std::ofstream &ofs_running)
Perform one relaxation step.
Definition relax_driver.cpp:189
void print_not_converged_summary(const int ionic_steps, const Input_para &inp, std::ofstream &ofs_running) const
Print the unified not-converged summary to the running log.
Definition relax_driver.cpp:378
void json_out(ModuleESolver::ESolver *p_esolver, UnitCell &ucell, const Input_para &inp, const ModuleBase::matrix &force, const ModuleBase::matrix &stress)
Output JSON format results.
Definition relax_driver.cpp:294
void init_relax(const int nat, const Input_para &inp)
Initialize the relaxation optimizer.
Definition relax_driver.cpp:130
IonCellOptimizer rl_old
Old relaxation optimizer (IonCellOptimizer class).
Definition relax_driver.h:59
void final_out(const int istep, const RelaxStopReason stop_reason, UnitCell &ucell, const Input_para &inp, const double etot, const ModuleBase::matrix &stress, const ModuleBase::matrix &force, const bool geometry_evaluated, std::ofstream &ofs_running)
Output final results after relaxation.
Definition relax_driver.cpp:310
RelaxStopReason
Definition relax_driver.h:48
@ UserExit
Definition relax_driver.h:51
@ Finished
Definition relax_driver.h:53
@ MaxSteps
Definition relax_driver.h:50
@ DryRun
Definition relax_driver.h:52
@ Converged
Definition relax_driver.h:49
int my_rank_
Cached MPI rank (read once at relax_driver entry).
Definition relax_driver.h:66
Relax_Driver()
Definition relax_driver.h:25
void relax_driver(ModuleESolver::ESolver *p_esolver, UnitCell &ucell, const Input_para &inp, std::ofstream &ofs_running)
Main driver function for relaxation calculations.
Definition relax_driver.cpp:17
~Relax_Driver()
Definition relax_driver.h:26
void iter_info(const std::vector< int > &steps, const Input_para &inp)
Print iteration information to screen.
Definition relax_driver.cpp:145
std::string out_dir_
Cached global output directory (read once from PARAM at relax_driver entry).
Definition relax_driver.h:62
Definition relax_sync.h:16
Provide the basic information about unitcell.
Definition unitcell.h:16
Definition input_parameter.h:13