Skip to content

Commit 695dc42

Browse files
authored
Merge branch 'develop' into Lmax_center2_3
2 parents 64d73a9 + 80cc432 commit 695dc42

File tree

365 files changed

+3002
-1039
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

365 files changed

+3002
-1039
lines changed

source/source_esolver/esolver_ks_lcao_tddft.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ void ESolver_KS_LCAO_TDDFT<TR, Device>::runner(UnitCell& ucell, const int istep)
103103
velocity_mat->calculate_vcomm_r();
104104
}
105105
int estep_max = (istep == 0 && !PARAM.inp.mdp.md_restart) ? 1 : PARAM.inp.estep_per_md;
106-
if (PARAM.inp.mdp.md_nstep == 0)
106+
// mohan change md_nstep from 0 to 1, 2026-01-04
107+
if (PARAM.inp.mdp.md_nstep == 1)
107108
{
108109
estep_max = PARAM.inp.estep_per_md + 1;
109110
}
@@ -194,7 +195,8 @@ void ESolver_KS_LCAO_TDDFT<TR, Device>::runner(UnitCell& ucell, const int istep)
194195
{
195196
break;
196197
}
197-
if (PARAM.inp.mdp.md_nstep != 0)
198+
// mohan add 2026-01-04, change md_nstep!=0 to md_nstep!=1
199+
if (PARAM.inp.mdp.md_nstep != 1)
198200
{
199201
estep -= 1;
200202
}

source/source_esolver/esolver_of.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ double ESolver_OF::cal_energy()
539539
this->pw_rho->nrxx,
540540
this->dV_);
541541
}
542-
Parallel_Reduce::reduce_all(pseudopot_energy);
542+
Parallel_Reduce::reduce_pool(pseudopot_energy);
543543
this->pelec->f_en.ekinetic = kinetic_energy;
544544
this->pelec->f_en.e_local_pp = pseudopot_energy;
545545
this->pelec->f_en.etot += kinetic_energy + pseudopot_energy;

source/source_estate/elecstate_energy_terms.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,13 @@ double ElecState::get_local_pp_energy()
4545
for (int is = 0; is < PARAM.inp.nspin; ++is)
4646
{
4747
local_pseudopot_energy
48-
+= BlasConnector::dot(this->charge->rhopw->nrxx, this->pot->get_fixed_v(), 1, this->charge->rho[is], 1)
49-
* this->charge->rhopw->omega / this->charge->rhopw->nxyz;
48+
+= BlasConnector::dot(this->charge->rhopw->nrxx,
49+
this->pot->get_fixed_v(),
50+
1,
51+
this->charge->rho[is], 1)
52+
* this->charge->rhopw->omega / this->charge->rhopw->nxyz;
5053
}
51-
Parallel_Reduce::reduce_all(local_pseudopot_energy);
54+
Parallel_Reduce::reduce_pool(local_pseudopot_energy);
5255
return local_pseudopot_energy;
5356
}
5457

source/source_estate/module_dm/cal_dm_psi.cpp

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -164,24 +164,24 @@ void psiMulPsiMpi(const psi::Psi<double>& psi1,
164164
const int nlocal = desc_dm[2];
165165
const int nbands = desc_psi[3];
166166

167-
pdgemm_(&N_char,
168-
&T_char,
169-
&nlocal,
170-
&nlocal,
171-
&nbands,
172-
&one_float,
167+
ScalapackConnector::gemm(N_char,
168+
T_char,
169+
nlocal,
170+
nlocal,
171+
nbands,
172+
one_float,
173173
psi1.get_pointer(),
174-
&one_int,
175-
&one_int,
174+
one_int,
175+
one_int,
176176
desc_psi,
177177
psi2.get_pointer(),
178-
&one_int,
179-
&one_int,
178+
one_int,
179+
one_int,
180180
desc_psi,
181-
&zero_float,
181+
zero_float,
182182
dm_out,
183-
&one_int,
184-
&one_int,
183+
one_int,
184+
one_int,
185185
desc_dm);
186186
ModuleBase::timer::tick("psiMulPsiMpi", "pdgemm");
187187
}
@@ -198,24 +198,24 @@ void psiMulPsiMpi(const psi::Psi<std::complex<double>>& psi1,
198198
const char N_char = 'N', T_char = 'T';
199199
const int nlocal = desc_dm[2];
200200
const int nbands = desc_psi[3];
201-
pzgemm_(&N_char,
202-
&T_char,
203-
&nlocal,
204-
&nlocal,
205-
&nbands,
206-
&one_complex,
201+
ScalapackConnector::gemm(N_char,
202+
T_char,
203+
nlocal,
204+
nlocal,
205+
nbands,
206+
one_complex,
207207
psi1.get_pointer(),
208-
&one_int,
209-
&one_int,
208+
one_int,
209+
one_int,
210210
desc_psi,
211211
psi2.get_pointer(),
212-
&one_int,
213-
&one_int,
212+
one_int,
213+
one_int,
214214
desc_psi,
215-
&zero_complex,
215+
zero_complex,
216216
dm_out,
217-
&one_int,
218-
&one_int,
217+
one_int,
218+
one_int,
219219
desc_dm);
220220
ModuleBase::timer::tick("psiMulPsiMpi", "pdgemm");
221221
}
@@ -229,19 +229,19 @@ void psiMulPsi(const psi::Psi<double>& psi1, const psi::Psi<double>& psi2, doubl
229229
const char N_char = 'N', T_char = 'T';
230230
const int nlocal = psi1.get_nbasis();
231231
const int nbands = psi1.get_nbands();
232-
dgemm_(&N_char,
233-
&T_char,
234-
&nlocal,
235-
&nlocal,
236-
&nbands,
237-
&one_float,
232+
BlasConnector::gemm_cm(N_char,
233+
T_char,
234+
nlocal,
235+
nlocal,
236+
nbands,
237+
one_float,
238238
psi1.get_pointer(),
239-
&nlocal,
239+
nlocal,
240240
psi2.get_pointer(),
241-
&nlocal,
242-
&zero_float,
241+
nlocal,
242+
zero_float,
243243
dm_out,
244-
&nlocal);
244+
nlocal);
245245
}
246246

247247
void psiMulPsi(const psi::Psi<std::complex<double>>& psi1,
@@ -254,19 +254,19 @@ void psiMulPsi(const psi::Psi<std::complex<double>>& psi1,
254254
const int nbands = psi1.get_nbands();
255255
const std::complex<double> one_complex = {1.0, 0.0};
256256
const std::complex<double> zero_complex = {0.0, 0.0};
257-
zgemm_(&N_char,
258-
&T_char,
259-
&nlocal,
260-
&nlocal,
261-
&nbands,
262-
&one_complex,
257+
BlasConnector::gemm_cm(N_char,
258+
T_char,
259+
nlocal,
260+
nlocal,
261+
nbands,
262+
one_complex,
263263
psi1.get_pointer(),
264-
&nlocal,
264+
nlocal,
265265
psi2.get_pointer(),
266-
&nlocal,
267-
&zero_complex,
266+
nlocal,
267+
zero_complex,
268268
dm_out,
269-
&nlocal);
269+
nlocal);
270270
}
271271

272272
} // namespace elecstate

source/source_io/filename.cpp

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,27 +47,33 @@ std::string filename_output(
4747

4848
// spin part
4949
std::string spin_block;
50-
if(nspin == 1)
51-
{
52-
}
53-
else if(nspin == 2)
50+
51+
// mohan add 2026-01-04, overlap matrix is the same for any spin
52+
if(property != "sk")
5453
{
55-
const int half_k = nkstot/2;
56-
if(ik0 >= half_k)
54+
if(nspin == 1)
5755
{
58-
is0 = 2;
59-
ik0 -= half_k;
56+
// do nothing
6057
}
61-
else
58+
else if(nspin == 2)
6259
{
63-
is0 = 1;
60+
const int half_k = nkstot/2;
61+
if(ik0 >= half_k)
62+
{
63+
is0 = 2;
64+
ik0 -= half_k;
65+
}
66+
else
67+
{
68+
is0 = 1;
69+
}
70+
spin_block = "s" + std::to_string(is0);
71+
}
72+
else if(nspin==4)
73+
{
74+
is0 = 4;
75+
spin_block = "s" + std::to_string(is0);
6476
}
65-
spin_block = "s" + std::to_string(is0);
66-
}
67-
else if(nspin==4)
68-
{
69-
is0 = 4;
70-
spin_block = "s" + std::to_string(is0);
7177
}
7278

7379

source/source_io/output_mulliken.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -547,24 +547,24 @@ void Output_Mulliken<std::complex<double>>::cal_orbMulP()
547547
const char N_char = 'N';
548548
const int one_int = 1;
549549
const std::complex<double> one_float = {1.0, 0.0}, zero_float = {0.0, 0.0};
550-
pzgemm_(&N_char,
551-
&T_char,
552-
&nw,
553-
&nw,
554-
&nw,
555-
&one_float,
550+
ScalapackConnector::gemm(N_char,
551+
T_char,
552+
nw,
553+
nw,
554+
nw,
555+
one_float,
556556
p_DMk,
557-
&one_int,
558-
&one_int,
557+
one_int,
558+
one_int,
559559
this->ParaV_->desc,
560560
p_Sk,
561-
&one_int,
562-
&one_int,
561+
one_int,
562+
one_int,
563563
this->ParaV_->desc,
564-
&zero_float,
564+
zero_float,
565565
mud.c,
566-
&one_int,
567-
&one_int,
566+
one_int,
567+
one_int,
568568
this->ParaV_->desc);
569569
this->collect_MW(MecMulP, mud, nw, this->isk_[ik]);
570570
#endif
@@ -597,24 +597,24 @@ void Output_Mulliken<double>::cal_orbMulP()
597597
const char N_char = 'N';
598598
const int one_int = 1;
599599
const double one_float = 1.0, zero_float = 0.0;
600-
pdgemm_(&N_char,
601-
&T_char,
602-
&nw,
603-
&nw,
604-
&nw,
605-
&one_float,
600+
ScalapackConnector::gemm(N_char,
601+
T_char,
602+
nw,
603+
nw,
604+
nw,
605+
one_float,
606606
p_DMk,
607-
&one_int,
608-
&one_int,
607+
one_int,
608+
one_int,
609609
this->ParaV_->desc,
610610
p_Sk,
611-
&one_int,
612-
&one_int,
611+
one_int,
612+
one_int,
613613
this->ParaV_->desc,
614-
&zero_float,
614+
zero_float,
615615
mud.c,
616-
&one_int,
617-
&one_int,
616+
one_int,
617+
one_int,
618618
this->ParaV_->desc);
619619
if (this->nspin_ == 1 || this->nspin_ == 2)
620620
{

source/source_io/td_current_io.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,14 @@ void ModuleIO::write_current(const UnitCell& ucell,
180180
// write end
181181
if (GlobalV::MY_RANK == 0)
182182
{
183-
std::string filename = PARAM.globalv.global_out_dir + "current_total.txt";
183+
std::string filename = PARAM.globalv.global_out_dir + "current_tot.txt";
184184
std::ofstream fout;
185185
fout.open(filename, std::ios::app);
186186
fout << std::setprecision(16);
187187
fout << std::scientific;
188-
fout << istep << " " << current_total[0]/omega << " " << current_total[1]/omega << " " << current_total[2]/omega << std::endl;
188+
fout << istep+1 << " " << current_total[0]/omega
189+
<< " " << current_total[1]/omega
190+
<< " " << current_total[2]/omega << std::endl;
189191
fout.close();
190192
}
191193

@@ -559,26 +561,30 @@ void ModuleIO::write_current_eachk(const UnitCell& ucell,
559561
// MPI_Reduce(local_current_ik, current_ik, 3, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
560562
if (GlobalV::MY_RANK == 0 && TD_info::out_current_k)
561563
{
562-
std::string filename = PARAM.globalv.global_out_dir + "current_spin" + std::to_string(is) + "_ik"
563-
+ std::to_string(ik) + ".txt";
564+
std::string filename = PARAM.globalv.global_out_dir + "current_s" + std::to_string(is) + "k"
565+
+ std::to_string(ik+1) + ".txt";
564566
std::ofstream fout;
565567
fout.open(filename, std::ios::app);
566568
fout << std::setprecision(16);
567569
fout << std::scientific;
568-
fout << istep << " " << current_ik[0]/omega << " " << current_ik[1]/omega << " " << current_ik[2]/omega << std::endl;
570+
fout << istep+1 << " " << current_ik[0]/omega
571+
<< " " << current_ik[1]/omega
572+
<< " " << current_ik[2]/omega << std::endl;
569573
fout.close();
570574
}
571575
// write end
572576
} // end nks
573577
} // end is
574578
if (GlobalV::MY_RANK == 0)
575579
{
576-
std::string filename = PARAM.globalv.global_out_dir + "current_total.txt";
580+
std::string filename = PARAM.globalv.global_out_dir + "current_tot.txt";
577581
std::ofstream fout;
578582
fout.open(filename, std::ios::app);
579583
fout << std::setprecision(16);
580584
fout << std::scientific;
581-
fout << istep << " " << current_total[0]/omega << " " << current_total[1]/omega << " " << current_total[2]/omega << std::endl;
585+
fout << istep+1 << " " << current_total[0]/omega
586+
<< " " << current_total[1]/omega
587+
<< " " << current_total[2]/omega << std::endl;
582588
fout.close();
583589
}
584590

0 commit comments

Comments
 (0)