ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
ekinetic_force_stress.hpp
Go to the documentation of this file.
1#pragma once
2#include "ekinetic.h"
4#include "source_base/timer.h"
5
6namespace hamilt
7{
8
9template <typename TK, typename TR>
10void EKinetic<OperatorLCAO<TK, TR>>::cal_force_stress(const bool cal_force,
11 const bool cal_stress,
12 const HContainer<double>* dmR,
13 ModuleBase::matrix& force,
14 ModuleBase::matrix& stress)
15{
16 ModuleBase::TITLE("EKinetic", "cal_force_stress");
17 ModuleBase::timer::start("EKinetic", "cal_force_stress");
18
19 // Lambda function to calculate kinetic integral and its gradient
20 auto integral_calc = [this](int T1, int L1, int N1, int M1,
21 int T2, int L2, int N2, int M2,
23 double* olm) {
24 this->intor_->calculate(T1, L1, N1, M1, T2, L2, N2, M2,
25 dtau * this->ucell->lat0, &olm[0], &olm[1]);
26 };
27
28 // Use unified template with ForceSign=+1, StressSign=-1 for kinetic operator
29 OperatorForceStress::cal_force_stress_2center<TK, TR, decltype(integral_calc), +1, -1>(
30 cal_force, cal_stress, dmR, this->ucell, this->gridD,
31 this->orb_cutoff_, dmR->get_paraV(), integral_calc, force, stress);
32
33 ModuleBase::timer::end("EKinetic", "cal_force_stress");
34}
35
36// Dummy implementations for cal_force_IJR and cal_stress_IJR
37// These are not used in the simplified approach above
38template <typename TK, typename TR>
39void EKinetic<OperatorLCAO<TK, TR>>::cal_force_IJR(
40 const int& iat1,
41 const int& iat2,
42 const Parallel_Orbitals* paraV,
43 const std::unordered_map<int, std::vector<double>>& nlm1_all,
44 const std::unordered_map<int, std::vector<double>>& nlm2_all,
45 const hamilt::BaseMatrix<TR>* dmR_pointer,
46 double* force1,
47 double* force2)
48{
49 // Not used in current implementation
50}
51
52template <typename TK, typename TR>
53void EKinetic<OperatorLCAO<TK, TR>>::cal_stress_IJR(
54 const int& iat1,
55 const int& iat2,
56 const Parallel_Orbitals* paraV,
57 const std::unordered_map<int, std::vector<double>>& nlm1_all,
58 const std::unordered_map<int, std::vector<double>>& nlm2_all,
59 const hamilt::BaseMatrix<TR>* dmR_pointer,
62 double* stress)
63{
64 // Not used in current implementation
65}
66
67} // namespace hamilt
3 elements vector
Definition vector3.h:24
Definition matrix.h:18
static void start(void)
Start total time calculation.
Definition timer.cpp:44
static void end(const std::string &class_name_in, const std::string &name_in)
Definition timer.cpp:109
Definition parallel_orbitals.h:9
Definition base_matrix.h:20
Definition ekinetic.h:24
Definition hcontainer.h:144
const Parallel_Orbitals * get_paraV() const
get parallel orbital pointer to check parallel information
Definition hcontainer.h:192
void TITLE(const std::string &class_name, const std::string &function_name, const bool disable)
Definition tool_title.cpp:18
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.
Definition operator_force_stress_utils.hpp:38
Definition hamilt.h:13