@@ -10,7 +10,7 @@ std::complex<double>* Structure_Factor::get_sk(const int ik,
1010 const ModulePW::PW_Basis_K* wfc_basis) const
1111{
1212 ModuleBase::timer::tick (" Structure_Factor" , " get_sk" );
13- const double arg = (wfc_basis->kvec_c [ik] * GlobalC:: ucell. atoms [it].tau [ia]) * ModuleBase::TWO_PI;
13+ const double arg = (wfc_basis->kvec_c [ik] * ucell-> atoms [it].tau [ia]) * ModuleBase::TWO_PI;
1414 const std::complex <double > kphase = std::complex <double >(cos (arg), -sin (arg));
1515 const int npw = wfc_basis->npwk [ik];
1616 std::complex <double > *sk = new std::complex <double >[npw];
@@ -26,19 +26,22 @@ std::complex<double>* Structure_Factor::get_sk(const int ik,
2626 const int ixy = wfc_basis->is2fftixy [is];
2727 int ix = ixy / wfc_basis->fftny ;
2828 int iy = ixy % wfc_basis->fftny ;
29- if (ix >= int (nx / 2 ) + 1 ) {
29+ if (ix >= int (nx / 2 ) + 1 )
30+ {
3031 ix -= nx;
31- }
32- if (iy >= int (ny / 2 ) + 1 ) {
32+ }
33+ if (iy >= int (ny / 2 ) + 1 )
34+ {
3335 iy -= ny;
34- }
35- if (iz >= int (nz / 2 ) + 1 ) {
36+ }
37+ if (iz >= int (nz / 2 ) + 1 )
38+ {
3639 iz -= nz;
37- }
40+ }
3841 ix += this ->rho_basis ->nx ;
3942 iy += this ->rho_basis ->ny ;
4043 iz += this ->rho_basis ->nz ;
41- const int iat = GlobalC:: ucell. itia2iat (it, ia);
44+ const int iat = ucell-> itia2iat (it, ia);
4245 sk[igl] = kphase * this ->eigts1 (iat, ix) * this ->eigts2 (iat, iy) * this ->eigts3 (iat, iz);
4346 }
4447 ModuleBase::timer::tick (" Structure_Factor" , " get_sk" );
@@ -66,33 +69,33 @@ void Structure_Factor::get_sk(Device* ctx,
6669
6770 int iat = 0 , _npw = wfc_basis->npwk [ik], eigts1_nc = this ->eigts1 .nc , eigts2_nc = this ->eigts2 .nc ,
6871 eigts3_nc = this ->eigts3 .nc ;
69- int *igl2isz = nullptr , *is2fftixy = nullptr , *atom_na = nullptr , *h_atom_na = new int [GlobalC:: ucell. ntype ];
70- FPTYPE *atom_tau = nullptr , *h_atom_tau = new FPTYPE[GlobalC:: ucell. nat * 3 ], *kvec = wfc_basis->get_kvec_c_data <FPTYPE>();
72+ int *igl2isz = nullptr , *is2fftixy = nullptr , *atom_na = nullptr , *h_atom_na = new int [ucell-> ntype ];
73+ FPTYPE *atom_tau = nullptr , *h_atom_tau = new FPTYPE[ucell-> nat * 3 ], *kvec = wfc_basis->get_kvec_c_data <FPTYPE>();
7174 std::complex <FPTYPE> *eigts1 = this ->get_eigts1_data <FPTYPE>(), *eigts2 = this ->get_eigts2_data <FPTYPE>(),
7275 *eigts3 = this ->get_eigts3_data <FPTYPE>();
73- for (int it = 0 ; it < GlobalC:: ucell. ntype ; it++)
76+ for (int it = 0 ; it < ucell-> ntype ; it++)
7477 {
75- h_atom_na[it] = GlobalC:: ucell. atoms [it].na ;
78+ h_atom_na[it] = ucell-> atoms [it].na ;
7679 }
7780#ifdef _OPENMP
7881#pragma omp parallel for
7982#endif
80- for (int iat = 0 ; iat < GlobalC:: ucell. nat ; iat++)
83+ for (int iat = 0 ; iat < ucell-> nat ; iat++)
8184 {
82- int it = GlobalC:: ucell. iat2it [iat];
83- int ia = GlobalC:: ucell. iat2ia [iat];
84- auto *tau = reinterpret_cast <double *>(GlobalC:: ucell. atoms [it].tau .data ());
85+ int it = ucell-> iat2it [iat];
86+ int ia = ucell-> iat2ia [iat];
87+ auto *tau = reinterpret_cast <double *>(ucell-> atoms [it].tau .data ());
8588 h_atom_tau[iat * 3 + 0 ] = static_cast <FPTYPE>(tau[ia * 3 + 0 ]);
8689 h_atom_tau[iat * 3 + 1 ] = static_cast <FPTYPE>(tau[ia * 3 + 1 ]);
8790 h_atom_tau[iat * 3 + 2 ] = static_cast <FPTYPE>(tau[ia * 3 + 2 ]);
8891 }
8992 if (device == base_device::GpuDevice)
9093 {
91- resmem_int_op ()(ctx, atom_na, GlobalC:: ucell. ntype );
92- syncmem_int_op ()(ctx, cpu_ctx, atom_na, h_atom_na, GlobalC:: ucell. ntype );
94+ resmem_int_op ()(ctx, atom_na, ucell-> ntype );
95+ syncmem_int_op ()(ctx, cpu_ctx, atom_na, h_atom_na, ucell-> ntype );
9396
94- resmem_var_op ()(ctx, atom_tau, GlobalC:: ucell. nat * 3 );
95- syncmem_var_op ()(ctx, cpu_ctx, atom_tau, h_atom_tau, GlobalC:: ucell. nat * 3 );
97+ resmem_var_op ()(ctx, atom_tau, ucell-> nat * 3 );
98+ syncmem_var_op ()(ctx, cpu_ctx, atom_tau, h_atom_tau, ucell-> nat * 3 );
9699
97100 igl2isz = wfc_basis->d_igl2isz_k ;
98101 is2fftixy = wfc_basis->d_is2fftixy ;
@@ -107,7 +110,7 @@ void Structure_Factor::get_sk(Device* ctx,
107110
108111 cal_sk_op ()(ctx,
109112 ik,
110- GlobalC:: ucell. ntype ,
113+ ucell-> ntype ,
111114 wfc_basis->nx ,
112115 wfc_basis->ny ,
113116 wfc_basis->nz ,
@@ -152,7 +155,7 @@ std::complex<double>* Structure_Factor::get_skq(int ik,
152155 for (int ig = 0 ; ig < npw; ig++)
153156 {
154157 ModuleBase::Vector3<double > qkq = wfc_basis->getgpluskcar (ik, ig) + q;
155- double arg = (qkq * GlobalC:: ucell. atoms [it].tau [ia]) * ModuleBase::TWO_PI;
158+ double arg = (qkq * ucell-> atoms [it].tau [ia]) * ModuleBase::TWO_PI;
156159 skq[ig] = std::complex <double >(cos (arg), -sin (arg));
157160 }
158161
0 commit comments