Skip to content

Commit 06fc9aa

Browse files
committed
Merge branch 'develop' into cal_DMR_complex
2 parents 17f0164 + ea49bb2 commit 06fc9aa

File tree

459 files changed

+3230
-1232
lines changed

Some content is hidden

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

459 files changed

+3230
-1232
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3030,7 +3030,7 @@ These variables are relevant when using hybrid functionals with *[basis_type](#b
30303030
### exx_ccp_rmesh_times
30313031

30323032
- **Type**: Real
3033-
- **Description**: This parameter determines how many times larger the radial mesh required for calculating Columb potential is to that of atomic orbitals. The value should be at least 1. Reducing this value can effectively increase the speed of self-consistent calculations using hybrid functionals.
3033+
- **Description**: This parameter determines how many times larger the radial mesh required for calculating Columb potential is to that of atomic orbitals. The value should be larger than 0. Reducing this value can effectively increase the speed of self-consistent calculations using hybrid functionals.
30343034
- **Default**:
30353035
- 5: if *[dft_functional](#dft_functional)==hf/pbe0/scan0/muller/power/wp22*
30363036
- 1.5: if *[dft_functional](#dft_functional)==hse/cwp22*

source/source_base/sph_bessel_recursive-d2.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
//==========================================================
55

66
#include "sph_bessel_recursive.h"
7+
#include "constants.h"
8+
#include "source_base/memory.h"
79

810
#include<cmath>
911
#include<stdexcept>
1012

11-
#include "constants.h"
12-
1313
namespace ModuleBase
1414
{
1515

@@ -33,6 +33,7 @@ const std::vector<std::vector<std::vector<double>>> & Sph_Bessel_Recursive::D2::
3333
cal_jlx_0( lmax+1, ix1_size, ix2_size );
3434
cal_jlx_smallx( lmax+1, ix1_size, ix2_size );
3535
cal_jlx_recursive( lmax+1, ix1_size, ix2_size );
36+
ModuleBase::Memory::record("ORB::Jl(x)", sizeof(double) * (lmax+1) * ix1_size * ix2_size);
3637
return jlx;
3738
}
3839

@@ -41,7 +42,7 @@ void Sph_Bessel_Recursive::D2::cal_jlx_0( const int l_size, const size_t ix1_siz
4142
if(jlx.size() < static_cast<size_t>(l_size))
4243
jlx.resize(l_size);
4344

44-
for( int l=0; l!=l_size; ++l )
45+
for( int l=0; l<l_size; ++l )
4546
{
4647
const double jlx0 = (0==l) ? 1.0 : 0.0;
4748

source/source_base/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ AddTest(
7777
AddTest(
7878
TARGET MODULE_BASE_sph_bessel_recursive
7979
LIBS parameter
80-
SOURCES sph_bessel_recursive_test.cpp ../sph_bessel_recursive-d1.cpp ../sph_bessel_recursive-d2.cpp
80+
SOURCES sph_bessel_recursive_test.cpp ../sph_bessel_recursive-d1.cpp ../sph_bessel_recursive-d2.cpp ../memory.cpp ../global_variable.cpp
8181
)
8282
AddTest(
8383
TARGET MODULE_BASE_ylmreal

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_estate/module_pot/efield.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ double Efield::cal_induced_dipole(const UnitCell& cell,
227227

228228
Parallel_Reduce::reduce_pool(induced_dipole);
229229
induced_dipole *= cell.lat0 / bmod * ModuleBase::FOUR_PI / rho_basis->nxyz;
230-
230+
delete[] induced_rho;
231231
return induced_dipole;
232232
}
233233

@@ -360,4 +360,4 @@ void Efield::autoset(std::vector<double>& pos)
360360
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Autoset efield_pos_dec", efield_pos_dec);
361361
}
362362

363-
} // namespace elecstate
363+
} // namespace elecstate

source/source_io/cal_r_overlap_R.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ void cal_r_overlap_R::initialize_orb_table(const UnitCell& ucell,
3030
int Rmesh = static_cast<int>(orb.get_Rmax() / dr) + 4;
3131
Rmesh += 1 - Rmesh % 2;
3232

33-
int Lmax, Lmax_used;
34-
std::tie(Lmax_used, Lmax) = Center2_Orb::init_Lmax_2_3(lmax_orb);
33+
const int Lmax = lmax_orb + 1;
34+
const int Lmax_used = 2 * lmax_orb + 1;
3535
Center2_Orb::init_Table_Spherical_Bessel(Lmax_used,
3636
dr,
3737
dk,

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

0 commit comments

Comments
 (0)