Skip to content

Commit 472f6ef

Browse files
committed
update
1 parent d365a6e commit 472f6ef

File tree

13 files changed

+78
-44
lines changed

13 files changed

+78
-44
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@
375375
- [out\_wannier\_unk](#out_wannier_unk)
376376
- [out\_wannier\_wvfn\_formatted](#out_wannier_wvfn_formatted)
377377
- [rt-TDDFT: Real-time time dependent density functional theory](#tddft-time-dependent-density-functional-theory)
378+
- [estep\_per\_md](#estep_per_md)
379+
- [td\_dt](#td_dt)
378380
- [td\_edm](#td_edm)
379381
- [td\_print\_eij](#td_print_eij)
380382
- [td\_propagator](#td_propagator)
@@ -3687,6 +3689,18 @@ These variables are used to control berry phase and wannier90 interface paramete
36873689

36883690
## TDDFT: time dependent density functional theory
36893691

3692+
### estep_per_md
3693+
3694+
- **Type**: Integer
3695+
- **Description**: The number of electron propagation steps between two ionic steps.
3696+
- **Default**: 1
3697+
3698+
### td_dt
3699+
3700+
- **Type**: Real
3701+
- **Description**: The time step used in electron propagation. Setting td_dt will reset the md_dt value to td_dt * estep_per_md.
3702+
- **Default**: md_dt/estep_per_md
3703+
36903704
### td_edm
36913705

36923706
- **Type**: Integer
@@ -3739,6 +3753,7 @@ These variables are used to control berry phase and wannier90 interface paramete
37393753
Type of electric field in space domain
37403754
- 0: length gauge.
37413755
- 1: velocity gauge.
3756+
- 2: hybrid gauge.
37423757
- **Default**: 0
37433758

37443759
### td_ttype

source/source_esolver/esolver_ks_lcao_tddft.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ void ESolver_KS_LCAO_TDDFT<TR, Device>::runner(UnitCell& ucell, const int istep)
144144
{
145145
elecstate::H_TDDFT_pw::update_At();
146146
td_p->cal_cart_At(elecstate::H_TDDFT_pw::At);
147-
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Ax(t)", td_p->cart_At[0]);
148-
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Ay(t)", td_p->cart_At[1]);
149-
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Az(t)", td_p->cart_At[2]);
147+
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Ax(t)", TD_info::cart_At[0]);
148+
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Ay(t)", TD_info::cart_At[1]);
149+
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Az(t)", TD_info::cart_At[2]);
150150
}
151151

152152
if(estep!=0)
@@ -588,7 +588,7 @@ void ESolver_KS_LCAO_TDDFT<TR, Device>::weight_dm_rho(const UnitCell& ucell)
588588
elecstate::cal_dm_psi(_pes->DM->get_paraV_pointer(), _pes->wg, this->psi[0], *(_pes->DM));
589589
if(PARAM.inp.td_stype == 2)
590590
{
591-
_pes->DM->cal_DMR_td(ucell, td_p->cart_At);
591+
_pes->DM->cal_DMR_td(ucell, TD_info::cart_At);
592592
}
593593
else
594594
{

source/source_io/td_current_io.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void ModuleIO::write_current(const UnitCell& ucell,
5858
{
5959
if (TD_info::td_vel_op == nullptr)
6060
{
61-
ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gauge infos is null!");
61+
ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gague infos is null!");
6262
}
6363
for (int dir = 0; dir < 3; dir++)
6464
{
@@ -250,12 +250,12 @@ void ModuleIO::cal_tmp_DM_k(const UnitCell& ucell,
250250
double arg_td = 0.0;
251251
if(elecstate::H_TDDFT_pw::stype == 2)
252252
{
253-
//cal tddft phase for hybrid gauge
253+
//cal tddft phase for hybrid gague
254254
const int iat1 = tmp_ap_real.get_atom_i();
255255
const int iat2 = tmp_ap_real.get_atom_j();
256256
ModuleBase::Vector3<double> dtau = ucell.cal_dtau(iat1, iat2, r_index);
257257
double& tmp_lat0 = ucell.lat0;
258-
arg_td = TD_info::td_vel_op->cart_At * dtau * tmp_lat0;
258+
arg_td = TD_info::cart_At * dtau * tmp_lat0;
259259
}
260260
// cal k_phase
261261
// if TK==std::complex<double>, kphase is e^{ikR}
@@ -320,12 +320,12 @@ void ModuleIO::cal_tmp_DM_k(const UnitCell& ucell,
320320
if(elecstate::H_TDDFT_pw::stype == 2)
321321
{
322322
//new
323-
//cal tddft phase for mixing gauge
323+
//cal tddft phase for mixing gague
324324
const int iat1 = tmp_ap_real.get_atom_i();
325325
const int iat2 = tmp_ap_real.get_atom_j();
326326
ModuleBase::Vector3<double> dtau = ucell.cal_dtau(iat1, iat2, r_index);
327327
double& tmp_lat0 = ucell.lat0;
328-
arg_td = TD_info::td_vel_op->cart_At * dtau * tmp_lat0;
328+
arg_td = TD_info::cart_At * dtau * tmp_lat0;
329329
}
330330
const double arg = (DM_real.get_kvec_d()[ik] * dR) * ModuleBase::TWO_PI + arg_td;
331331
double sinp, cosp;
@@ -424,7 +424,7 @@ void ModuleIO::write_current_eachk(const UnitCell& ucell,
424424
{
425425
if (TD_info::td_vel_op == nullptr)
426426
{
427-
ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gauge infos is null!");
427+
ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gague infos is null!");
428428
}
429429
for (int dir = 0; dir < 3; dir++)
430430
{

source/source_lcao/module_deepks/test/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ add_executable(
3737
../../../source_lcao/module_operator_lcao/deepks_lcao.cpp
3838
../../../source_lcao/module_operator_lcao/operator_lcao.cpp
3939
../../../source_hamilt/operator.cpp
40+
../../../source_lcao/module_rt/td_info.cpp
41+
../../../source_lcao/module_rt/td_folding.cpp
42+
../../../source_estate/module_pot/H_TDDFT_pw.cpp
4043
)
4144

4245
target_link_libraries(

source/source_lcao/module_operator_lcao/operator_lcao.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#endif
1414

1515
#include "source_lcao/module_rt/td_info.h"
16+
#include "source_lcao/module_rt/td_folding.h"
1617

1718
namespace hamilt {
1819

@@ -268,7 +269,7 @@ void OperatorLCAO<TK, TR>::contributeHk(int ik) {
268269
const int nrow = this->hsk->get_pv()->get_row_size();
269270
if(PARAM.inp.td_stype == 2)
270271
{
271-
TD_info::td_vel_op->folding_HR_td(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], nrow, 1);
272+
module_rt::folding_HR_td(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], nrow, 1, TD_info::td_vel_op->get_ucell(), TD_info::cart_At);
272273
}
273274
else
274275
{
@@ -280,7 +281,7 @@ void OperatorLCAO<TK, TR>::contributeHk(int ik) {
280281
const int ncol = this->hsk->get_pv()->get_col_size();
281282
if(PARAM.inp.td_stype == 2)
282283
{
283-
TD_info::td_vel_op->folding_HR_td(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], ncol, 0);
284+
module_rt::folding_HR_td(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], ncol, 0, TD_info::td_vel_op->get_ucell(), TD_info::cart_At);
284285
}
285286
else
286287
{

source/source_lcao/module_operator_lcao/overlap_new.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "source_lcao/module_hcontainer/hcontainer_funcs.h"
99
#include <vector>
1010
#include "source_lcao/module_rt/td_info.h"
11+
#include "source_lcao/module_rt/td_folding.h"
1112

1213
template <typename TK, typename TR>
1314
hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::OverlapNew(HS_Matrix_K<TK>* hsk_in,
@@ -231,7 +232,7 @@ void hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::contributeHk(int ik)
231232
const int nrow = this->SR->get_atom_pair(0).get_paraV()->get_row_size();
232233
if(PARAM.inp.td_stype == 2)
233234
{
234-
TD_info::td_vel_op->folding_HR_td(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], nrow, 1);
235+
module_rt::folding_HR_td(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], nrow, 1, ucell, TD_info::cart_At);
235236
}
236237
else
237238
{
@@ -243,7 +244,7 @@ void hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::contributeHk(int ik)
243244
const int ncol = this->SR->get_atom_pair(0).get_paraV()->get_col_size();
244245
if(PARAM.inp.td_stype == 2)
245246
{
246-
TD_info::td_vel_op->folding_HR_td(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], ncol, 0);
247+
module_rt::folding_HR_td(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], ncol, 0, ucell, TD_info::cart_At);
247248
}
248249
else
249250
{

source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ template <typename TK, typename TR>
227227
void TDEkinetic<OperatorLCAO<TK, TR>>::update_td()
228228
{
229229
//std::cout<<"velocity"<<std::endl;
230-
this->cart_At = TD_info::td_vel_op->cart_At;
230+
this->cart_At = TD_info::cart_At;
231231
}
232232

233233
template <typename TK, typename TR>

source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ template <typename TK, typename TR>
4545
void hamilt::TDNonlocal<hamilt::OperatorLCAO<TK, TR>>::update_td()
4646
{
4747
// calculate At in cartesian coorinates.
48-
this->cart_At = TD_info::td_vel_op->cart_At;
48+
this->cart_At = TD_info::cart_At;
4949
}
5050
// initialize_HR()
5151
template <typename TK, typename TR>

source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ void hamilt::TD_pot_hybrid<hamilt::OperatorLCAO<TK, TR>>::init_td()
238238
template <typename TK, typename TR>
239239
void hamilt::TD_pot_hybrid<hamilt::OperatorLCAO<TK, TR>>::update_td()
240240
{
241-
//std::cout<<"hybrid gauge" <<std::endl;
242-
this->cart_At = TD_info::td_vel_op->cart_At;
241+
//std::cout<<"hybrid gague" <<std::endl;
242+
this->cart_At = TD_info::cart_At;
243243
//std::cout<<"At: "<< TD_info::td_vel_op->cart_At[0] <<" "<<TD_info::td_vel_op->cart_At[1]<<" "<<TD_info::td_vel_op->cart_At[2]<<" "<<std::endl;
244244
Et = elecstate::H_TDDFT_pw::Et;
245245
}

source/source_lcao/module_rt/td_folding.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
#include "td_info.h"
1+
#include "td_folding.h"
22
#include "source_base/libm/libm.h"
3+
namespace module_rt{
34
template<typename TR>
4-
void TD_info::folding_HR_td(const hamilt::HContainer<TR>& hR,
5+
void folding_HR_td(const hamilt::HContainer<TR>& hR,
56
std::complex<double>* hk,
67
const ModuleBase::Vector3<double>& kvec_d_in,
78
const int ncol,
8-
const int hk_type)
9+
const int hk_type,
10+
const UnitCell& ucell,
11+
const ModuleBase::Vector3<double>& cart_At)
912
{
1013
#ifdef _OPENMP
1114
#pragma omp parallel for
@@ -18,11 +21,11 @@ void TD_info::folding_HR_td(const hamilt::HContainer<TR>& hR,
1821
const ModuleBase::Vector3<int> r_index = tmp.get_R_index(ir);
1922

2023
//new
21-
//cal tddft phase for hybrid gauge
24+
//cal tddft phase for hybrid gague
2225
const int iat1 = tmp.get_atom_i();
2326
const int iat2 = tmp.get_atom_j();
24-
ModuleBase::Vector3<double> dtau = ucell->cal_dtau(iat1, iat2, r_index);
25-
const double arg_td = cart_At * dtau * ucell->lat0;
27+
ModuleBase::Vector3<double> dtau = ucell.cal_dtau(iat1, iat2, r_index);
28+
const double arg_td = cart_At * dtau * ucell.lat0;
2629
//new
2730

2831
// cal k_phase
@@ -39,14 +42,19 @@ void TD_info::folding_HR_td(const hamilt::HContainer<TR>& hR,
3942
}
4043
}
4144
template
42-
void TD_info::folding_HR_td<double>(const hamilt::HContainer<double>& hR,
45+
void folding_HR_td<double>(const hamilt::HContainer<double>& hR,
4346
std::complex<double>* hk,
4447
const ModuleBase::Vector3<double>& kvec_d_in,
4548
const int ncol,
46-
const int hk_type);
49+
const int hk_type,
50+
const UnitCell& ucell,
51+
const ModuleBase::Vector3<double>& At);
4752
template
48-
void TD_info::folding_HR_td<std::complex<double>>(const hamilt::HContainer<std::complex<double>>& hR,
53+
void folding_HR_td<std::complex<double>>(const hamilt::HContainer<std::complex<double>>& hR,
4954
std::complex<double>* hk,
5055
const ModuleBase::Vector3<double>& kvec_d_in,
5156
const int ncol,
52-
const int hk_type);
57+
const int hk_type,
58+
const UnitCell& ucell,
59+
const ModuleBase::Vector3<double>& At);
60+
}// namespace module_rt

0 commit comments

Comments
 (0)