Skip to content

Commit 0304d5e

Browse files
author
abacus_fixer
committed
split force_stress_lcao.cpp (3/4): extract integral_part<double, complex<double>> to force_stress_lcao_integral.cpp
1 parent 00743ab commit 0304d5e

3 files changed

Lines changed: 105 additions & 69 deletions

File tree

source/source_lcao/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ if(ENABLE_LCAO)
3737
force_stress_lcao.cpp
3838
force_stress_lcao_driver.cpp
3939
force_stress_lcao_pw.cpp
40+
force_stress_lcao_integral.cpp
4041
force_lcao_gamma.cpp
4142
force_lcao_k.cpp
4243
stress_tools.cpp

source/source_lcao/force_stress_lcao.cpp

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -31,75 +31,6 @@
3131
#include "source_lcao/module_rt/force_rt_overlap.h"
3232

3333

34-
// overlap, kinetic, nonlocal pseudopotential, Local potential terms in force and stress
35-
template <>
36-
void Force_Stress_LCAO<double>::integral_part(const bool isGammaOnly,
37-
const bool isforce,
38-
const bool isstress,
39-
const UnitCell& ucell,
40-
const Grid_Driver& gd,
41-
ForceStressArrays& fsr, // mohan add 2024-06-15
42-
const elecstate::ElecState* pelec,
43-
const elecstate::DensityMatrix<double, double>* dm, // mohan add 2025-11-04
44-
const psi::Psi<double>* psi,
45-
ModuleBase::matrix& foverlap,
46-
ModuleBase::matrix& ftvnl_dphi,
47-
ModuleBase::matrix& fvnl_dbeta,
48-
ModuleBase::matrix& fvl_dphi,
49-
ModuleBase::matrix& soverlap,
50-
ModuleBase::matrix& stvnl_dphi,
51-
ModuleBase::matrix& svnl_dbeta,
52-
ModuleBase::matrix& svl_dphi,
53-
ModuleBase::matrix& fvnl_dalpha,
54-
ModuleBase::matrix& svnl_dalpha,
55-
Setup_DeePKS<double>& deepks,
56-
const TwoCenterBundle& two_center_bundle,
57-
const LCAO_Orbitals& orb,
58-
const Parallel_Orbitals& pv,
59-
const K_Vectors& kv)
60-
{
61-
62-
flk.ftable(isforce, isstress, fsr, ucell, gd, psi, pelec, dm,
63-
foverlap, ftvnl_dphi, fvnl_dbeta, fvl_dphi,
64-
soverlap, stvnl_dphi, svnl_dbeta, svl_dphi,
65-
fvnl_dalpha, svnl_dalpha, deepks, two_center_bundle, orb, pv);
66-
return;
67-
}
68-
69-
template <>
70-
void Force_Stress_LCAO<std::complex<double>>::integral_part(const bool isGammaOnly,
71-
const bool isforce,
72-
const bool isstress,
73-
const UnitCell& ucell,
74-
const Grid_Driver& gd,
75-
ForceStressArrays& fsr, // mohan add 2024-06-15
76-
const elecstate::ElecState* pelec,
77-
const elecstate::DensityMatrix<std::complex<double>, double>* dm, // mohan add 2025-11-04
78-
const psi::Psi<std::complex<double>>* psi,
79-
ModuleBase::matrix& foverlap,
80-
ModuleBase::matrix& ftvnl_dphi,
81-
ModuleBase::matrix& fvnl_dbeta,
82-
ModuleBase::matrix& fvl_dphi,
83-
ModuleBase::matrix& soverlap,
84-
ModuleBase::matrix& stvnl_dphi,
85-
ModuleBase::matrix& svnl_dbeta,
86-
ModuleBase::matrix& svl_dphi,
87-
ModuleBase::matrix& fvnl_dalpha,
88-
ModuleBase::matrix& svnl_dalpha,
89-
Setup_DeePKS<std::complex<double>>& deepks,
90-
const TwoCenterBundle& two_center_bundle,
91-
const LCAO_Orbitals& orb,
92-
const Parallel_Orbitals& pv,
93-
const K_Vectors& kv)
94-
{
95-
flk.ftable(isforce, isstress, fsr, ucell, gd, psi, pelec, dm,
96-
foverlap, ftvnl_dphi, fvnl_dbeta, fvl_dphi,
97-
soverlap, stvnl_dphi, svnl_dbeta, svl_dphi,
98-
fvnl_dalpha, svnl_dalpha, deepks,
99-
two_center_bundle, orb, pv, &kv, this->RA);
100-
return;
101-
}
102-
10334
// vlocal, hartree, ewald, core correction, exchange-correlation terms in stress
10435
template <typename T>
10536
void Force_Stress_LCAO<T>::calStressPwPart(UnitCell& ucell,
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#include "force_stress_lcao.h"
2+
3+
#include "source_base/parallel_reduce.h"
4+
#include "source_lcao/module_dftu/dftu_lcao.h" //Quxin add for DFT+U on 20201029
5+
#include "source_lcao/module_dftu/dftu_force.h"
6+
#include "source_io/module_output/output_log.h"
7+
#include "source_io/module_parameter/parameter.h"
8+
// new
9+
#include "source_base/timer.h"
10+
#include "source_base/tool_quit.h"
11+
#include "source_cell/module_neighbor/sltk_grid_driver.h"
12+
#include "source_estate/elecstate_lcao.h"
13+
#include "source_estate/module_pot/h_tddft_pw.h" // Taoni add 2025-02-20
14+
#include "source_estate/module_pot/efield.h" // liuyu add 2022-05-18
15+
#include "source_estate/module_pot/gatefield.h" // liuyu add 2022-09-13
16+
#include "source_hamilt/module_surchem/surchem.h" //sunml add 2022-08-10
17+
#include "source_hamilt/module_vdw/vdw.h"
18+
#include "source_io/module_parameter/parameter.h"
19+
#ifdef __MLALGO
20+
#include "source_lcao/module_deepks/lcao_deepks.h" //caoyu add for deepks 2021-06-03
21+
#include "source_lcao/module_deepks/lcao_deepks_io.h" // mohan add 2024-07-22
22+
#include "source_lcao/module_deepks/deepks_force.h"
23+
#endif
24+
#include "source_lcao/module_dftu/dftu_lcao_op.h"
25+
#include "source_lcao/module_operator_lcao/dspin_lcao.h"
26+
#include "source_lcao/module_operator_lcao/nonlocal.h"
27+
#include "source_lcao/module_operator_lcao/ekinetic.h"
28+
#include "source_lcao/module_operator_lcao/overlap.h"
29+
#include "source_lcao/module_operator_lcao/td_pot_hybrid.h"
30+
#include "source_lcao/pulay_fs.h"
31+
#include "source_lcao/module_rt/force_rt_overlap.h"
32+
33+
34+
// overlap, kinetic, nonlocal pseudopotential, Local potential terms in force and stress
35+
template <>
36+
void Force_Stress_LCAO<double>::integral_part(const bool isGammaOnly,
37+
const bool isforce,
38+
const bool isstress,
39+
const UnitCell& ucell,
40+
const Grid_Driver& gd,
41+
ForceStressArrays& fsr, // mohan add 2024-06-15
42+
const elecstate::ElecState* pelec,
43+
const elecstate::DensityMatrix<double, double>* dm, // mohan add 2025-11-04
44+
const psi::Psi<double>* psi,
45+
ModuleBase::matrix& foverlap,
46+
ModuleBase::matrix& ftvnl_dphi,
47+
ModuleBase::matrix& fvnl_dbeta,
48+
ModuleBase::matrix& fvl_dphi,
49+
ModuleBase::matrix& soverlap,
50+
ModuleBase::matrix& stvnl_dphi,
51+
ModuleBase::matrix& svnl_dbeta,
52+
ModuleBase::matrix& svl_dphi,
53+
ModuleBase::matrix& fvnl_dalpha,
54+
ModuleBase::matrix& svnl_dalpha,
55+
Setup_DeePKS<double>& deepks,
56+
const TwoCenterBundle& two_center_bundle,
57+
const LCAO_Orbitals& orb,
58+
const Parallel_Orbitals& pv,
59+
const K_Vectors& kv)
60+
{
61+
62+
flk.ftable(isforce, isstress, fsr, ucell, gd, psi, pelec, dm,
63+
foverlap, ftvnl_dphi, fvnl_dbeta, fvl_dphi,
64+
soverlap, stvnl_dphi, svnl_dbeta, svl_dphi,
65+
fvnl_dalpha, svnl_dalpha, deepks, two_center_bundle, orb, pv);
66+
return;
67+
}
68+
69+
template <>
70+
void Force_Stress_LCAO<std::complex<double>>::integral_part(const bool isGammaOnly,
71+
const bool isforce,
72+
const bool isstress,
73+
const UnitCell& ucell,
74+
const Grid_Driver& gd,
75+
ForceStressArrays& fsr, // mohan add 2024-06-15
76+
const elecstate::ElecState* pelec,
77+
const elecstate::DensityMatrix<std::complex<double>, double>* dm, // mohan add 2025-11-04
78+
const psi::Psi<std::complex<double>>* psi,
79+
ModuleBase::matrix& foverlap,
80+
ModuleBase::matrix& ftvnl_dphi,
81+
ModuleBase::matrix& fvnl_dbeta,
82+
ModuleBase::matrix& fvl_dphi,
83+
ModuleBase::matrix& soverlap,
84+
ModuleBase::matrix& stvnl_dphi,
85+
ModuleBase::matrix& svnl_dbeta,
86+
ModuleBase::matrix& svl_dphi,
87+
ModuleBase::matrix& fvnl_dalpha,
88+
ModuleBase::matrix& svnl_dalpha,
89+
Setup_DeePKS<std::complex<double>>& deepks,
90+
const TwoCenterBundle& two_center_bundle,
91+
const LCAO_Orbitals& orb,
92+
const Parallel_Orbitals& pv,
93+
const K_Vectors& kv)
94+
{
95+
flk.ftable(isforce, isstress, fsr, ucell, gd, psi, pelec, dm,
96+
foverlap, ftvnl_dphi, fvnl_dbeta, fvl_dphi,
97+
soverlap, stvnl_dphi, svnl_dbeta, svl_dphi,
98+
fvnl_dalpha, svnl_dalpha, deepks,
99+
two_center_bundle, orb, pv, &kv, this->RA);
100+
return;
101+
}
102+
103+
template class Force_Stress_LCAO<double>;
104+
template class Force_Stress_LCAO<std::complex<double>>;

0 commit comments

Comments
 (0)