|
| 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=2.0, double stress_factor=2.0) |
| | Finalize force and stress calculations with MPI reduction and post-processing.
|
| |
| void | setup_step_trace (int npol, int col_size, std::vector< int > &step_trace) |
| | Setup step_trace array for handling npol (spin polarization)
|
| |
| OrbitalQuantumNumbers | get_orbital_qn (const Atom &atom, int iw) |
| | Extract orbital quantum numbers from atom and orbital index.
|
| |
| template<typename T > |
| double | get_real_part (const T &val) |
| | Helper function to extract real part from complex or real values.
|
| |
| template<> |
| double | get_real_part< double > (const double &val) |
| |
| void | rearrange_stress_matrix (ModuleBase::matrix &stress) |
| | Rearrange stress from 6-component vector to 3x3 matrix format.
|
| |
| template<typename TK , typename TR , typename IntegralFunc , int ForceSign, int StressSign> |
| void | cal_force_stress_2center (const bool cal_force, const bool cal_stress, const hamilt::HContainer< double > *dmR, const UnitCell *ucell, const Grid_Driver *gridD, const std::vector< double > &orb_cutoff, const Parallel_Orbitals *paraV, IntegralFunc &integral_calculator, ModuleBase::matrix &force, ModuleBase::matrix &stress) |
| | Template function for calculating force and stress from 2-center integrals.
|
| |
template<typename TK , typename TR , typename IntegralFunc , int ForceSign, int StressSign>
Template function for calculating force and stress from 2-center integrals.
This template unifies the force/stress calculation pattern for operators that use 2-center integrals (e.g., overlap, kinetic energy). The sign conventions for force and stress are controlled by template parameters to avoid runtime overhead.
- Template Parameters
-
| TK | Type for k-space matrices (double or std::complex<double>) |
| TR | Type for real-space matrices (typically double) |
| IntegralFunc | Functor type for calculating integrals |
| ForceSign | Sign convention for force (+1 or -1) |
| StressSign | Sign convention for stress (+1 or -1) |
- Parameters
-
| cal_force | Whether to calculate forces |
| cal_stress | Whether to calculate stress |
| dmR | Density matrix in real space |
| ucell | Unit cell containing atomic structure |
| gridD | Grid driver for finding adjacent atoms |
| orb_cutoff | Orbital cutoff radii for each atom type |
| paraV | Parallel orbital distribution information |
| integral_calculator | Functor that calculates integral and its derivatives |
| force | Output force matrix (natom x 3) |
| stress | Output stress matrix (3 x 3) |