@@ -55,8 +55,9 @@ void hamilt::DFTU<hamilt::OperatorLCAO<TK, TR>>::initialize_HR(Grid_Driver* Grid
5555 int T0, I0;
5656 ucell->iat2iait (iat0, &I0, &T0);
5757 const int target_L = this ->dftu ->orbital_corr [T0];
58- if (target_L == -1 )
58+ if (target_L == -1 ) {
5959 continue ;
60+ }
6061
6162 AdjacentAtomInfo adjs;
6263 GridD->Find_atom (*ucell, tau0, T0, I0, &adjs);
@@ -89,8 +90,9 @@ template <typename TK, typename TR>
8990void hamilt::DFTU<hamilt::OperatorLCAO<TK, TR>>::cal_nlm_all(const Parallel_Orbitals* paraV)
9091{
9192 ModuleBase::TITLE (" DFTU" , " cal_nlm_all" );
92- if (this ->precal_nlm_done )
93+ if (this ->precal_nlm_done ) {
9394 return ;
95+ }
9496 ModuleBase::timer::tick (" DFTU" , " cal_nlm_all" );
9597 nlm_tot.resize (this ->ucell ->nat );
9698 const int npol = this ->ucell ->get_npol ();
@@ -101,8 +103,9 @@ void hamilt::DFTU<hamilt::OperatorLCAO<TK, TR>>::cal_nlm_all(const Parallel_Orbi
101103 int T0, I0;
102104 ucell->iat2iait (iat0, &I0, &T0);
103105 const int target_L = this ->dftu ->orbital_corr [T0];
104- if (target_L == -1 )
106+ if (target_L == -1 ) {
105107 continue ;
108+ }
106109 const int tlp1 = 2 * target_L + 1 ;
107110 AdjacentAtomInfo& adjs = this ->adjs_all [atom_index++];
108111
@@ -141,7 +144,7 @@ void hamilt::DFTU<hamilt::OperatorLCAO<TK, TR>>::cal_nlm_all(const Parallel_Orbi
141144 const int M1 = (m1 % 2 == 0 ) ? -m1 / 2 : (m1 + 1 ) / 2 ;
142145
143146 ModuleBase::Vector3<double > dtau = tau0 - tau1;
144- intor_->snap (T1, L1, N1, M1, T0, dtau * this ->ucell ->lat0 , 0 /* cal_deri*/ , nlm);
147+ intor_->snap (T1, L1, N1, M1, T0, dtau * this ->ucell ->lat0 , false /* cal_deri*/ , nlm);
145148 // select the elements of nlm with target_L
146149 for (int iw = 0 ; iw < this ->ucell ->atoms [T0].nw ; iw++)
147150 {
@@ -175,8 +178,9 @@ void hamilt::DFTU<hamilt::OperatorLCAO<TK, TR>>::contributeHR()
175178 else
176179 {
177180 // will update this->dftu->locale and this->dftu->EU
178- if (this ->current_spin == 0 )
181+ if (this ->current_spin == 0 ) {
179182 this ->dftu ->EU = 0.0 ;
183+ }
180184 }
181185 ModuleBase::timer::tick (" DFTU" , " contributeHR" );
182186
@@ -193,8 +197,9 @@ void hamilt::DFTU<hamilt::OperatorLCAO<TK, TR>>::contributeHR()
193197 int T0, I0;
194198 ucell->iat2iait (iat0, &I0, &T0);
195199 const int target_L = this ->dftu ->orbital_corr [T0];
196- if (target_L == -1 )
200+ if (target_L == -1 ) {
197201 continue ;
202+ }
198203 const int tlp1 = 2 * target_L + 1 ;
199204 AdjacentAtomInfo& adjs = this ->adjs_all [atom_index++];
200205
@@ -238,8 +243,9 @@ void hamilt::DFTU<hamilt::OperatorLCAO<TK, TR>>::contributeHR()
238243 // save occ to dftu
239244 for (int i = 0 ; i < occ.size (); i++)
240245 {
241- if (this ->nspin == 1 )
246+ if (this ->nspin == 1 ) {
242247 occ[i] *= 0.5 ;
248+ }
243249 this ->dftu ->locale [iat0][target_L][0 ][this ->current_spin ].c [i] = occ[i];
244250 }
245251 }
@@ -294,17 +300,20 @@ void hamilt::DFTU<hamilt::OperatorLCAO<TK, TR>>::contributeHR()
294300 }
295301
296302 // energy correction for NSPIN=1
297- if (this ->nspin == 1 )
303+ if (this ->nspin == 1 ) {
298304 this ->dftu ->EU *= 2.0 ;
305+ }
299306 // for readin onsite_dm, set initialed_locale to false to avoid using readin locale in next iteration
300- if (this ->current_spin == this ->nspin - 1 || this ->nspin == 4 )
307+ if (this ->current_spin == this ->nspin - 1 || this ->nspin == 4 ) {
301308 this ->dftu ->initialed_locale = false ;
309+ }
302310
303311 // update this->current_spin: only nspin=2 iterate change it between 0 and 1
304312 // the key point is only nspin=2 calculate spin-up and spin-down separately,
305313 // and won't calculate spin-up twice without spin-down
306- if (this ->nspin == 2 )
314+ if (this ->nspin == 2 ) {
307315 this ->current_spin = 1 - this ->current_spin ;
316+ }
308317
309318 ModuleBase::timer::tick (" DFTU" , " contributeHR" );
310319}
@@ -485,7 +494,7 @@ void hamilt::DFTU<hamilt::OperatorLCAO<TK, TR>>::cal_v_of_u(const std::vector<do
485494{
486495 // calculate the local matrix
487496 int spin_fold = occ.size () / m_size / m_size;
488- if (spin_fold < 4 )
497+ if (spin_fold < 4 ) {
489498 for (int is = 0 ; is < spin_fold; ++is)
490499 {
491500 int start = is * m_size * m_size;
@@ -498,7 +507,7 @@ void hamilt::DFTU<hamilt::OperatorLCAO<TK, TR>>::cal_v_of_u(const std::vector<do
498507 }
499508 }
500509 }
501- else
510+ } else
502511 {
503512 for (int m1 = 0 ; m1 < m_size; m1++)
504513 {
0 commit comments