Skip to content

Commit e6ecce4

Browse files
[pre-commit.ci lite] apply automatic fixes
1 parent 3d98185 commit e6ecce4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

source/module_elecstate/magnetism.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,23 @@ void Magnetism::compute_magnetization(const double& omega,
5757
// noncolliear :
5858
else if(PARAM.inp.nspin==4)
5959
{
60-
for(int i=0;i<3;i++)this->tot_magnetization_nc[i] = 0.00;
60+
for(int i=0;i<3;i++) {this->tot_magnetization_nc[i] = 0.00;
61+
}
6162
this->abs_magnetization = 0.00;
6263
for (int ir=0; ir<nrxx; ir++)
6364
{
6465
double diff = sqrt(pow(rho[1][ir], 2) + pow(rho[2][ir], 2) +pow(rho[3][ir], 2));
6566

66-
for(int i=0;i<3;i++)this->tot_magnetization_nc[i] += rho[i+1][ir];
67+
for(int i=0;i<3;i++) {this->tot_magnetization_nc[i] += rho[i+1][ir];
68+
}
6769
this->abs_magnetization += std::abs(diff);
6870
}
6971
#ifdef __MPI
7072
Parallel_Reduce::reduce_pool(this->tot_magnetization_nc, 3);
7173
Parallel_Reduce::reduce_pool(this->abs_magnetization);
7274
#endif
73-
for(int i=0;i<3;i++)this->tot_magnetization_nc[i] *= omega/ nxyz;
75+
for(int i=0;i<3;i++) {this->tot_magnetization_nc[i] *= omega/ nxyz;
76+
}
7477
this->abs_magnetization *= omega/ nxyz;
7578
GlobalV::ofs_running<<"total magnetism (Bohr mag/cell)"<<'\t'<<this->tot_magnetization_nc[0]<<'\t'<<this->tot_magnetization_nc[1]<<'\t'<<this->tot_magnetization_nc[2]<<'\n';
7679
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"absolute magnetism (Bohr mag/cell)",this->abs_magnetization);

0 commit comments

Comments
 (0)