Skip to content

Commit cecacc8

Browse files
committed
change ucell in module_io/numerical_desciptor.cpp
1 parent 0a768b4 commit cecacc8

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed

source/module_esolver/pw_others.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ void ESolver_KS_PW<T, Device>::others(UnitCell& ucell, const int istep)
6565
this->p_chgmix->get_mixing_ndim());
6666
} else if (cal_type == "gen_bessel") {
6767
Numerical_Descriptor nc;
68-
nc.output_descriptor(this->psi[0],
68+
nc.output_descriptor(ucell,
69+
this->psi[0],
6970
PARAM.inp.bessel_descriptor_lmax,
7071
PARAM.inp.bessel_descriptor_rcut,
7172
PARAM.inp.bessel_descriptor_tolerence,

source/module_io/input_conv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ void Input_Conv::Convert()
255255
GlobalC::dftu.U0 = PARAM.globalv.hubbard_u;
256256
if (PARAM.globalv.uramping > 0.01)
257257
{
258-
ModuleBase::GlobalFunc::ZEROS(GlobalC::dftu.U.data(), GlobalC::ucell.ntype);
258+
ModuleBase::GlobalFunc::ZEROS(GlobalC::dftu.U.data(), PARAM.inp.ntype);
259259
}
260260
}
261261
#endif

source/module_io/numerical_descriptor.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Numerical_Descriptor::~Numerical_Descriptor()
2525
}
2626

2727

28-
void Numerical_Descriptor::output_descriptor(const psi::Psi<std::complex<double>> &psi, const int &lmax_in, const double &rcut_in, const double &tol_in, const int nks_in)
28+
void Numerical_Descriptor::output_descriptor(const UnitCell& ucell, const psi::Psi<std::complex<double>> &psi, const int &lmax_in, const double &rcut_in, const double &tol_in, const int nks_in)
2929
{
3030
ModuleBase::TITLE("Numerical_Descriptor","output_descriptor");
3131
ModuleBase::GlobalFunc::NEW_PART("DeepKS descriptor: D_{Inl}");
@@ -49,16 +49,16 @@ void Numerical_Descriptor::output_descriptor(const psi::Psi<std::complex<double>
4949
this->bessel_basis.init(
5050
false,
5151
std::stod(PARAM.inp.bessel_descriptor_ecut),
52-
GlobalC::ucell.ntype,
52+
ucell.ntype,
5353
this->lmax,
5454
PARAM.inp.bessel_descriptor_smooth,
5555
PARAM.inp.bessel_descriptor_sigma,
5656
rcut_in,
5757
tol_in,
58-
GlobalC::ucell
58+
ucell
5959
);
6060
this->nmax = Numerical_Descriptor::bessel_basis.get_ecut_number();
61-
this->init_mu_index();
61+
this->init_mu_index(ucell);
6262
this->init_label = true;
6363

6464
assert(nmax>0);
@@ -129,10 +129,10 @@ void Numerical_Descriptor::output_descriptor(const psi::Psi<std::complex<double>
129129
// 5. Generate descriptors for each atom
130130
//-------------------------------------
131131
132-
for (int it=0; it<GlobalC::ucell.ntype; it++)
132+
for (int it=0; it<ucell.ntype; it++)
133133
{
134-
GlobalV::ofs_running << GlobalC::ucell.atoms[it].label << " label" << std::endl;
135-
for (int ia=0; ia<GlobalC::ucell.atoms[it].na; ia++)
134+
GlobalV::ofs_running << ucell.atoms[it].label << " label" << std::endl;
135+
for (int ia=0; ia<ucell.atoms[it].na; ia++)
136136
{
137137
//--------------------------------------------------
138138
// compute the number of descriptors for each atom
@@ -151,7 +151,7 @@ void Numerical_Descriptor::output_descriptor(const psi::Psi<std::complex<double>
151151
// for each 'lmax' we have 'n' up to 'ecut_number'
152152
this->generate_descriptor(overlap_Q1, overlap_Q2, it ,ia, d, nd);
153153
154-
ofs << GlobalC::ucell.atoms[it].label << " atom_index " << ia+1 << " n_descriptor " << nd << std::endl;
154+
ofs << ucell.atoms[it].label << " atom_index " << ia+1 << " n_descriptor " << nd << std::endl;
155155
for(int id=0; id<nd; ++id)
156156
{
157157
if(id>0 && id%8==0) ofs << std::endl;
@@ -264,7 +264,7 @@ void Numerical_Descriptor::jlq3d_overlap(
264264
GlobalV::ofs_running << " OUTPUT THE OVERLAP BETWEEN SPHERICAL BESSEL FUNCTIONS AND BLOCH WAVE FUNCTIONS" <<
265265
std::endl; GlobalV::ofs_running << " Q = < J_it_ia_il_in_im | Psi_n, k > " << std::endl;
266266
267-
const double normalization = (4 * ModuleBase::PI) / sqrt(GlobalC::ucell.omega);// Peize Lin add normalization
267+
const double normalization = (4 * ModuleBase::PI) / sqrt(ucell.omega);// Peize Lin add normalization
268268
2015-12-29
269269
270270
const int total_lm = ( this->lmax + 1) * ( this->lmax + 1);
@@ -286,15 +286,15 @@ std::endl; GlobalV::ofs_running << " Q = < J_it_ia_il_in_im | Psi_n, k > " << st
286286
287287
double *flq = new double[np];
288288
std::complex<double> overlapQ = ModuleBase::ZERO;
289-
for (int T1 = 0; T1 < GlobalC::ucell.ntype; T1++)
289+
for (int T1 = 0; T1 < ucell.ntype; T1++)
290290
{
291-
for (int I1 = 0; I1 < GlobalC::ucell.atoms[T1].na; I1++)
291+
for (int I1 = 0; I1 < ucell.atoms[T1].na; I1++)
292292
{
293293
std::complex<double> *sk = sf.get_sk(ik, T1, I1,wfcpw);
294294
for (int L=0; L< lmax+1; L++)
295295
{
296296
GlobalV::ofs_running << " " << std::setw(5) << ik+1
297-
<< std::setw(8) << GlobalC::ucell.atoms[T1].label
297+
<< std::setw(8) << ucell.atoms[T1].label
298298
<< std::setw(8) << I1+1
299299
<< std::setw(8) << L
300300
<< std::endl;
@@ -305,7 +305,7 @@ normalization 2015-12-29 for (int ie=0; ie < nmax; ie++)
305305
for (int ig=0; ig<np; ig++)
306306
{
307307
flq[ig] = Numerical_Descriptor::bessel_basis.Polynomial_Interpolation2
308-
(L, ie, gk[ig].norm() * GlobalC::ucell.tpiba );
308+
(L, ie, gk[ig].norm() * ucell.tpiba );
309309
}
310310
311311
for (int m=0; m<2*L+1; m++)
@@ -336,32 +336,32 @@ normalization 2015-12-29 for (int ie=0; ie < nmax; ie++)
336336
}
337337
*/
338338

339-
void Numerical_Descriptor::init_mu_index()
339+
void Numerical_Descriptor::init_mu_index(const UnitCell& ucell)
340340
{
341341
GlobalV::ofs_running << " Initialize the mu index for deepks" << std::endl;
342342
GlobalV::ofs_running << " lmax = " << this->lmax << std::endl;
343343
GlobalV::ofs_running << " nmax = " << this->nmax << std::endl;
344-
Numerical_Descriptor::mu_index = new ModuleBase::IntArray[GlobalC::ucell.ntype];
344+
Numerical_Descriptor::mu_index = new ModuleBase::IntArray[ucell.ntype];
345345

346346
assert(lmax>=0);
347347
assert(nmax>0);
348348

349349
int mu=0;
350-
for (int it=0; it<GlobalC::ucell.ntype; ++it)
350+
for (int it=0; it<ucell.ntype; ++it)
351351
{
352352
this->mu_index[it].create(
353-
GlobalC::ucell.atoms[it].na,
353+
ucell.atoms[it].na,
354354
lmax+1, // l starts from 0
355355
nmax,
356356
2*lmax+1); // m ==> 2*l+1
357357

358358
GlobalV::ofs_running << "Type " << it+1
359-
<< " number_of_atoms " << GlobalC::ucell.atoms[it].na
359+
<< " number_of_atoms " << ucell.atoms[it].na
360360
<< " number_of_L " << lmax+1
361361
<< " number_of_n " << nmax
362362
<< " number_of_m " << 2*lmax+1 << std::endl;
363363

364-
for (int ia=0; ia<GlobalC::ucell.atoms[it].na; ia++)
364+
for (int ia=0; ia<ucell.atoms[it].na; ia++)
365365
{
366366
for (int l=0; l<lmax+1; l++)
367367
{

source/module_io/numerical_descriptor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Numerical_Descriptor
2020
Numerical_Descriptor();
2121
~Numerical_Descriptor();
2222

23-
void output_descriptor( const psi::Psi<std::complex<double>> &psi, const int &lmax_in, const double &rcut_in, const double &tol_in, const int nks); // mohan added 2021-01-03
23+
void output_descriptor(const UnitCell& ucell, const psi::Psi<std::complex<double>> &psi, const int &lmax_in, const double &rcut_in, const double &tol_in, const int nks); // mohan added 2021-01-03
2424

2525
private:
2626

@@ -33,7 +33,7 @@ class Numerical_Descriptor
3333
Bessel_Basis bessel_basis;
3434

3535
ModuleBase::IntArray *mu_index;
36-
void init_mu_index(void);//mohan added 2021-01-03
36+
void init_mu_index(const UnitCell& ucell);//mohan added 2021-01-03
3737

3838
// void jlq3d_overlap(ModuleBase::realArray &overlap_Q1, ModuleBase::realArray &overlap_Q2,
3939
// const int &ik_ibz, const int &ik, const int &np, const psi::Psi<std::complex<double>> &psi);

0 commit comments

Comments
 (0)