Skip to content

Commit fc061bb

Browse files
authored
Add files via upload
1 parent b326fe8 commit fc061bb

23 files changed

+1605
-141
lines changed

source/source_lcao/hamilt_lcaodft/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ if(ENABLE_LCAO)
1313
operator_lcao/nonlocal_new.cpp
1414
operator_lcao/td_ekinetic_lcao.cpp
1515
operator_lcao/td_nonlocal_lcao.cpp
16+
operator_lcao/td_pot_hybrid.cpp
1617
operator_lcao/dspin_lcao.cpp
1718
operator_lcao/dftu_lcao.cpp
1819
pulay_force_stress_center2.cpp

source/source_lcao/hamilt_lcaodft/hamilt_lcao.cpp

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
#include "source_base/global_variable.h"
44
#include "source_base/memory.h"
55
#include "source_base/timer.h"
6-
#include "source_lcao/module_dftu/dftu.h"
6+
#include "module_hamilt_lcao/module_dftu/dftu.h"
77
#include "source_pw/hamilt_pwdft/global.h"
88
#include "module_parameter/parameter.h"
99

1010
#include <vector>
1111

1212
#ifdef __MLALGO
13-
#include "source_lcao/module_deepks/LCAO_deepks.h"
13+
#include "module_hamilt_lcao/module_deepks/LCAO_deepks.h"
1414
#include "operator_lcao/deepks_lcao.h"
1515
#endif
1616

@@ -25,8 +25,8 @@
2525

2626
#include "source_estate/module_pot/H_TDDFT_pw.h"
2727
#include "source_hamilt/module_xc/xc_functional.h"
28-
#include "source_lcao/module_deltaspin/spin_constrain.h"
29-
#include "source_lcao/module_hcontainer/hcontainer_funcs.h"
28+
#include "module_hamilt_lcao/module_deltaspin/spin_constrain.h"
29+
#include "module_hamilt_lcao/module_hcontainer/hcontainer_funcs.h"
3030
#include "source_hsolver/hsolver_lcao.h"
3131
#include "operator_lcao/dftu_lcao.h"
3232
#include "operator_lcao/dspin_lcao.h"
@@ -38,6 +38,7 @@
3838
#include "operator_lcao/overlap_new.h"
3939
#include "operator_lcao/td_ekinetic_lcao.h"
4040
#include "operator_lcao/td_nonlocal_lcao.h"
41+
#include "operator_lcao/td_pot_hybrid.h"
4142
#include "operator_lcao/veff_lcao.h"
4243

4344
namespace hamilt
@@ -344,12 +345,8 @@ HamiltLCAO<TK, TR>::HamiltLCAO(Gint_Gamma* GG_in,
344345
}
345346
#endif
346347
// TDDFT_velocity_gauge
347-
if (TD_Velocity::tddft_velocity)
348+
if (PARAM.inp.esolver_type == "tddft" && PARAM.inp.td_stype == 1)
348349
{
349-
if (!TD_Velocity::init_vecpot_file)
350-
{
351-
elecstate::H_TDDFT_pw::update_At();
352-
}
353350
Operator<TK>* td_ekinetic = new TDEkinetic<OperatorLCAO<TK, TR>>(this->hsk,
354351
this->hR,
355352
this->kv,
@@ -359,10 +356,27 @@ HamiltLCAO<TK, TR>::HamiltLCAO(Gint_Gamma* GG_in,
359356
two_center_bundle.overlap_orb.get());
360357
this->getOperator()->add(td_ekinetic);
361358

362-
Operator<TK>* td_nonlocal
363-
= new TDNonlocal<OperatorLCAO<TK, TR>>(this->hsk, this->kv->kvec_d, this->hR, &ucell, orb, &grid_d);
359+
Operator<TK>* td_nonlocal = new TDNonlocal<OperatorLCAO<TK, TR>>(this->hsk,
360+
this->kv->kvec_d,
361+
this->hR,
362+
&ucell,
363+
orb,
364+
&grid_d);
364365
this->getOperator()->add(td_nonlocal);
365366
}
367+
if (PARAM.inp.esolver_type == "tddft" && PARAM.inp.td_stype == 2)
368+
{
369+
Operator<TK>* td_pot_hybrid = new TD_pot_hybrid<OperatorLCAO<TK, TR>>(this->hsk,
370+
this->kv,
371+
this->hR,
372+
this->sR,
373+
orb,
374+
&ucell,
375+
orb.cutoffs(),
376+
&grid_d,
377+
two_center_bundle.kinetic_orb.get());
378+
this->getOperator()->add(td_pot_hybrid);
379+
}
366380
if (PARAM.inp.dft_plus_u)
367381
{
368382
Operator<TK>* dftu = nullptr;

source/source_lcao/hamilt_lcaodft/operator_lcao/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ add_library(
1111
nonlocal_new.cpp
1212
td_ekinetic_lcao.cpp
1313
td_nonlocal_lcao.cpp
14+
td_pot_hybrid.cpp
1415
dspin_lcao.cpp
1516
dftu_lcao.cpp
1617
)

source/source_lcao/hamilt_lcaodft/operator_lcao/operator_lcao.cpp

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "source_base/timer.h"
44
#include "source_base/tool_title.h"
5-
#include "source_lcao/module_hcontainer/hcontainer_funcs.h"
5+
#include "module_hamilt_lcao/module_hcontainer/hcontainer_funcs.h"
66
#include "source_hsolver/hsolver_lcao.h"
77

88
#include "module_parameter/parameter.h"
@@ -12,6 +12,8 @@
1212
#include "source_hsolver/diago_elpa_native.h"
1313
#endif
1414

15+
#include "module_hamilt_lcao/module_tddft/td_info.h"
16+
1517
namespace hamilt {
1618

1719
template <>
@@ -200,7 +202,7 @@ void OperatorLCAO<TK, TR>::init(const int ik_in) {
200202

201203
break;
202204
}
203-
case calculation_type::lcao_tddft_velocity: {
205+
case calculation_type::lcao_tddft_periodic: {
204206
if (!this->hr_done) {
205207
// in cal_type=lcao_fixed, HR should be updated by each sub-chain
206208
// nodes
@@ -240,8 +242,8 @@ void OperatorLCAO<TK, TR>::init(const int ik_in) {
240242
}
241243

242244
// contributeHk()
243-
template <typename TK, typename TR>
244-
void OperatorLCAO<TK, TR>::contributeHk(int ik) {
245+
template <>
246+
void OperatorLCAO<double, double>::contributeHk(int ik) {
245247
ModuleBase::TITLE("OperatorLCAO", "contributeHk");
246248
ModuleBase::timer::tick("OperatorLCAO", "contributeHk");
247249
if(ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER(PARAM.inp.ks_solver))
@@ -256,6 +258,37 @@ void OperatorLCAO<TK, TR>::contributeHk(int ik) {
256258
}
257259
ModuleBase::timer::tick("OperatorLCAO", "contributeHk");
258260
}
261+
// contributeHk()
262+
template <typename TK, typename TR>
263+
void OperatorLCAO<TK, TR>::contributeHk(int ik) {
264+
ModuleBase::TITLE("OperatorLCAO", "contributeHk");
265+
ModuleBase::timer::tick("OperatorLCAO", "contributeHk");
266+
if(ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER(PARAM.inp.ks_solver))
267+
{
268+
const int nrow = this->hsk->get_pv()->get_row_size();
269+
if(PARAM.inp.td_stype == 2)
270+
{
271+
TD_info::td_vel_op->folding_HR_td(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], nrow, 1);
272+
}
273+
else
274+
{
275+
hamilt::folding_HR(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], nrow, 1);
276+
}
277+
}
278+
else
279+
{
280+
const int ncol = this->hsk->get_pv()->get_col_size();
281+
if(PARAM.inp.td_stype == 2)
282+
{
283+
TD_info::td_vel_op->folding_HR_td(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], ncol, 0);
284+
}
285+
else
286+
{
287+
hamilt::folding_HR(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], ncol, 0);
288+
}
289+
}
290+
ModuleBase::timer::tick("OperatorLCAO", "contributeHk");
291+
}
259292

260293
template class OperatorLCAO<double, double>;
261294
template class OperatorLCAO<std::complex<double>, double>;

source/source_lcao/hamilt_lcaodft/operator_lcao/overlap_new.cpp

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
#include "source_base/timer.h"
55
#include "source_base/tool_title.h"
66
#include "source_cell/module_neighbor/sltk_grid_driver.h"
7-
#include "source_lcao/hamilt_lcaodft/operator_lcao/operator_lcao.h"
8-
#include "source_lcao/module_hcontainer/hcontainer_funcs.h"
7+
#include "module_hamilt_lcao/hamilt_lcaodft/operator_lcao/operator_lcao.h"
8+
#include "module_hamilt_lcao/module_hcontainer/hcontainer_funcs.h"
99
#include <vector>
10+
#include "module_hamilt_lcao/module_tddft/td_info.h"
1011

1112
template <typename TK, typename TR>
1213
hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::OverlapNew(HS_Matrix_K<TK>* hsk_in,
@@ -188,11 +189,11 @@ void hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::contributeHR()
188189
}
189190

190191
// contributeHk()
191-
template <typename TK, typename TR>
192-
void hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::contributeHk(int ik)
192+
template <>
193+
void hamilt::OverlapNew<hamilt::OperatorLCAO<double, double>>::contributeHk(int ik)
193194
{
194195
//! if k vector is not changed, then do nothing and return, only for gamma_only case
195-
if (this->kvec_d[ik] == this->kvec_d_old && std::is_same<TK, double>::value)
196+
if (this->kvec_d[ik] == this->kvec_d_old)
196197
{
197198
return;
198199
}
@@ -217,7 +218,44 @@ void hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::contributeHk(int ik)
217218

218219
ModuleBase::timer::tick("OverlapNew", "contributeHk");
219220
}
221+
template <typename TK, typename TR>
222+
void hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::contributeHk(int ik)
223+
{
224+
ModuleBase::TITLE("OverlapNew", "contributeHk");
225+
ModuleBase::timer::tick("OverlapNew", "contributeHk");
226+
227+
//! set SK to zero and then calculate SK for each k vector
228+
this->hsk->set_zero_sk();
229+
if (ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER(PARAM.inp.ks_solver))
230+
{
231+
const int nrow = this->SR->get_atom_pair(0).get_paraV()->get_row_size();
232+
if(PARAM.inp.td_stype == 2)
233+
{
234+
TD_info::td_vel_op->folding_HR_td(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], nrow, 1);
235+
}
236+
else
237+
{
238+
hamilt::folding_HR(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], nrow, 1);
239+
}
240+
}
241+
else
242+
{
243+
const int ncol = this->SR->get_atom_pair(0).get_paraV()->get_col_size();
244+
if(PARAM.inp.td_stype == 2)
245+
{
246+
TD_info::td_vel_op->folding_HR_td(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], ncol, 0);
247+
}
248+
else
249+
{
250+
hamilt::folding_HR(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], ncol, 0);
251+
}
252+
}
253+
254+
// update kvec_d_old
255+
this->kvec_d_old = this->kvec_d[ik];
220256

257+
ModuleBase::timer::tick("OverlapNew", "contributeHk");
258+
}
221259
template <typename TK, typename TR>
222260
TK* hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::getSk()
223261
{

0 commit comments

Comments
 (0)