@@ -276,59 +276,59 @@ void UnitCell::set_iat2itia(void)
276276void UnitCell::update_pos_tau (const double * pos)
277277{
278278 int iat = 0 ;
279- for (int it = 0 ;it < this ->ntype ;it++)
280- {
281- Atom* atom = &this ->atoms [it];
282- for (int ia =0 ;ia < atom->na ;ia++)
283- {
284- if (atom->mbl [ia].x != 0 )
285- {
286- atom->tau_original [ia].x += (pos[3 * iat] / this ->lat0 - atom->tau [ia].x );
287- atom->tau [ia].x = pos[3 * iat] / this ->lat0 ;
288- }
289- if (atom->mbl [ia].y != 0 )
290- {
291- atom->tau_original [ia].y += (pos[3 * iat+ 1 ] / this ->lat0 - atom->tau [ia].y );
292- atom->tau [ia].y = pos[3 * iat+ 1 ] / this ->lat0 ;
293- }
294- if (atom->mbl [ia].z != 0 )
295- {
296- atom->tau_original [ia].z += (pos[3 * iat+ 2 ] / this ->lat0 - atom->tau [ia].z );
297- atom->tau [ia].z = pos[3 * iat+ 2 ] / this ->lat0 ;
298- }
299-
300- // the direct coordinates also need to be updated.
301- atom->taud [ia] = atom->tau [ia] * this ->GT ;
302- iat++;
303- }
304- }
305- assert (iat == this ->nat );
279+ for (int it = 0 ; it < this ->ntype ; it++)
280+ {
281+ Atom* atom = &this ->atoms [it];
282+ for (int ia = 0 ; ia < atom->na ; ia++)
283+ {
284+ if (atom->mbl [ia].x != 0 )
285+ {
286+ atom->tau_original [ia].x += (pos[3 * iat] / this ->lat0 - atom->tau [ia].x );
287+ atom->tau [ia].x = pos[3 * iat] / this ->lat0 ;
288+ }
289+ if (atom->mbl [ia].y != 0 )
290+ {
291+ atom->tau_original [ia].y += (pos[3 * iat + 1 ] / this ->lat0 - atom->tau [ia].y );
292+ atom->tau [ia].y = pos[3 * iat + 1 ] / this ->lat0 ;
293+ }
294+ if (atom->mbl [ia].z != 0 )
295+ {
296+ atom->tau_original [ia].z += (pos[3 * iat + 2 ] / this ->lat0 - atom->tau [ia].z );
297+ atom->tau [ia].z = pos[3 * iat + 2 ] / this ->lat0 ;
298+ }
299+
300+ // the direct coordinates also need to be updated.
301+ atom->taud [ia] = atom->tau [ia] * this ->GT ;
302+ iat++;
303+ }
304+ }
305+ assert (iat == this ->nat );
306306 return ;
307307}
308308
309309void UnitCell::update_pos_tau (const ModuleBase::Vector3<double >* posd_in)
310310{
311311 int iat = 0 ;
312- for (int it = 0 ; it < this ->ntype ; ++it)
313- {
314- Atom* atom = &this ->atoms [it];
315- for (int ia = 0 ; ia < atom->na ; ++ia)
316- {
317- if (atom->mbl [ia].x != 0 )
318- {
312+ for (int it = 0 ; it < this ->ntype ; ++it)
313+ {
314+ Atom* atom = &this ->atoms [it];
315+ for (int ia = 0 ; ia < atom->na ; ++ia)
316+ {
317+ if (atom->mbl [ia].x != 0 )
318+ {
319319 atom->tau_original [ia].x += (posd_in[iat].x / this ->lat0 - atom->tau [ia].x );
320- atom->tau [ia].x = posd_in[iat].x / this ->lat0 ;
321- }
322- if (atom->mbl [ia].y != 0 )
323- {
320+ atom->tau [ia].x = posd_in[iat].x / this ->lat0 ;
321+ }
322+ if (atom->mbl [ia].y != 0 )
323+ {
324324 atom->tau_original [ia].y += (posd_in[iat].y / this ->lat0 - atom->tau [ia].y );
325- atom->tau [ia].y = posd_in[iat].y / this ->lat0 ;
326- }
327- if (atom->mbl [ia].z != 0 )
328- {
325+ atom->tau [ia].y = posd_in[iat].y / this ->lat0 ;
326+ }
327+ if (atom->mbl [ia].z != 0 )
328+ {
329329 atom->tau_original [ia].z += (posd_in[iat].z / this ->lat0 - atom->tau [ia].z );
330- atom->tau [ia].z = posd_in[iat].z / this ->lat0 ;
331- }
330+ atom->tau [ia].z = posd_in[iat].z / this ->lat0 ;
331+ }
332332
333333 // the direct coordinates also need to be updated.
334334 atom->taud [ia] = atom->tau [ia] * this ->GT ;
@@ -425,31 +425,31 @@ void UnitCell::bcast_atoms_tau()
425425#endif
426426}
427427
428- void UnitCell::save_cartesian_position (double * pos)const
428+ void UnitCell::save_cartesian_position (double * pos) const
429429{
430- int iat= 0 ;
431- for (int it = 0 ;it < this ->ntype ;it++)
432- {
433- Atom* atom = &this ->atoms [it];
434- for (int ia =0 ; ia< atom->na ; ia++)
435- {
436- pos[3 *iat ] = atom->tau [ia].x * this ->lat0 ;
437- pos[3 * iat+ 1 ] = atom->tau [ia].y * this ->lat0 ;
438- pos[3 * iat+ 2 ] = atom->tau [ia].z * this ->lat0 ;
430+ int iat = 0 ;
431+ for (int it = 0 ; it < this ->ntype ; it++)
432+ {
433+ Atom* atom = &this ->atoms [it];
434+ for (int ia = 0 ; ia < atom->na ; ia++)
435+ {
436+ pos[3 * iat ] = atom->tau [ia].x * this ->lat0 ;
437+ pos[3 * iat + 1 ] = atom->tau [ia].y * this ->lat0 ;
438+ pos[3 * iat + 2 ] = atom->tau [ia].z * this ->lat0 ;
439439 iat++;
440440 }
441441 }
442442 assert (iat == this ->nat );
443443 return ;
444444}
445445
446- void UnitCell::save_cartesian_position (ModuleBase::Vector3<double >* pos)const
446+ void UnitCell::save_cartesian_position (ModuleBase::Vector3<double >* pos) const
447447{
448448 int iat = 0 ;
449- for (int it = 0 ; it < this ->ntype ; ++it)
449+ for (int it = 0 ; it < this ->ntype ; ++it)
450450 {
451451 Atom* atom = &this ->atoms [it];
452- for (int ia = 0 ; ia < atom->na ; ++ia)
452+ for (int ia = 0 ; ia < atom->na ; ++ia)
453453 {
454454 pos[iat] = atom->tau_original [ia] * this ->lat0 ;
455455 iat++;
@@ -459,31 +459,31 @@ void UnitCell::save_cartesian_position(ModuleBase::Vector3<double>* pos)const
459459 return ;
460460}
461461
462- void UnitCell::save_cartesian_position_original (double * pos)const
462+ void UnitCell::save_cartesian_position_original (double * pos) const
463463{
464- int iat= 0 ;
465- for (int it = 0 ;it < this ->ntype ;it++)
466- {
467- Atom* atom = &this ->atoms [it];
468- for (int ia =0 ; ia< atom->na ; ia++)
469- {
470- pos[3 *iat ] = atom->tau_original [ia].x * this ->lat0 ;
471- pos[3 * iat+ 1 ] = atom->tau_original [ia].y * this ->lat0 ;
472- pos[3 * iat+ 2 ] = atom->tau_original [ia].z * this ->lat0 ;
464+ int iat = 0 ;
465+ for (int it = 0 ; it < this ->ntype ; it++)
466+ {
467+ Atom* atom = &this ->atoms [it];
468+ for (int ia = 0 ; ia < atom->na ; ia++)
469+ {
470+ pos[3 * iat ] = atom->tau_original [ia].x * this ->lat0 ;
471+ pos[3 * iat + 1 ] = atom->tau_original [ia].y * this ->lat0 ;
472+ pos[3 * iat + 2 ] = atom->tau_original [ia].z * this ->lat0 ;
473473 iat++;
474474 }
475475 }
476476 assert (iat == this ->nat );
477477 return ;
478478}
479479
480- void UnitCell::save_cartesian_position_original (ModuleBase::Vector3<double >* pos)const
480+ void UnitCell::save_cartesian_position_original (ModuleBase::Vector3<double >* pos) const
481481{
482482 int iat = 0 ;
483- for (int it = 0 ; it < this ->ntype ; ++it)
483+ for (int it = 0 ; it < this ->ntype ; ++it)
484484 {
485485 Atom* atom = &this ->atoms [it];
486- for (int ia = 0 ; ia < atom->na ; ++ia)
486+ for (int ia = 0 ; ia < atom->na ; ++ia)
487487 {
488488 pos[iat] = atom->tau_original [ia] * this ->lat0 ;
489489 iat++;
@@ -493,7 +493,7 @@ void UnitCell::save_cartesian_position_original(ModuleBase::Vector3<double>* pos
493493 return ;
494494}
495495
496- bool UnitCell::judge_big_cell (void )const
496+ bool UnitCell::judge_big_cell (void ) const
497497{
498498 double diameter = 2 * GlobalV::SEARCH_RADIUS;
499499
0 commit comments