@@ -34,14 +34,18 @@ Atom_input::Atom_input(std::ofstream &ofs_in,
3434{
3535 ModuleBase::TITLE (" Atom_input" , " Atom_input" );
3636
37- if (test_atom_input) ModuleBase::GlobalFunc::OUT (ofs_in, " ntype" , ntype);
38- if (test_atom_input) ModuleBase::GlobalFunc::OUT (ofs_in, " Amount(atom number)" , amount);
39- if (test_atom_input) ModuleBase::GlobalFunc::OUT (ofs_in, " Periodic_boundary" , periodic_boundary);
37+ if (test_atom_input) { ModuleBase::GlobalFunc::OUT (ofs_in, " ntype" , ntype);
38+ }
39+ if (test_atom_input) { ModuleBase::GlobalFunc::OUT (ofs_in, " Amount(atom number)" , amount);
40+ }
41+ if (test_atom_input) { ModuleBase::GlobalFunc::OUT (ofs_in, " Periodic_boundary" , periodic_boundary);
42+ }
4043
4144// ----------------------------------------------------------
4245// EXPLAIN : check searching raidus
4346// ----------------------------------------------------------
44- if (test_atom_input)ModuleBase::GlobalFunc::OUT (ofs_in, " Searching radius(lat0)" , radius);
47+ if (test_atom_input) {ModuleBase::GlobalFunc::OUT (ofs_in, " Searching radius(lat0)" , radius);
48+ }
4549
4650 if (radius < 0 )
4751 {
@@ -88,13 +92,15 @@ Atom_input::Atom_input(std::ofstream &ofs_in,
8892 clength1 = sqrt (vec2[0 ] * vec2[0 ] + vec2[1 ] * vec2[1 ] + vec2[2 ] * vec2[2 ]) ;
8993 clength2 = sqrt (vec3[0 ] * vec3[0 ] + vec3[1 ] * vec3[1 ] + vec3[2 ] * vec3[2 ]) ;
9094
91- if (test_atom_input) ModuleBase::GlobalFunc::OUT (ofs_in," CellLength(unit: lat0)" ,clength0,clength1,clength2);
95+ if (test_atom_input) { ModuleBase::GlobalFunc::OUT (ofs_in," CellLength(unit: lat0)" ,clength0,clength1,clength2);
96+ }
9297 // ==============================
9398 // set lattice constant
9499 // ==============================
95100 lat_now = ucell.lat0 ;
96101
97- if (test_atom_input) ModuleBase::GlobalFunc::OUT (ofs_in, " lat0_now (Bohr)" , lat_now);
102+ if (test_atom_input) { ModuleBase::GlobalFunc::OUT (ofs_in, " lat0_now (Bohr)" , lat_now);
103+ }
98104
99105 // random selection, in order to estimate again.
100106 this ->x_min = ucell.atoms [0 ].tau [0 ].x ;
@@ -109,21 +115,29 @@ Atom_input::Atom_input(std::ofstream &ofs_in,
109115 {
110116 for (int j = 0 ;j < ucell.atoms [i].na ;j++)
111117 {
112- if (ucell.atoms [i].tau [j].x < x_min) this ->x_min = ucell.atoms [i].tau [j].x ;
113- if (ucell.atoms [i].tau [j].y < y_min) this ->y_min = ucell.atoms [i].tau [j].y ;
114- if (ucell.atoms [i].tau [j].z < z_min) this ->z_min = ucell.atoms [i].tau [j].z ;
115- if (ucell.atoms [i].tau [j].x > x_max) this ->x_max = ucell.atoms [i].tau [j].x ;
116- if (ucell.atoms [i].tau [j].y > y_max) this ->y_max = ucell.atoms [i].tau [j].y ;
117- if (ucell.atoms [i].tau [j].z > z_max) this ->z_max = ucell.atoms [i].tau [j].z ;
118+ if (ucell.atoms [i].tau [j].x < x_min) { this ->x_min = ucell.atoms [i].tau [j].x ;
119+ }
120+ if (ucell.atoms [i].tau [j].y < y_min) { this ->y_min = ucell.atoms [i].tau [j].y ;
121+ }
122+ if (ucell.atoms [i].tau [j].z < z_min) { this ->z_min = ucell.atoms [i].tau [j].z ;
123+ }
124+ if (ucell.atoms [i].tau [j].x > x_max) { this ->x_max = ucell.atoms [i].tau [j].x ;
125+ }
126+ if (ucell.atoms [i].tau [j].y > y_max) { this ->y_max = ucell.atoms [i].tau [j].y ;
127+ }
128+ if (ucell.atoms [i].tau [j].z > z_max) { this ->z_max = ucell.atoms [i].tau [j].z ;
129+ }
118130 }
119131 }
120132
121133 if (test_atom_input)
122134 {
123135 ofs_in << " Find the coordinate range of the input atom(unit:lat0)." << std::endl;
124136 }
125- if (test_atom_input) ModuleBase::GlobalFunc::OUT (ofs_in," min_tau" , x_min, y_min, z_min);
126- if (test_atom_input) ModuleBase::GlobalFunc::OUT (ofs_in," max_tau" , x_max, y_max, z_max);
137+ if (test_atom_input) { ModuleBase::GlobalFunc::OUT (ofs_in," min_tau" , x_min, y_min, z_min);
138+ }
139+ if (test_atom_input) { ModuleBase::GlobalFunc::OUT (ofs_in," max_tau" , x_max, y_max, z_max);
140+ }
127141
128142// ----------------------------------------------------------
129143// CALL MEMBER FUNCTION :
@@ -146,8 +160,10 @@ Atom_input::Atom_input(std::ofstream &ofs_in,
146160 // glayerY_minus-=2;
147161 // glayerZ_minus-=2;
148162
149- if (test_atom_input) ModuleBase::GlobalFunc::OUT (ofs_in," glayer+" ,glayerX,glayerY,glayerZ);
150- if (test_atom_input) ModuleBase::GlobalFunc::OUT (ofs_in," glayer-" ,glayerX_minus,glayerY_minus,glayerZ_minus);
163+ if (test_atom_input) { ModuleBase::GlobalFunc::OUT (ofs_in," glayer+" ,glayerX,glayerY,glayerZ);
164+ }
165+ if (test_atom_input) { ModuleBase::GlobalFunc::OUT (ofs_in," glayer-" ,glayerX_minus,glayerY_minus,glayerZ_minus);
166+ }
151167
152168// ----------------------------------------------------------
153169// CALL MEMBER FUNCTION :
@@ -161,15 +177,17 @@ Atom_input::Atom_input(std::ofstream &ofs_in,
161177 this ->Expand_Grid (ucell, ntype);
162178 }
163179
164- if (PARAM.inp .test_grid ) ModuleBase::GlobalFunc::OUT (ofs_in, " expand_flag" , expand_flag);
180+ if (PARAM.inp .test_grid ) { ModuleBase::GlobalFunc::OUT (ofs_in, " expand_flag" , expand_flag);
181+ }
165182
166183// ----------------------------------------------------------
167184// CALL MEMBER FUNCTION :
168185// NAME : calculate_cells
169186// Calculate how many cells we need in each direction.
170187// ----------------------------------------------------------
171188 this ->calculate_cells ();
172- if (test_atom_input) ModuleBase::GlobalFunc::OUT (ofs_in, " CellDim" , cell_nx, cell_ny, cell_nz);
189+ if (test_atom_input) { ModuleBase::GlobalFunc::OUT (ofs_in, " CellDim" , cell_nx, cell_ny, cell_nz);
190+ }
173191 return ;
174192}
175193
@@ -186,7 +204,8 @@ void Atom_input::Check_Expand_Condition(const UnitCell &ucell)
186204{
187205// ModuleBase::TITLE(GlobalV::ofs_running, "Atom_input", "Check_Expand_Condition");
188206
189- if (!periodic_boundary) return ;
207+ if (!periodic_boundary) { return ;
208+ }
190209
191210 // mohan update 2011-04-14
192211 // d stands for direct coordinates.
@@ -230,7 +249,8 @@ void Atom_input::Check_Expand_Condition(const UnitCell &ucell)
230249 }
231250
232251
233- if (test_atom_input)ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running," Radius" ,radius);
252+ if (test_atom_input) {ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running," Radius" ,radius);
253+ }
234254
235255/* 2016-07-19, LiuXh
236256 // the unit of extent_1DX,Y,Z is lat0.
@@ -306,7 +326,8 @@ void Atom_input::Check_Expand_Condition(const UnitCell &ucell)
306326 double extend_d1 = extend_v/ucell.omega *ucell.lat0 *ucell.lat0 *ucell.lat0 ;
307327 int extend_d11 = static_cast <int >(extend_d1);
308328 // 2016-09-05, LiuXh
309- if (extend_d1 - extend_d11 > 0.0 ) extend_d11 += 1 ;
329+ if (extend_d1 - extend_d11 > 0.0 ) { extend_d11 += 1 ;
330+ }
310331
311332 double a31_1 = ucell.latvec .e32 *ucell.latvec .e13 - ucell.latvec .e33 *ucell.latvec .e12 ;
312333 double a31_2 = ucell.latvec .e31 *ucell.latvec .e13 - ucell.latvec .e33 *ucell.latvec .e11 ;
@@ -315,7 +336,8 @@ void Atom_input::Check_Expand_Condition(const UnitCell &ucell)
315336 double extend_d2 = a31_norm*radius/ucell.omega *ucell.lat0 *ucell.lat0 *ucell.lat0 ;
316337 int extend_d22 = static_cast <int >(extend_d2);
317338 // 2016-09-05, LiuXh
318- if (extend_d2 - extend_d22 > 0.0 ) extend_d22 += 1 ;
339+ if (extend_d2 - extend_d22 > 0.0 ) { extend_d22 += 1 ;
340+ }
319341
320342 double a12_1 = ucell.latvec .e12 *ucell.latvec .e23 - ucell.latvec .e13 *ucell.latvec .e22 ;
321343 double a12_2 = ucell.latvec .e11 *ucell.latvec .e23 - ucell.latvec .e13 *ucell.latvec .e21 ;
@@ -324,7 +346,8 @@ void Atom_input::Check_Expand_Condition(const UnitCell &ucell)
324346 double extend_d3 = a12_norm * radius/ucell.omega *ucell.lat0 *ucell.lat0 *ucell.lat0 ;
325347 int extend_d33 = static_cast <int >(extend_d3);
326348 // 2016-09-05, LiuXh
327- if (extend_d3 - extend_d33 > 0.0 ) extend_d33 += 1 ;
349+ if (extend_d3 - extend_d33 > 0.0 ) { extend_d33 += 1 ;
350+ }
328351
329352 glayerX = extend_d11 +1 ;
330353 glayerY = extend_d22 +1 ;
@@ -338,12 +361,18 @@ void Atom_input::Check_Expand_Condition(const UnitCell &ucell)
338361 glayerZ_minus = extend_d33;
339362 // End, 2016-09-05, LiuXh
340363
341- if (glayerX==1 ) glayerX++;
342- if (glayerY==1 ) glayerY++;
343- if (glayerZ==1 ) glayerZ++;
344- if (glayerX_minus==1 ) glayerX_minus++;
345- if (glayerY_minus==1 ) glayerY_minus++;
346- if (glayerZ_minus==1 ) glayerZ_minus++;
364+ if (glayerX==1 ) { glayerX++;
365+ }
366+ if (glayerY==1 ) { glayerY++;
367+ }
368+ if (glayerZ==1 ) { glayerZ++;
369+ }
370+ if (glayerX_minus==1 ) { glayerX_minus++;
371+ }
372+ if (glayerY_minus==1 ) { glayerY_minus++;
373+ }
374+ if (glayerZ_minus==1 ) { glayerZ_minus++;
375+ }
347376 // End, 2016-07-19, LiuXh
348377/*
349378 if(test_atom_input)
@@ -394,11 +423,13 @@ void Atom_input::Expand_Grid(const UnitCell &ucell, const int ntype)
394423 (glayerY + glayerY_minus) *
395424 (glayerZ + glayerZ_minus) ;
396425
397- if (test_atom_input)ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running," Grid_copy_times" ,gcopy);
426+ if (test_atom_input) {ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running," Grid_copy_times" ,gcopy);
427+ }
398428
399429 this ->d_amount_expand = d_amount * gcopy;
400430
401- if (test_atom_input)ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running," Atom_number_now" ,d_amount_expand);
431+ if (test_atom_input) {ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running," Atom_number_now" ,d_amount_expand);
432+ }
402433
403434 // store new atom positions.
404435
@@ -474,7 +505,7 @@ void Atom_input::Expand_Grid(const UnitCell &ucell, const int ntype)
474505 return ;
475506}
476507
477- void Atom_input::calculate_cells (void )
508+ void Atom_input::calculate_cells ()
478509{
479510 ModuleBase::TITLE (" Atom_input" , " calculate_cells" );
480511// ----------------------------------------------------------
0 commit comments