Skip to content

Commit be1bd20

Browse files
YuLiu98Fisherd99
authored andcommitted
Refactor: external_stress in dp/lj (deepmodeling#5831)
1 parent 63e666e commit be1bd20

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

source/module_esolver/esolver_dp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,15 @@ void ESolver_DP::cal_stress(UnitCell& ucell, ModuleBase::matrix& stress)
136136
{
137137
stress = dp_virial;
138138

139+
ModuleIO::print_stress("TOTAL-STRESS", stress, true, false);
140+
139141
// external stress
140142
double unit_transform = ModuleBase::RYDBERG_SI / pow(ModuleBase::BOHR_RADIUS_SI, 3) * 1.0e-8;
141143
double external_stress[3] = {PARAM.inp.press1, PARAM.inp.press2, PARAM.inp.press3};
142144
for (int i = 0; i < 3; i++)
143145
{
144146
stress(i, i) -= external_stress[i] / unit_transform;
145147
}
146-
147-
ModuleIO::print_stress("TOTAL-STRESS", stress, true, false);
148148
}
149149

150150
void ESolver_DP::after_all_runners(UnitCell& ucell)

source/module_esolver/esolver_gets.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ void ESolver_GetS::before_all_runners(UnitCell& ucell, const Input_para& inp)
7272
two_center_bundle_,
7373
orb_);
7474

75-
// 4) initialize the density matrix
76-
// DensityMatrix is allocated here, DMK is also initialized here
77-
// DMR is not initialized here, it will be constructed in each before_scf
78-
dynamic_cast<elecstate::ElecStateLCAO<std::complex<double>>*>(this->pelec)
79-
->init_DM(&this->kv, &(this->pv), inp.nspin);
80-
8175
ModuleBase::timer::tick("ESolver_GetS", "before_all_runners");
8276
}
8377

source/module_esolver/esolver_lj.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ void ESolver_LJ::runner(UnitCell& ucell, const int istep)
104104
{
105105
stress = lj_virial;
106106

107+
ModuleIO::print_stress("TOTAL-STRESS", stress, true, false);
108+
107109
// external stress
108110
double unit_transform = ModuleBase::RYDBERG_SI / pow(ModuleBase::BOHR_RADIUS_SI, 3) * 1.0e-8;
109111
double external_stress[3] = {PARAM.inp.press1, PARAM.inp.press2, PARAM.inp.press3};
110112
for (int i = 0; i < 3; i++)
111113
{
112114
stress(i, i) -= external_stress[i] / unit_transform;
113115
}
114-
115-
ModuleIO::print_stress("TOTAL-STRESS", stress, true, false);
116116
}
117117

118118
void ESolver_LJ::after_all_runners(UnitCell& ucell)

0 commit comments

Comments
 (0)