Skip to content

Commit efb0990

Browse files
committed
unify gint terms
1 parent a29afee commit efb0990

17 files changed

+227
-205
lines changed

source/Makefile.Objects

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,7 @@ OBJS_LCAO=evolve_elec.o\
559559
FORCE_STRESS.o\
560560
FORCE_gamma.o\
561561
FORCE_k.o\
562-
fvl_dphi_gamma.o\
563-
fvl_dphi_k.o\
562+
stress_tools.o\
564563
fedm_gamma.o\
565564
fedm_k.o\
566565
ftvnl_dphi_gamma.o\

source/module_hamilt_lcao/hamilt_lcaodft/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ if(ENABLE_LCAO)
1818
FORCE_STRESS.cpp
1919
FORCE_gamma.cpp
2020
FORCE_k.cpp
21-
fvl_dphi_gamma.cpp
22-
fvl_dphi_k.cpp
21+
stress_tools.cpp
2322
fedm_gamma.cpp
2423
fedm_k.cpp
2524
ftvnl_dphi_gamma.cpp

source/module_hamilt_lcao/hamilt_lcaodft/FORCE.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,4 @@ class Force_LCAO
138138
ModuleBase::matrix& svl_dphi);
139139
};
140140

141-
// this namespace used to store global function for some stress operation
142-
namespace StressTools
143-
{
144-
// set upper matrix to whole matrix
145-
void stress_fill(const double& lat0_, const double& omega_, ModuleBase::matrix& stress_matrix);
146-
} // namespace StressTools
147141
#endif

source/module_hamilt_lcao/hamilt_lcaodft/FORCE_gamma.cpp

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "module_elecstate/elecstate_lcao.h"
1414
#include "module_hamilt_lcao/hamilt_lcaodft/LCAO_domain.h"
1515
#include "module_io/write_HS.h"
16+
#include "module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress/pulay_force_stress.h"
1617

1718
template <>
1819
void Force_LCAO<double>::allocate(const Parallel_Orbitals& pv,
@@ -229,9 +230,8 @@ void Force_LCAO<double>::ftable(const bool isforce,
229230
fvnl_dbeta,
230231
svnl_dbeta);
231232

232-
this->cal_fvl_dphi(isforce, isstress, pelec->pot, gint, fvl_dphi, svl_dphi);
233+
PulayForceStress::cal_pulay_fs(fvl_dphi, svl_dphi, *dm, ucell, pelec->pot, gint, isforce, isstress, false/*reset dm to gint*/);
233234

234-
// caoyu add for DeePKS
235235
#ifdef __DEEPKS
236236
if (GlobalV::deepks_scf)
237237
{
@@ -312,23 +312,3 @@ void Force_LCAO<double>::ftable(const bool isforce,
312312
ModuleBase::timer::tick("Force_LCAO", "ftable");
313313
return;
314314
}
315-
316-
namespace StressTools
317-
{
318-
void stress_fill(const double& lat0_, const double& omega_, ModuleBase::matrix& stress_matrix)
319-
{
320-
assert(omega_ > 0.0);
321-
double weight = lat0_ / omega_;
322-
for (int i = 0; i < 3; ++i)
323-
{
324-
for (int j = 0; j < 3; ++j)
325-
{
326-
if (j > i)
327-
{
328-
stress_matrix(j, i) = stress_matrix(i, j);
329-
}
330-
stress_matrix(i, j) *= weight;
331-
}
332-
}
333-
}
334-
} // namespace StressTools

source/module_hamilt_lcao/hamilt_lcaodft/FORCE_k.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "module_hamilt_lcao/hamilt_lcaodft/LCAO_domain.h"
1313
#include "module_hamilt_pw/hamilt_pwdft/global.h"
1414
#include "module_io/write_HS.h"
15+
#include "module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress/pulay_force_stress.h"
1516

1617
#include <map>
1718
#include <unordered_map>
@@ -316,7 +317,8 @@ void Force_LCAO<std::complex<double>>::ftable(const bool isforce,
316317
this->cal_ftvnl_dphi(dm, pv, ucell, fsr, isforce, isstress, ftvnl_dphi, stvnl_dphi, ra);
317318

318319
// doing on the real space grid.
319-
this->cal_fvl_dphi(isforce, isstress, pelec->pot, gint, fvl_dphi, svl_dphi);
320+
// this->cal_fvl_dphi(isforce, isstress, pelec->pot, gint, fvl_dphi, svl_dphi);
321+
PulayForceStress::cal_pulay_fs(fvl_dphi, svl_dphi, *dm, ucell, pelec->pot, gint, isforce, isstress, false/*reset dm to gint*/);
320322

321323
this->cal_fvnl_dbeta(dm,
322324
pv,

source/module_hamilt_lcao/hamilt_lcaodft/fedm_gamma.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "module_psi/psi.h"
77
#include "module_elecstate/cal_dm.h"
88
#include "module_elecstate/module_dm/cal_dm_psi.h"
9+
#include "module_hamilt_lcao/hamilt_lcaodft/stress_tools.h"
910

1011
// force due to the overlap matrix.
1112
// need energy density matrix here.

source/module_hamilt_lcao/hamilt_lcaodft/fedm_k.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "module_elecstate/module_dm/cal_dm_psi.h"
1010
#include "module_hamilt_pw/hamilt_pwdft/global.h"
1111
#include "module_io/write_HS.h"
12+
#include "module_hamilt_lcao/hamilt_lcaodft/stress_tools.h"
1213

1314
#include <map>
1415
#include <unordered_map>

source/module_hamilt_lcao/hamilt_lcaodft/ftvnl_dphi_gamma.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "module_cell/module_neighbor/sltk_grid_driver.h"
44
#include <unordered_map>
55
#include "module_base/timer.h"
6+
#include "module_hamilt_lcao/hamilt_lcaodft/stress_tools.h"
67

78
template<>
89
void Force_LCAO<double>::cal_ftvnl_dphi(

source/module_hamilt_lcao/hamilt_lcaodft/ftvnl_dphi_k.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "module_elecstate/elecstate_lcao.h"
1414
#include "module_hamilt_pw/hamilt_pwdft/global.h"
1515
#include "module_io/write_HS.h"
16+
#include "module_hamilt_lcao/hamilt_lcaodft/stress_tools.h"
1617

1718
#ifdef __DEEPKS
1819
#include "module_hamilt_lcao/module_deepks/LCAO_deepks.h"

source/module_hamilt_lcao/hamilt_lcaodft/fvl_dphi_gamma.cpp

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)