@@ -117,7 +117,8 @@ void ModuleIO::cal_tmp_DM(elecstate::DensityMatrix<std::complex<double>, double>
117117 ModuleBase::timer::tick (" ModuleIO" , " cal_tmp_DM" );
118118}
119119
120- void ModuleIO::write_current (const int istep,
120+ void ModuleIO::write_current (const UnitCell& ucell,
121+ const int istep,
121122 const psi::Psi<std::complex <double >>* psi,
122123 const elecstate::ElecState* pelec,
123124 const K_Vectors& kv,
@@ -133,7 +134,7 @@ void ModuleIO::write_current(const int istep,
133134 std::vector<hamilt::HContainer<std::complex <double >>*> current_term = {nullptr , nullptr , nullptr };
134135 if (!TD_Velocity::tddft_velocity)
135136 {
136- cal_current = new TD_current (&GlobalC:: ucell, &GlobalC::GridD, pv, orb, intor);
137+ cal_current = new TD_current (&ucell, &GlobalC::GridD, pv, orb, intor);
137138 cal_current->calculate_vcomm_r ();
138139 cal_current->calculate_grad_term ();
139140 for (int dir = 0 ; dir < 3 ; dir++)
@@ -163,8 +164,8 @@ void ModuleIO::write_current(const int istep,
163164 elecstate::cal_dm_psi (DM_real.get_paraV_pointer (), pelec->wg , psi[0 ], DM_real);
164165
165166 // init DMR
166- DM_real.init_DMR (ra, &GlobalC:: ucell);
167- DM_imag.init_DMR (ra, &GlobalC:: ucell);
167+ DM_real.init_DMR (ra, &ucell);
168+ DM_imag.init_DMR (ra, &ucell);
168169
169170 int nks = DM_real.get_DMK_nks ();
170171 if (PARAM.inp .nspin == 2 )
@@ -197,27 +198,27 @@ void ModuleIO::write_current(const int istep,
197198#ifdef _OPENMP
198199#pragma omp for schedule(dynamic)
199200#endif
200- for (int iat = 0 ; iat < GlobalC:: ucell.nat ; iat++)
201+ for (int iat = 0 ; iat < ucell.nat ; iat++)
201202 {
202- const int T1 = GlobalC:: ucell.iat2it [iat];
203- Atom* atom1 = &GlobalC:: ucell.atoms [T1];
204- const int I1 = GlobalC:: ucell.iat2ia [iat];
203+ const int T1 = ucell.iat2it [iat];
204+ Atom* atom1 = &ucell.atoms [T1];
205+ const int I1 = ucell.iat2ia [iat];
205206 // get iat1
206- int iat1 = GlobalC:: ucell.itia2iat (T1, I1);
207+ int iat1 = ucell.itia2iat (T1, I1);
207208
208209 int irr = pv->nlocstart [iat];
209- const int start1 = GlobalC:: ucell.itiaiw2iwt (T1, I1, 0 );
210+ const int start1 = ucell.itiaiw2iwt (T1, I1, 0 );
210211 for (int cb = 0 ; cb < ra.na_each [iat]; ++cb)
211212 {
212213 const int T2 = ra.info [iat][cb][3 ];
213214 const int I2 = ra.info [iat][cb][4 ];
214215
215- const int start2 = GlobalC:: ucell.itiaiw2iwt (T2, I2, 0 );
216+ const int start2 = ucell.itiaiw2iwt (T2, I2, 0 );
216217
217- Atom* atom2 = &GlobalC:: ucell.atoms [T2];
218+ Atom* atom2 = &ucell.atoms [T2];
218219
219220 // get iat2
220- int iat2 = GlobalC:: ucell.itia2iat (T2, I2);
221+ int iat2 = ucell.itia2iat (T2, I2);
221222 double Rx = ra.info [iat][cb][0 ];
222223 double Ry = ra.info [iat][cb][1 ];
223224 double Rz = ra.info [iat][cb][2 ];
0 commit comments