1#ifndef OPERATOR_FORCE_STRESS_UTILS_H
2#define OPERATOR_FORCE_STRESS_UTILS_H
22 step_trace.resize(npol * npol, 0);
26 step_trace[2] = col_size;
27 step_trace[3] = col_size + 1;
55 qn.
M = (qn.
m % 2 == 0) ? -qn.
m / 2 : (qn.
m + 1) / 2;
86 stress.
c[8] = stress.
c[5];
87 stress.
c[7] = stress.
c[4];
88 stress.
c[6] = stress.
c[2];
89 stress.
c[5] = stress.
c[4];
90 stress.
c[4] = stress.
c[3];
91 stress.
c[3] = stress.
c[1];
116 const std::vector<double>& stress_tmp,
119 double force_factor = 2.0,
120 double stress_factor = 2.0);
std::vector< int > iw2m
Definition atom_spec.h:17
std::vector< int > iw2l
Definition atom_spec.h:19
std::vector< int > iw2n
Definition atom_spec.h:18
double * c
Definition matrix.h:24
#define T
Definition exp.cpp:237
Definition operator_force_stress_utils.cpp:4
void setup_step_trace(int npol, int col_size, std::vector< int > &step_trace)
Setup step_trace array for handling npol (spin polarization)
Definition operator_force_stress_utils.h:20
double get_real_part(const T &val)
Helper function to extract real part from complex or real values.
Definition operator_force_stress_utils.h:65
OrbitalQuantumNumbers get_orbital_qn(const Atom &atom, int iw)
Extract orbital quantum numbers from atom and orbital index.
Definition operator_force_stress_utils.h:49
void finalize_force_stress(bool cal_force, bool cal_stress, const UnitCell *ucell, const std::vector< double > &stress_tmp, ModuleBase::matrix &force, ModuleBase::matrix &stress, double force_factor, double stress_factor)
Finalize force and stress calculations with MPI reduction and post-processing.
Definition operator_force_stress_utils.cpp:6
void rearrange_stress_matrix(ModuleBase::matrix &stress)
Rearrange stress from 6-component vector to 3x3 matrix format.
Definition operator_force_stress_utils.h:84
double get_real_part< double >(const double &val)
Definition operator_force_stress_utils.h:71
Structure to hold orbital quantum numbers.
Definition operator_force_stress_utils.h:35
int N
Principal quantum number.
Definition operator_force_stress_utils.h:37
int m
Magnetic quantum number (internal indexing)
Definition operator_force_stress_utils.h:38
int M
Magnetic quantum number (standard convention)
Definition operator_force_stress_utils.h:39
int L
Angular momentum quantum number.
Definition operator_force_stress_utils.h:36