Skip to content

Commit 6356f78

Browse files
author
abacus_fixer
committed
Merge remote-tracking branch 'upstream/develop' into pr-7857-merge-test
# Conflicts: # source/source_lcao/module_deltaspin/spin_constrain.cpp
2 parents 25ebd05 + c9bae03 commit 6356f78

17 files changed

Lines changed: 1938 additions & 552 deletions

File tree

source/Makefile.Objects

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ OBJS_PSI_INITIALIZER=psi_base.o\
470470
psi_init_atomic.o\
471471
psi_init_atom_rand.o\
472472
psi_init_nao.o\
473-
psi_init_nao_random.o\
473+
psi_init_nao_random.o
474474

475475
OBJS_PW=fft_bundle.o\
476476
fft_cpu.o\
@@ -691,7 +691,6 @@ OBJS_LCAO=evolve_elec.o\
691691
center2orb_orb21.o\
692692
center2orb_orb22.o\
693693
record_adj.o\
694-
wavefunc_in_pw.o\
695694

696695
OBJS_MODULE_RI=conv_coulomb_pot_k.o\
697696
exx_abfs-abfs_index.o\

source/source_basis/module_ao/test/orb_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ void test_orb::set_single_c2o(int TA, int TB, int LA, int NA, int LB, int NB)
213213
{
214214
this->test_center2_orb11[TA][TB][LA][NA][LB].insert(std::make_pair(
215215
NB,
216-
std::make_unique<c2o>(ORB.Phi[TA].PhiLN(LA, NA), ORB.Phi[TB].PhiLN(LB, NB), OGT.MOT.pSB, Center2_MGT)));
216+
std::unique_ptr<c2o>(new c2o(ORB.Phi[TA].PhiLN(LA, NA), ORB.Phi[TB].PhiLN(LB, NB), OGT.MOT.pSB, Center2_MGT))));
217217
}
218218
double test_orb::randr(double Rmax)
219219
{

source/source_hsolver/diago_pexsi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ DiagoPexsi<T>::DiagoPexsi(const Parallel_Orbitals* ParaV_in,
3434
}
3535

3636
this->ParaV = ParaV_in;
37-
this->ps = std::make_unique<pexsi::PEXSI_Solver>();
37+
this->ps.reset(new pexsi::PEXSI_Solver());
3838

3939
this->DM.resize(this->nspin_dm);
4040
this->EDM.resize(this->nspin_dm);

source/source_hsolver/kernels/cuda/diag_cusolvermp.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Diag_CusolverMP_gvd<inputT>::Diag_CusolverMP_gvd(const MPI_Comm mpi_comm,
5858
const int nacols,
5959
const int* desc)
6060
{
61-
// 构造函数的实现
61+
/// constructor implementation
6262
this->cblacs_ctxt = desc[1];
6363
this->nFull = desc[2];
6464

source/source_hsolver/test/diago_bpcg_test.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,18 @@ class DiagoBPCGPrepare
136136
const std::vector<T> &h_mat = DIAGOTEST::hmatrix_local;
137137
auto hpsi_func = [h_mat, dim](T *psi_in, T *hpsi_out,
138138
const int ld_psi, const int nvec) {
139-
auto one = std::make_unique<T>(1.0);
140-
auto zero = std::make_unique<T>(0.0);
141-
const T *one_ = one.get();
142-
const T *zero_ = zero.get();
139+
const T one(1.0);
140+
const T zero(0.0);
143141

144142
base_device::DEVICE_CPU *ctx = {};
145143
// hpsi_out(dim * nvec) = h_mat(dim * dim) * psi_in(dim * nvec)
146144
ModuleBase::gemm_op<T, base_device::DEVICE_CPU>()(
147145
'N', 'N',
148146
dim, nvec, dim,
149-
one_,
147+
&one,
150148
h_mat.data(), dim,
151149
psi_in, ld_psi,
152-
zero_,
150+
&zero,
153151
hpsi_out, ld_psi);
154152
};
155153
const int ndim = psi_local.get_current_ngk();

source/source_hsolver/test/diago_pexsi_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class PexsiPrepare
160160
std::cout << "nrow: " << hmtest.nrow << ", ncol: " << hmtest.ncol << ", nb: " << nb2d << std::endl;
161161
}
162162

163-
dh = std::make_unique<hsolver::DiagoPexsi<T>>(&po, PARAM.input.nspin, nlocal, PARAM.input.nelec);
163+
dh.reset(new hsolver::DiagoPexsi<T>(&po, PARAM.input.nspin, nlocal, PARAM.input.nelec));
164164
}
165165

166166
void distribute_data()

source/source_io/module_unk/berryphase.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void berryphase::set_kpoints(const K_Vectors& kv, const int direction)
113113

114114
nppstr = mp_x + 1;
115115
}
116-
else if (direction == 2) // 计算y方向
116+
else if (direction == 2) /// compute the y direction
117117
{
118118
const int num_string = mp_x * mp_z;
119119

@@ -163,7 +163,7 @@ void berryphase::set_kpoints(const K_Vectors& kv, const int direction)
163163

164164
nppstr = mp_y + 1;
165165
}
166-
else if (direction == 3) // 计算z方向
166+
else if (direction == 3) /// compute the z direction
167167
{
168168
const int num_string = mp_x * mp_y;
169169

source/source_io/module_wannier/to_wannier90_pw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "source_base/matrix.h"
1515
#include "source_base/matrix3.h"
1616
#include "source_cell/klist.h"
17-
#include "source_lcao/wavefunc_in_pw.h"
17+
#include "source_basis/module_pw/pw_basis_k.h"
1818
#include "source_psi/psi.h"
1919

2020
class toWannier90_PW : public toWannier90

source/source_lcao/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ if(ENABLE_LCAO)
6565
center2orb_orb11.cpp
6666
center2orb_orb21.cpp
6767
center2orb_orb22.cpp
68-
wavefunc_in_pw.cpp
6968
)
7069

7170
add_library(

source/source_lcao/module_ri/exx_lip.hpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "source_base/global_function.h"
1313
#include "source_base/vector3.h"
1414
#include "source_cell/klist.h"
15-
#include "source_lcao/wavefunc_in_pw.h"
1615
#include "source_base/module_external/lapack_connector.h"
1716
#include "source_base/parallel_global.h"
1817
#include "source_io/module_parameter/parameter.h"
@@ -325,14 +324,14 @@ void Exx_Lip<T, Device>::qkg2_exp(const int ik, const int iq)
325324
else
326325
{ this->recip_qkg2[ig] = 1.0 / qkg2; }
327326
this->sum2_factor += this->recip_qkg2[ig] * std::exp(-info.lambda * qkg2);
328-
this->recip_qkg2[ig] = sqrt(this->recip_qkg2[ig]);
327+
this->recip_qkg2[ig] = std::sqrt(this->recip_qkg2[ig]);
329328
}
330329
else if (Conv_Coulomb_Pot_K::Ccp_Type::Erfc == info.ccp_type)
331330
{
332331
if (std::abs(qkg2) < 1e-10)
333332
{ this->recip_qkg2[ig] = 1.0 / (2 * info.hse_omega); }
334333
else
335-
{ this->recip_qkg2[ig] = sqrt((1 - std::exp(-qkg2 / (4 * info.hse_omega * info.hse_omega))) / qkg2); }
334+
{ this->recip_qkg2[ig] = std::sqrt((1 - std::exp(-qkg2 / (4 * info.hse_omega * info.hse_omega))) / qkg2); }
336335
}
337336
else
338337
{
@@ -348,13 +347,13 @@ void Exx_Lip<T, Device>::b_cal(const int ik, const int iq, const int ib)
348347
ModuleBase::timer::start("Exx_Lip", "b_cal");
349348
const ModuleBase::Vector3<double> q_minus_k = this->q_pack->kv_ptr->kvec_d[iq] - this->k_pack->kv_ptr->kvec_d[ik];
350349
std::vector<T > mul_tmp(this->rho_basis->nrxx);
351-
for( size_t ir=0,ix=0; ix<this->rho_basis->nx; ++ix)
350+
for( std::size_t ir=0,ix=0; ix<this->rho_basis->nx; ++ix)
352351
{
353352
const Treal phase_x = q_minus_k.x * ix / this->rho_basis->nx;
354-
for( size_t iy=0; iy<this->rho_basis->ny; ++iy)
353+
for( std::size_t iy=0; iy<this->rho_basis->ny; ++iy)
355354
{
356355
const Treal phase_xy = phase_x + q_minus_k.y * iy / this->rho_basis->ny;
357-
for( size_t iz=this->rho_basis->startz_current; iz<this->rho_basis->startz_current+this->rho_basis->nplane; ++iz)
356+
for( std::size_t iz=this->rho_basis->startz_current; iz<this->rho_basis->startz_current+this->rho_basis->nplane; ++iz)
358357
{
359358
const Treal phase_xyz = phase_xy + q_minus_k.z * iz / this->rho_basis->nz;
360359
mul_tmp[ir] = std::exp(-phase_xyz * this->two_pi_i);
@@ -365,12 +364,12 @@ void Exx_Lip<T, Device>::b_cal(const int ik, const int iq, const int ib)
365364
}
366365

367366
std::vector<T> porter (this->rho_basis->nrxx);
368-
for(size_t iw=0; iw< PARAM.globalv.nlocal; ++iw)
367+
for(std::size_t iw=0; iw< PARAM.globalv.nlocal; ++iw)
369368
{
370369
auto& phi_w = this->phi[iw];
371-
for( size_t ir=0; ir<this->rho_basis->nrxx; ++ir)
370+
for( std::size_t ir=0; ir<this->rho_basis->nrxx; ++ir)
372371
{
373-
porter[ir] = conj(phi_w[ir]) * mul_tmp[ir] ;
372+
porter[ir] = std::conj(phi_w[ir]) * mul_tmp[ir] ;
374373
// porter[ir] = phi_w[ir] * psi_q_b[ir] *exp_tmp[ir] ;
375374
}
376375
T* const b_w = &this->b[iw * this->rho_basis->npw];
@@ -380,7 +379,7 @@ void Exx_Lip<T, Device>::b_cal(const int ik, const int iq, const int ib)
380379
this->b0[iw] = b_w[this->rho_basis->ig_gge0];
381380
} }
382381

383-
for (size_t ig = 0; ig < this->rho_basis->npw; ++ig)
382+
for (std::size_t ig = 0; ig < this->rho_basis->npw; ++ig)
384383
{ b_w[ig] *= this->recip_qkg2[ig]; }
385384
}
386385
ModuleBase::timer::end("Exx_Lip", "b_cal");
@@ -393,7 +392,7 @@ void Exx_Lip<T, Device>::sum3_cal(const int iq, const int ib)
393392
if (gzero_rank_in_pool == GlobalV::RANK_IN_POOL) {
394393
for (int iw_l = 0; iw_l < PARAM.globalv.nlocal; ++iw_l) {
395394
for (int iw_r = 0; iw_r < PARAM.globalv.nlocal; ++iw_r) {
396-
this->sum3[iw_l][iw_r] += this->b0[iw_l] * conj(this->b0[iw_r]) * (Treal)this->q_pack->wf_wg(iq, ib);
395+
this->sum3[iw_l][iw_r] += this->b0[iw_l] * std::conj(this->b0[iw_r]) * (Treal)this->q_pack->wf_wg(iq, ib);
397396
} } }
398397
ModuleBase::timer::end("Exx_Lip", "sum3_cal");
399398
}
@@ -426,9 +425,9 @@ void Exx_Lip<T, Device>::sum_all(const int ik)
426425
if (Conv_Coulomb_Pot_K::Ccp_Type::Ccp == info.ccp_type || Conv_Coulomb_Pot_K::Ccp_Type::Hf == info.ccp_type)
427426
{ MPI_Reduce(&this->sum2_factor, &sum2_factor_g, 1, MPI_DOUBLE, MPI_SUM, gzero_rank_in_pool, POOL_WORLD); }
428427
#endif
429-
for (size_t iw_l = 1; iw_l < PARAM.globalv.nlocal; ++iw_l) {
430-
for (size_t iw_r = 0; iw_r < iw_l; ++iw_r) {
431-
this->sum1[iw_l * PARAM.globalv.nlocal + iw_r] = conj(this->sum1[iw_r * PARAM.globalv.nlocal + iw_l]); // Peize Lin add conj 2019-04-14
428+
for (std::size_t iw_l = 1; iw_l < PARAM.globalv.nlocal; ++iw_l) {
429+
for (std::size_t iw_r = 0; iw_r < iw_l; ++iw_r) {
430+
this->sum1[iw_l * PARAM.globalv.nlocal + iw_r] = std::conj(this->sum1[iw_r * PARAM.globalv.nlocal + iw_l]); // Peize Lin add conj 2019-04-14
432431
} }
433432

434433
for (int iw_l = 0; iw_l < PARAM.globalv.nlocal; ++iw_l)
@@ -441,7 +440,7 @@ void Exx_Lip<T, Device>::sum_all(const int ik)
441440
if (gzero_rank_in_pool == GlobalV::RANK_IN_POOL)
442441
{
443442
this->exx_matrix[ik][iw_l][iw_r] += spin_fac * (fourpi_div_omega * this->sum3[iw_l][iw_r] * sum2_factor_g);
444-
this->exx_matrix[ik][iw_l][iw_r] += spin_fac * (-1 / (Treal)sqrt(info.lambda * ModuleBase::PI) * (Treal)(this->q_pack->kv_ptr->get_nks() / PARAM.inp.nspin) * this->sum3[iw_l][iw_r]);
443+
this->exx_matrix[ik][iw_l][iw_r] += spin_fac * (-1 / (Treal)std::sqrt(info.lambda * ModuleBase::PI) * (Treal)(this->q_pack->kv_ptr->get_nks() / PARAM.inp.nspin) * this->sum3[iw_l][iw_r]);
445444
}
446445
}
447446
}
@@ -461,7 +460,7 @@ void Exx_Lip<T, Device>::exx_energy_cal()
461460
for( int iw_l=0; iw_l<PARAM.globalv.nlocal; ++iw_l) {
462461
for( int iw_r=0; iw_r<PARAM.globalv.nlocal; ++iw_r) {
463462
for( int ib=0; ib<PARAM.inp.nbands; ++ib) {
464-
exx_energy_tmp += (this->exx_matrix[ik][iw_l][iw_r] * conj((*this->k_pack->hvec_array)(ik, ib, iw_l)) * (*this->k_pack->hvec_array)(ik, ib, iw_r)).real() * this->k_pack->wf_wg(ik, ib);
463+
exx_energy_tmp += (this->exx_matrix[ik][iw_l][iw_r] * std::conj((*this->k_pack->hvec_array)(ik, ib, iw_l)) * (*this->k_pack->hvec_array)(ik, ib, iw_r)).real() * this->k_pack->wf_wg(ik, ib);
465464
} } } }
466465
#ifdef __MPI
467466
MPI_Allreduce( &exx_energy_tmp, &this->exx_energy, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); // !!! k_point parallel incompleted. different pools have different kv.set_nks(>) deadlock

0 commit comments

Comments
 (0)