Skip to content

Commit 999c5ed

Browse files
authored
Merge branch 'develop' into feature/container-blas-and-lapack
2 parents 62d695a + ea6dbc7 commit 999c5ed

File tree

8 files changed

+28
-75
lines changed

8 files changed

+28
-75
lines changed

source/source_esolver/esolver_ks_lcao_tddft.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -447,20 +447,20 @@ void ESolver_KS_LCAO_TDDFT<TR, Device>::after_scf(UnitCell& ucell, const int ist
447447
// Output energy for sub-loop (electronic step)
448448
std::cout << " Potential (Ry): " << std::setprecision(15) << this->pelec->f_en.etot << std::endl;
449449

450-
ModuleIO::ctrl_output_td<TR>(
451-
ucell,
452-
this->chr.rho_save,
453-
this->chr.rhopw,
454-
istep,
455-
this->psi,
456-
this->pelec,
457-
this->kv,
458-
this->two_center_bundle_.overlap_orb.get(),
459-
dynamic_cast<const elecstate::ElecStateLCAO<std::complex<double>>*>(this->pelec)->get_DM()->get_paraV_pointer(),
460-
this->orb_,
461-
this->velocity_mat,
462-
this->RA,
463-
this->td_p);
450+
// Output dipole, current, etc.
451+
ModuleIO::ctrl_output_td<TR>(ucell,
452+
this->chr.rho_save,
453+
this->chr.rhopw,
454+
istep,
455+
this->psi,
456+
this->pelec,
457+
this->kv,
458+
this->two_center_bundle_.overlap_orb.get(),
459+
&this->pv,
460+
this->orb_,
461+
this->velocity_mat,
462+
this->RA,
463+
this->td_p);
464464

465465
ModuleBase::timer::tick(this->classname, "after_scf");
466466
}

source/source_io/ctrl_output_td.cpp

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -25,61 +25,6 @@ void ctrl_output_td(const UnitCell& ucell,
2525
{
2626
ModuleBase::TITLE("ModuleIO", "ctrl_output_td");
2727

28-
// Original code commented out, might need reference later
29-
30-
// // (1) Write dipole information
31-
// for (int is = 0; is < PARAM.inp.nspin; is++)
32-
// {
33-
// if (PARAM.inp.out_dipole == 1)
34-
// {
35-
// std::stringstream ss_dipole;
36-
// ss_dipole << PARAM.globalv.global_out_dir << "dipole_s" << is + 1 << ".txt";
37-
// ModuleIO::write_dipole(ucell, this->chr.rho_save[is], this->chr.rhopw, is, istep, ss_dipole.str());
38-
// }
39-
// }
40-
41-
// // (2) Write current information
42-
// elecstate::DensityMatrix<std::complex<double>, double>* tmp_DM
43-
// = dynamic_cast<elecstate::ElecStateLCAO<std::complex<double>>*>(this->pelec)->get_DM();
44-
// if (TD_info::out_current)
45-
// {
46-
// if (TD_info::out_current_k)
47-
// {
48-
// ModuleIO::write_current_eachk(ucell,
49-
// istep,
50-
// this->psi,
51-
// this->pelec,
52-
// this->kv,
53-
// this->two_center_bundle_.overlap_orb.get(),
54-
// tmp_DM->get_paraV_pointer(),
55-
// this->orb_,
56-
// this->velocity_mat,
57-
// this->RA);
58-
// }
59-
// else
60-
// {
61-
// ModuleIO::write_current(ucell,
62-
// istep,
63-
// this->psi,
64-
// this->pelec,
65-
// this->kv,
66-
// this->two_center_bundle_.overlap_orb.get(),
67-
// tmp_DM->get_paraV_pointer(),
68-
// this->orb_,
69-
// this->velocity_mat,
70-
// this->RA);
71-
// }
72-
// }
73-
74-
// // (3) Output file for restart
75-
// if (PARAM.inp.out_freq_ion > 0) // default value of out_freq_ion is 0
76-
// {
77-
// if (istep % PARAM.inp.out_freq_ion == 0)
78-
// {
79-
// td_p->out_restart_info(istep, elecstate::H_TDDFT_pw::At, elecstate::H_TDDFT_pw::At_laststep);
80-
// }
81-
// }
82-
8328
#ifdef __LCAO
8429
// (1) Write dipole information
8530
for (int is = 0; is < PARAM.inp.nspin; ++is)

source/source_lcao/module_deepks/deepks_basic.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,15 @@ void DeePKS_domain::cal_edelta_gedm(const int nat,
197197
// input_dim:(natom, des_per_atom)
198198
inputs.push_back(torch::cat(descriptor, 0).reshape({1, nat, des_per_atom}));
199199
std::vector<torch::Tensor> ec;
200-
ec.push_back(model_deepks.forward(inputs).toTensor()); // Hartree
200+
try
201+
{
202+
ec.push_back(model_deepks.forward(inputs).toTensor()); // Hartree
203+
}
204+
catch (const c10::Error& e)
205+
{
206+
ModuleBase::WARNING_QUIT("DeePKS_domain::cal_edelta_gedm", "Please check whether the input shape required by model file matches the descriptor!");
207+
throw;
208+
}
201209
E_delta = ec[0].item<double>() * 2; // Ry; *2 is for Hartree to Ry
202210

203211
// cal gedm

source/source_lcao/module_deepks/deepks_pdm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void DeePKS_domain::read_pdm(bool read_pdm_file,
3737
{
3838
if (read_pdm_file && !init_pdm) // for DeePKS NSCF calculation
3939
{
40-
const std::string file_projdm = PARAM.globalv.global_out_dir + "deepks_projdm.dat";
40+
const std::string file_projdm = PARAM.globalv.global_readin_dir + "deepks_projdm.dat";
4141
std::ifstream ifs(file_projdm.c_str());
4242

4343
if (!ifs)

source/source_lcao/spar_hsr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ void sparse_format::cal_HSR(const UnitCell& ucell,
9292
// cal_STN_R_sparse(current_spin, sparse_thr);
9393
if (nspin == 1 || nspin == 2)
9494
{
95-
hamilt::HamiltLCAO<std::complex<double>, double>* p_ham_lcao
96-
= dynamic_cast<hamilt::HamiltLCAO<std::complex<double>, double>*>(p_ham);
95+
hamilt::HamiltLCAO<TK, double>* p_ham_lcao
96+
= dynamic_cast<hamilt::HamiltLCAO<TK, double>*>(p_ham);
9797

9898
HS_Arrays.all_R_coor = get_R_range(*(p_ham_lcao->getHR()));
9999

source/source_lcao/spar_st.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ void sparse_format::cal_SR(
2828
// cal_STN_R_sparse(current_spin, sparse_thr);
2929
if (nspin == 1 || nspin == 2)
3030
{
31-
hamilt::HamiltLCAO<std::complex<double>, double>* p_ham_lcao
32-
= dynamic_cast<hamilt::HamiltLCAO<std::complex<double>, double>*>(p_ham);
31+
hamilt::HamiltLCAO<TK, double>* p_ham_lcao
32+
= dynamic_cast<hamilt::HamiltLCAO<TK, double>*>(p_ham);
3333
const int cspin = 0;
3434
sparse_format::cal_HContainer<double>(pv, sparse_thr, *(p_ham_lcao->getSR()), SR_sparse);
3535
}

0 commit comments

Comments
 (0)