ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
lattice_change_basic.h
Go to the documentation of this file.
1#ifndef LATTICE_CHANGE_BASIC_H
2#define LATTICE_CHANGE_BASIC_H
3
4#include "relax_data.h"
7
8#include <fstream>
9#include <vector>
10
21{
22// Shared state variables (referenced from Relax_Data for unified data sharing)
23static int &dim = Relax_Data::dim_lattice;
24static double &largest_grad = Relax_Data::largest_grad;
25
26// Lattice-specific parameters (not shared with ion movement)
27extern int update_iter;
28extern int stress_step;
29extern double lattice_change_ini;
30extern std::string fixed_axes;
31
40 const UnitCell &ucell,
41 double *lat,
42 double *grad,
43 ModuleBase::matrix &stress);
44
52 UnitCell &ucell,
53 double *move,
54 double *lat,
55 const bool fixed_ibrav);
56
66 const UnitCell &ucell,
67 ModuleBase::matrix &stress,
68 double *grad,
69 std::ofstream &ofs,
70 const double &stress_thr);
71
77void terminate(const bool converged, std::ofstream &ofs);
78
85void setup_etot(const double &energy_in, std::vector<double> &etot_info);
86} // namespace Lattice_Change_Basic
87#endif
Definition matrix.h:15
static int dim_lattice
Dimension of free variables (9) for lattice change.
Definition relax_data.h:35
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 lattice relaxation algorithms.
void terminate(const bool converged, std::ofstream &ofs)
Terminate lattice optimization and output results.
Definition lattice_change_basic.cpp:319
int stress_step
Index of stress optimization step.
Definition lattice_change_basic.cpp:10
void change_lattice(UnitCell &ucell, double *move, double *lat, const bool fixed_ibrav)
Update lattice vectors according to displacement.
Definition lattice_change_basic.cpp:104
int update_iter
Number of successfully updated iterations.
Definition lattice_change_basic.cpp:9
void setup_etot(const double &energy_in, std::vector< double > &etot_info)
Update energy values and compute energy difference.
Definition lattice_change_basic.cpp:349
bool check_converged(const UnitCell &ucell, ModuleBase::matrix &stress, double *grad, std::ofstream &ofs, const double &stress_thr)
Check convergence based on stress threshold.
Definition lattice_change_basic.cpp:242
double lattice_change_ini
Initial trust radius for lattice change (default: 0.01).
Definition lattice_change_basic.cpp:11
void setup_gradient(const UnitCell &ucell, double *lat, double *grad, ModuleBase::matrix &stress)
Setup gradient from stress tensor.
Definition lattice_change_basic.cpp:14
std::string fixed_axes
Fixed axes constraint ("None", "shape", "volume", or specific axes).
Definition lattice_change_basic.cpp:12