Skip to content

Commit 22a95ef

Browse files
committed
change ucell in module_ri/exx_lri.hpp
1 parent 0ab60f3 commit 22a95ef

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

source/module_hamilt_lcao/hamilt_lcaodft/FORCE_STRESS.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,25 +375,25 @@ void Force_Stress_LCAO<T>::getForceStress(const bool isforce,
375375
{
376376
if (GlobalC::exx_info.info_ri.real_number)
377377
{
378-
exx_lri_double.cal_exx_force();
378+
exx_lri_double.cal_exx_force(ucell.nat);
379379
force_exx = GlobalC::exx_info.info_global.hybrid_alpha * exx_lri_double.force_exx;
380380
}
381381
else
382382
{
383-
exx_lri_complex.cal_exx_force();
383+
exx_lri_complex.cal_exx_force(ucell.nat);
384384
force_exx = GlobalC::exx_info.info_global.hybrid_alpha * exx_lri_complex.force_exx;
385385
}
386386
}
387387
if (isstress)
388388
{
389389
if (GlobalC::exx_info.info_ri.real_number)
390390
{
391-
exx_lri_double.cal_exx_stress();
391+
exx_lri_double.cal_exx_stress(ucell.omega,ucell.lat0);
392392
stress_exx = GlobalC::exx_info.info_global.hybrid_alpha * exx_lri_double.stress_exx;
393393
}
394394
else
395395
{
396-
exx_lri_complex.cal_exx_stress();
396+
exx_lri_complex.cal_exx_stress(ucell.omega,ucell.lat0);
397397
stress_exx = GlobalC::exx_info.info_global.hybrid_alpha * exx_lri_complex.stress_exx;
398398
}
399399
}

source/module_ri/Exx_LRI.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class Exx_LRI
6060
const UnitCell &ucell,
6161
const K_Vectors &kv_in,
6262
const LCAO_Orbitals& orb);
63-
void cal_exx_force();
64-
void cal_exx_stress();
63+
void cal_exx_force(const int& nat);
64+
void cal_exx_stress(const double& omega, const double& lat0);
6565
void cal_exx_ions(const UnitCell& ucell, const bool write_cv = false);
6666
void cal_exx_elec(const std::vector<std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>>& Ds,
6767
const UnitCell& ucell,

source/module_ri/Exx_LRI.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ void Exx_LRI<Tdata>::cal_exx_elec(const std::vector<std::map<TA, std::map<TAC, R
219219
// reduce but not repeat
220220
auto Hs_a2D = this->exx_lri.post_2D.set_tensors_map2(this->exx_lri.Hs);
221221
// rotate locally without repeat
222-
Hs_a2D = p_symrot->restore_HR(GlobalC::ucell.symm, GlobalC::ucell.atoms, GlobalC::ucell.st, 'H', Hs_a2D);
222+
Hs_a2D = p_symrot->restore_HR(ucell.symm, ucell.atoms, ucell.st, 'H', Hs_a2D);
223223
// cal energy using full Hs without repeat
224224
this->exx_lri.energy = this->exx_lri.post_2D.cal_energy(
225225
this->exx_lri.post_2D.saves["Ds_" + suffix],
@@ -274,20 +274,20 @@ post_process_old
274274
*/
275275

276276
template<typename Tdata>
277-
void Exx_LRI<Tdata>::cal_exx_force()
277+
void Exx_LRI<Tdata>::cal_exx_force(const int& nat)
278278
{
279279
ModuleBase::TITLE("Exx_LRI","cal_exx_force");
280280
ModuleBase::timer::tick("Exx_LRI", "cal_exx_force");
281281

282-
this->force_exx.create(GlobalC::ucell.nat, Ndim);
282+
this->force_exx.create(nat, Ndim);
283283
for(int is=0; is<PARAM.inp.nspin; ++is)
284284
{
285285
this->exx_lri.cal_force({"","",std::to_string(is),"",""});
286286
for(std::size_t idim=0; idim<Ndim; ++idim) {
287287
for(const auto &force_item : this->exx_lri.force[idim]) {
288288
this->force_exx(force_item.first, idim) += std::real(force_item.second);
289-
}
290-
}
289+
}
290+
}
291291
}
292292

293293
const double SPIN_multiple = std::map<int,double>{{1,2}, {2,1}, {4,1}}.at(PARAM.inp.nspin); // why?
@@ -298,7 +298,7 @@ void Exx_LRI<Tdata>::cal_exx_force()
298298

299299

300300
template<typename Tdata>
301-
void Exx_LRI<Tdata>::cal_exx_stress()
301+
void Exx_LRI<Tdata>::cal_exx_stress(const double& omega, const double& lat0)
302302
{
303303
ModuleBase::TITLE("Exx_LRI","cal_exx_stress");
304304
ModuleBase::timer::tick("Exx_LRI", "cal_exx_stress");
@@ -310,12 +310,12 @@ void Exx_LRI<Tdata>::cal_exx_stress()
310310
for(std::size_t idim0=0; idim0<Ndim; ++idim0) {
311311
for(std::size_t idim1=0; idim1<Ndim; ++idim1) {
312312
this->stress_exx(idim0,idim1) += std::real(this->exx_lri.stress(idim0,idim1));
313-
}
314-
}
313+
}
314+
}
315315
}
316316

317317
const double SPIN_multiple = std::map<int,double>{{1,2}, {2,1}, {4,1}}.at(PARAM.inp.nspin); // why?
318-
const double frac = 2 * SPIN_multiple / GlobalC::ucell.omega * GlobalC::ucell.lat0; // why?
318+
const double frac = 2 * SPIN_multiple / omega * lat0; // why?
319319
this->stress_exx *= frac;
320320

321321
ModuleBase::timer::tick("Exx_LRI", "cal_exx_stress");

0 commit comments

Comments
 (0)