Skip to content

Commit bac726b

Browse files
authored
Add files via upload
1 parent eca5f43 commit bac726b

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

source/module_esolver/esolver_ks_lcao_tddft.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,50 @@ void ESolver_KS_LCAO_TDDFT::before_all_runners(const Input_para& inp, UnitCell&
116116

117117
// this line should be optimized
118118
this->pelec_td = dynamic_cast<elecstate::ElecStateLCAO_TDDFT*>(this->pelec);
119+
120+
this->atoms_fixed = !ucell.if_atoms_can_move();
119121
}
122+
void ESolver_KS_LCAO_TDDFT::cal_force(ModuleBase::matrix& force)
123+
{
124+
if(atoms_fixed)
125+
{
126+
return;
127+
}
128+
ModuleBase::TITLE("ESolver_KS_LCAO_TDDFT", "cal_force");
129+
ModuleBase::timer::tick("ESolver_KS_LCAO_TDDFT", "cal_force");
130+
131+
Force_Stress_LCAO<std::complex<>double> fsl(this->RA, GlobalC::ucell.nat);
132+
133+
fsl.getForceStress(PARAM.inp.cal_force,
134+
PARAM.inp.cal_stress,
135+
PARAM.inp.test_force,
136+
PARAM.inp.test_stress,
137+
this->pv,
138+
this->pelec,
139+
this->psi,
140+
this->GG, // mohan add 2024-04-01
141+
this->GK, // mohan add 2024-04-01
142+
two_center_bundle_,
143+
orb_,
144+
force,
145+
this->scs,
146+
this->sf,
147+
this->kv,
148+
this->pw_rho,
149+
#ifdef __EXX
150+
*this->exx_lri_double,
151+
*this->exx_lri_complex,
152+
#endif
153+
&GlobalC::ucell.symm);
120154

155+
// delete RA after cal_force
156+
157+
this->RA.delete_grid();
158+
159+
this->have_force = true;
160+
161+
ModuleBase::timer::tick("ESolver_KS_LCAO_TDDFT", "cal_force");
162+
}
121163
void ESolver_KS_LCAO_TDDFT::hamilt2density(const int istep, const int iter, const double ethr)
122164
{
123165
pelec->charge->save_rho_before_sum_band();

source/module_esolver/esolver_ks_lcao_tddft.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class ESolver_KS_LCAO_TDDFT : public ESolver_KS_LCAO<std::complex<double>, doubl
1818

1919
void before_all_runners(const Input_para& inp, UnitCell& cell) override;
2020

21+
void cal_force(ModuleBase::matrix& force) override;
22+
2123
psi::Psi<std::complex<double>>* psi_laststep = nullptr;
2224

2325
std::complex<double>** Hk_laststep = nullptr;
@@ -37,6 +39,8 @@ class ESolver_KS_LCAO_TDDFT : public ESolver_KS_LCAO<std::complex<double>, doubl
3739
virtual void after_scf(const int istep) override;
3840

3941
void cal_edm_tddft();
42+
43+
bool atom_fixed = false;
4044
};
4145

4246
} // namespace ModuleESolver

0 commit comments

Comments
 (0)