Skip to content

Commit ec7ee8b

Browse files
committed
Merge branch 'develop' of https://gitee.com/deepmodeling/abacus-develop into rdmft
2 parents a5233e6 + c9f7973 commit ec7ee8b

Some content is hidden

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

48 files changed

+686
-808
lines changed

source/Makefile.Objects

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,10 @@ OBJS_ESOLVER=esolver.o\
247247
esolver_of.o\
248248
esolver_of_tool.o\
249249
esolver_of_interface.o\
250-
pw_init_globalc.o\
251250
pw_others.o\
252251

253252
OBJS_ESOLVER_LCAO=esolver_ks_lcao.o\
254253
esolver_ks_lcao_tddft.o\
255-
dpks_cal_e_delta_band.o\
256-
set_matrix_grid.o\
257254
lcao_before_scf.o\
258255
esolver_gets.o\
259256
lcao_others.o\
@@ -671,7 +668,7 @@ OBJS_SRCPW=H_Ewald_pw.o\
671668
symmetry_rhog.o\
672669
wavefunc.o\
673670
wf_atomic.o\
674-
wfinit.o\
671+
psiinit.o\
675672
elecond.o\
676673
sto_tool.o\
677674
sto_elecond.o\

source/module_base/vector3.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ template <class T> class Vector3
3636
Vector3(const Vector3<T> &v) : x(v.x), y(v.y), z(v.z){}; // Peize Lin add 2018-07-16
3737
explicit Vector3(const std::array<T,3> &v) :x(v[0]), y(v[1]), z(v[2]){}
3838

39+
template <typename U>
40+
explicit Vector3(const Vector3<U>& other) : x(static_cast<T>(other.x)), y(static_cast<T>(other.y)), z(static_cast<T>(other.z)) {}
41+
3942
Vector3(Vector3<T> &&v) noexcept : x(v.x), y(v.y), z(v.z) {}
4043

4144
/**

source/module_cell/read_pp.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,4 +478,13 @@ void Pseudopot_upf::setqfnew(const int& nqf,
478478
}
479479
rho[ir] *= pow(r[ir], l + n);
480480
}
481+
}
482+
483+
void Pseudopot_upf::skip_number(std::ifstream& ifs, bool mesh_changed)
484+
{
485+
if (mesh_changed)
486+
{
487+
double temp = 0.;
488+
ifs >> temp;
489+
}
481490
}

source/module_cell/read_pp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class Pseudopot_upf
7373

7474
private:
7575
bool mesh_changed = false; // if the mesh is even, it will be changed to odd
76+
void skip_number(std::ifstream& ifs, bool mesh_changed); // skip the last number if the mesh is even
7677

7778
int set_pseudo_type(const std::string& fn, std::string& type);
7879
std::string& trim(std::string& in_str);

source/module_cell/read_pp_upf100.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ void Pseudopot_upf::read_pseudo_mesh(std::ifstream &ifs, Atom_pseudo& pp)
236236
{
237237
ifs >> pp.r[ir];
238238
}
239+
this->skip_number(ifs, this->mesh_changed);
239240
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_R>");
240241
}
241242

@@ -245,6 +246,7 @@ void Pseudopot_upf::read_pseudo_mesh(std::ifstream &ifs, Atom_pseudo& pp)
245246
{
246247
ifs >> pp.rab[ir];
247248
}
249+
this->skip_number(ifs, this->mesh_changed);
248250
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_RAB>");
249251
}
250252
return;
@@ -258,6 +260,7 @@ void Pseudopot_upf::read_pseudo_nlcc(std::ifstream &ifs, Atom_pseudo& pp)
258260
{
259261
ifs >> pp.rho_atc[ir];
260262
}
263+
this->skip_number(ifs, this->mesh_changed);
261264
return;
262265
}
263266

@@ -270,7 +273,7 @@ void Pseudopot_upf::read_pseudo_local(std::ifstream &ifs, Atom_pseudo& pp)
270273
{
271274
ifs >> pp.vloc_at[ir];
272275
}
273-
276+
this->skip_number(ifs, this->mesh_changed);
274277
return;
275278
}
276279

@@ -406,6 +409,7 @@ void Pseudopot_upf::read_pseudo_nl(std::ifstream &ifs, Atom_pseudo& pp)
406409
ifs >> qfunc(nmb, ir);
407410
}
408411
}
412+
this->skip_number(ifs, this->mesh_changed);
409413

410414
if (this->nqf > 0)
411415
{
@@ -445,11 +449,7 @@ void Pseudopot_upf::read_pseudo_pswfc(std::ifstream &ifs, Atom_pseudo& pp)
445449
{
446450
ifs >> pp.chi(i, ir);
447451
}
448-
if (this->mesh_changed)
449-
{
450-
double temp = 0.0;
451-
ifs >> temp;
452-
}
452+
this->skip_number(ifs, this->mesh_changed);
453453
}
454454
return;
455455
}
@@ -461,6 +461,7 @@ void Pseudopot_upf::read_pseudo_rhoatom(std::ifstream &ifs, Atom_pseudo& pp)
461461
{
462462
ifs >> pp.rho_at[ir];
463463
}
464+
this->skip_number(ifs, this->mesh_changed);
464465
return;
465466
}
466467

source/module_cell/read_pp_upf201.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs, Atom_pseudo& pp)
3232
{
3333
ifs >> pp.rho_atc[ir];
3434
}
35+
this->skip_number(ifs, this->mesh_changed);
3536
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_NLCC>");
3637
}
3738

@@ -53,6 +54,7 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs, Atom_pseudo& pp)
5354
{
5455
ifs >> pp.vloc_at[ir];
5556
}
57+
this->skip_number(ifs, this->mesh_changed);
5658
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_LOCAL>");
5759
}
5860

@@ -90,6 +92,7 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs, Atom_pseudo& pp)
9092
{
9193
ifs >> pp.rho_at[ir];
9294
}
95+
this->skip_number(ifs, this->mesh_changed);
9396
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_RHOATOM>");
9497

9598
//--------------------------------------
@@ -406,6 +409,7 @@ void Pseudopot_upf::read_pseudo_upf201_mesh(std::ifstream& ifs, Atom_pseudo& pp)
406409
{
407410
ifs >> pp.r[ir];
408411
}
412+
this->skip_number(ifs, this->mesh_changed);
409413
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_R>");
410414

411415
if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_RAB", true, false))
@@ -420,6 +424,7 @@ void Pseudopot_upf::read_pseudo_upf201_mesh(std::ifstream& ifs, Atom_pseudo& pp)
420424
{
421425
ifs >> pp.rab[ir];
422426
}
427+
this->skip_number(ifs, this->mesh_changed);
423428
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_RAB>");
424429
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_MESH>");
425430
}
@@ -497,6 +502,7 @@ void Pseudopot_upf::read_pseudo_upf201_nonlocal(std::ifstream& ifs, Atom_pseudo&
497502
{
498503
ifs >> pp.betar(ib, ir);
499504
}
505+
this->skip_number(ifs, this->mesh_changed);
500506
word = "</PP_BETA." + std::to_string(ib + 1) + ">";
501507
ModuleBase::GlobalFunc::SCAN_END(ifs, word);
502508
}
@@ -639,6 +645,7 @@ void Pseudopot_upf::read_pseudo_upf201_nonlocal(std::ifstream& ifs, Atom_pseudo&
639645
{
640646
ifs >> pp.qfuncl(l, nmb, ir);
641647
}
648+
this->skip_number(ifs, this->mesh_changed);
642649
word = "</PP_QIJL." + std::to_string(nb + 1) + "." + std::to_string(mb + 1) + "."
643650
+ std::to_string(l) + ">";
644651
ModuleBase::GlobalFunc::SCAN_END(ifs, word);
@@ -653,6 +660,7 @@ void Pseudopot_upf::read_pseudo_upf201_nonlocal(std::ifstream& ifs, Atom_pseudo&
653660
{
654661
ifs >> this->qfunc(nmb, ir);
655662
}
663+
this->skip_number(ifs, this->mesh_changed);
656664
word = "</PP_QIJ." + std::to_string(nb + 1) + "." + std::to_string(mb + 1) + ">";
657665
ModuleBase::GlobalFunc::SCAN_END(ifs, word);
658666
}
@@ -757,6 +765,7 @@ void Pseudopot_upf::read_pseudo_upf201_pswfc(std::ifstream& ifs, Atom_pseudo& pp
757765
{
758766
assert(pp.chi.c[iw * pp.mesh + ir] == pp.chi(iw, ir));
759767
}
768+
this->skip_number(ifs, this->mesh_changed);
760769
word = "</PP_CHI." + std::to_string(iw + 1) + ">";
761770
ModuleBase::GlobalFunc::SCAN_END(ifs, word);
762771
}

source/module_elecstate/elecstate.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ namespace elecstate
1212

1313
const double* ElecState::getRho(int spin) const
1414
{
15-
// hamilt::MatrixBlock<double> temp{&(this->charge->rho[spin][0]), 1, this->charge->nrxx}; //
16-
// this->chr->get_nspin(), this->chr->get_nrxx()};
1715
return &(this->charge->rho[spin][0]);
1816
}
1917

2018
void ElecState::fixed_weights(const std::vector<double>& ocp_kb, const int& nbands, const double& nelec)
2119
{
22-
2320
assert(nbands > 0);
2421
assert(nelec > 0.0);
2522

@@ -56,6 +53,7 @@ void ElecState::fixed_weights(const std::vector<double>& ocp_kb, const int& nban
5653
return;
5754
}
5855

56+
5957
void ElecState::init_nelec_spin()
6058
{
6159
this->nelec_spin.resize(PARAM.inp.nspin);
@@ -66,6 +64,7 @@ void ElecState::init_nelec_spin()
6664
}
6765
}
6866

67+
6968
void ElecState::calculate_weights()
7069
{
7170
ModuleBase::TITLE("ElecState", "calculate_weights");
@@ -74,8 +73,8 @@ void ElecState::calculate_weights()
7473
return;
7574
}
7675

77-
int nbands = this->ekb.nc;
78-
int nks = this->ekb.nr;
76+
const int nbands = this->ekb.nc;
77+
const int nks = this->ekb.nr;
7978

8079
if (!Occupy::use_gaussian_broadening && !Occupy::fixed_occupations)
8180
{
@@ -176,6 +175,7 @@ void ElecState::calculate_weights()
176175
return;
177176
}
178177

178+
179179
void ElecState::calEBand()
180180
{
181181
ModuleBase::TITLE("ElecState", "calEBand");
@@ -205,10 +205,13 @@ void ElecState::calEBand()
205205
return;
206206
}
207207

208-
void ElecState::init_scf(const int istep, const ModuleBase::ComplexMatrix& strucfac, ModuleSymmetry::Symmetry& symm, const void* wfcpw)
208+
209+
void ElecState::init_scf(const int istep,
210+
const ModuleBase::ComplexMatrix& strucfac,
211+
ModuleSymmetry::Symmetry& symm,
212+
const void* wfcpw)
209213
{
210-
//---------Charge part-----------------
211-
// core correction potential.
214+
//! core correction potential.
212215
if (!PARAM.inp.use_paw)
213216
{
214217
this->charge->set_rho_core(strucfac);
@@ -218,23 +221,22 @@ void ElecState::init_scf(const int istep, const ModuleBase::ComplexMatrix& struc
218221
this->charge->set_rho_core_paw();
219222
}
220223

221-
//--------------------------------------------------------------------
222-
// (2) other effective potentials need charge density,
224+
//! other effective potentials need charge density,
223225
// choose charge density from ionic step 0.
224-
//--------------------------------------------------------------------
225226
if (istep == 0)
226227
{
227228
this->charge->init_rho(this->eferm, strucfac, symm, (const void*)this->klist, wfcpw);
228229
this->charge->check_rho(); // check the rho
229230
}
230231

231-
// renormalize the charge density
232+
//! renormalize the charge density
232233
this->charge->renormalize_rho();
233234

234-
//---------Potential part--------------
235+
//! initialize the potential
235236
this->pot->init_pot(istep, this->charge);
236237
}
237238

239+
238240
void ElecState::init_ks(Charge* chg_in, // pointer for class Charge
239241
const K_Vectors* klist_in,
240242
int nk_in,
@@ -252,6 +254,4 @@ void ElecState::init_ks(Charge* chg_in, // pointer for class Charge
252254
this->wg.create(nk_in, PARAM.inp.nbands);
253255
}
254256

255-
256-
257257
} // namespace elecstate

source/module_esolver/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ list(APPEND objects
1010
esolver_of.cpp
1111
esolver_of_interface.cpp
1212
esolver_of_tool.cpp
13-
pw_init_globalc.cpp
1413
pw_others.cpp
1514
)
1615
if(ENABLE_LCAO)
1716
list(APPEND objects
1817
esolver_ks_lcao.cpp
1918
esolver_ks_lcao_tddft.cpp
20-
dpks_cal_e_delta_band.cpp
21-
set_matrix_grid.cpp
2219
lcao_before_scf.cpp
2320
esolver_gets.cpp
2421
lcao_others.cpp

source/module_esolver/dpks_cal_e_delta_band.cpp

Lines changed: 0 additions & 69 deletions
This file was deleted.

source/module_esolver/esolver_ks.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@ ESolver_KS<T, Device>::ESolver_KS()
6767
///----------------------------------------------------------
6868
p_chgmix = new Charge_Mixing();
6969
p_chgmix->set_rhopw(this->pw_rho, this->pw_rhod);
70-
71-
///----------------------------------------------------------
72-
/// wavefunc
73-
///----------------------------------------------------------
74-
this->wf.init_wfc = PARAM.inp.init_wfc;
75-
this->wf.mem_saver = PARAM.inp.mem_saver;
76-
this->wf.out_wfc_pw = PARAM.inp.out_wfc_pw;
77-
this->wf.out_wfc_r = PARAM.inp.out_wfc_r;
7870
}
7971

8072
//------------------------------------------------------------------------------

0 commit comments

Comments
 (0)