Skip to content

Commit c1b7db6

Browse files
committed
Merge branch 'relax-fix' of https://github.com/sunliang98/abacus-develop into relax-fix
2 parents 6a6fa6d + 6437d9a commit c1b7db6

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

source/module_relax/relax_old/lattice_change_basic.cpp

+11-6
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ void Lattice_Change_Basic::change_lattice(UnitCell &ucell, double *move, double
7272
{
7373
ModuleBase::TITLE("Lattice_Change_Basic", "change_lattice");
7474

75-
assert(move != NULL);
76-
assert(lat != NULL);
75+
assert(move != nullptr);
76+
assert(lat != nullptr);
7777

7878
/*
7979
std::cout<<" LATTICE CONSTANT OLD:"<<std::endl;
@@ -86,11 +86,15 @@ void Lattice_Change_Basic::change_lattice(UnitCell &ucell, double *move, double
8686
if (ModuleSymmetry::Symmetry::symm_flag && ucell.symm.nrotk > 0)
8787
{
8888
ModuleBase::matrix move_mat_t(3, 3);
89-
for (int i = 0;i < 3;++i)for (int j = 0;j < 3;++j)move_mat_t(j, i) = move[i * 3 + j] / ucell.lat0; //transpose
89+
for (int i = 0;i < 3;++i) {for (int j = 0;j < 3;++j) {move_mat_t(j, i) = move[i * 3 + j] / ucell.lat0; //transpose
90+
}
91+
}
9092
ModuleBase::matrix symm_move_mat_t = (move_mat_t * ucell.G.to_matrix());//symmetrize (latvec^{-1} * move_mat)^T
9193
ucell.symm.symmetrize_mat3(symm_move_mat_t, ucell.lat);
9294
move_mat_t = symm_move_mat_t * ucell.latvec.Transpose().to_matrix();//G^{-1}=latvec^T
93-
for (int i = 0;i < 3;++i)for (int j = 0;j < 3;++j)move[i * 3 + j] = move_mat_t(j, i) * ucell.lat0;//transpose back
95+
for (int i = 0;i < 3;++i) {for (int j = 0;j < 3;++j) {move[i * 3 + j] = move_mat_t(j, i) * ucell.lat0;//transpose back
96+
}
97+
}
9498
}
9599

96100
if (ucell.lc[0] != 0)
@@ -167,8 +171,9 @@ void Lattice_Change_Basic::check_converged(const UnitCell &ucell, ModuleBase::ma
167171
{
168172
for (int i = 0; i < 3; i++)
169173
{
170-
if (stress_ii_max < std::abs(stress(i, i)))
174+
if (stress_ii_max < std::abs(stress(i, i))) {
171175
stress_ii_max = std::abs(stress(i, i));
176+
}
172177
for (int j = 0; j < 3; j++)
173178
{
174179
if (Lattice_Change_Basic::largest_grad < std::abs(stress(i, j)))
@@ -244,7 +249,7 @@ void Lattice_Change_Basic::check_converged(const UnitCell &ucell, ModuleBase::ma
244249
return;
245250
}
246251

247-
void Lattice_Change_Basic::terminate(void)
252+
void Lattice_Change_Basic::terminate()
248253
{
249254
ModuleBase::TITLE("Lattice_Change_Basic", "terminate");
250255
if (Lattice_Change_Basic::converged)

0 commit comments

Comments
 (0)