ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Lattice_Change_Basic Namespace Reference

Basic utilities and shared state for lattice relaxation algorithms. More...

Functions

void setup_gradient (const UnitCell &ucell, double *lat, double *grad, ModuleBase::matrix &stress)
 Setup gradient from stress tensor.
void change_lattice (UnitCell &ucell, double *move, double *lat, const bool fixed_ibrav)
 Update lattice vectors according to displacement.
bool check_converged (const UnitCell &ucell, ModuleBase::matrix &stress, double *grad, std::ofstream &ofs, const double &stress_thr)
 Check convergence based on stress threshold.
void terminate (const bool converged, std::ofstream &ofs)
 Terminate lattice optimization and output results.
void setup_etot (const double &energy_in, std::vector< double > &etot_info)
 Update energy values and compute energy difference.

Variables

int update_iter = 0
 Number of successfully updated iterations.
int stress_step = 0
 Index of stress optimization step.
double lattice_change_ini = 0.01
 Initial trust radius for lattice change (default: 0.01).
std::string fixed_axes = "None"
 Fixed axes constraint ("None", "shape", "volume", or specific axes).

Detailed Description

Basic utilities and shared state for lattice relaxation algorithms.

This namespace provides common functions and parameters used by lattice optimization methods. It shares core state variables through references to Relax_Data, ensuring consistent data across different optimization algorithms.

Function Documentation

◆ change_lattice()

void Lattice_Change_Basic::change_lattice ( UnitCell & ucell,
double * move,
double * lat,
const bool fixed_ibrav )

Update lattice vectors according to displacement.

Parameters
ucellUnit cell to update
moveDisplacement vector for lattice change (9 elements)
latCurrent lattice vectors (9 elements)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_converged()

bool Lattice_Change_Basic::check_converged ( const UnitCell & ucell,
ModuleBase::matrix & stress,
double * grad,
std::ofstream & ofs,
const double & stress_thr )

Check convergence based on stress threshold.

Parameters
ucellUnit cell containing lattice constraints
stressStress tensor (3x3 matrix)
gradGradient array (9 elements)
ofsOutput stream for logging
Returns
true if converged, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_etot()

void Lattice_Change_Basic::setup_etot ( const double & energy_in,
std::vector< double > & etot_info )

Update energy values and compute energy difference.

Parameters
energy_inInput energy value
judgementFlag for SD method (true) or BFGS (false)
etot_infoVector containing [etot, etot_p]
Here is the caller graph for this function:

◆ setup_gradient()

void Lattice_Change_Basic::setup_gradient ( const UnitCell & ucell,
double * lat,
double * grad,
ModuleBase::matrix & stress )

Setup gradient from stress tensor.

Parameters
ucellUnit cell containing lattice information
latOutput lattice vector array (9 elements: e11, e12, e13, e21, e22, e23, e31, e32, e33)
gradOutput gradient array (9 elements)
stressStress tensor (3x3 matrix)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ terminate()

void Lattice_Change_Basic::terminate ( const bool converged,
std::ofstream & ofs )

Terminate lattice optimization and output results.

Parameters
convergedConvergence flag
ofsOutput stream for logging
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ fixed_axes

std::string Lattice_Change_Basic::fixed_axes = "None"
extern

Fixed axes constraint ("None", "shape", "volume", or specific axes).

◆ lattice_change_ini

double Lattice_Change_Basic::lattice_change_ini = 0.01
extern

Initial trust radius for lattice change (default: 0.01).

◆ stress_step

int Lattice_Change_Basic::stress_step = 0
extern

Index of stress optimization step.

◆ update_iter

int Lattice_Change_Basic::update_iter = 0
extern

Number of successfully updated iterations.