Skip to content

Commit 9ba3c39

Browse files
[pre-commit.ci lite] apply automatic fixes
1 parent 044abcd commit 9ba3c39

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

source/module_relax/relax_old/ions_move_basic.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ void Ions_Move_Basic::setup_gradient(const UnitCell &ucell, const ModuleBase::ma
2929
ModuleBase::TITLE("Ions_Move_Basic", "setup_gradient");
3030

3131
assert(ucell.ntype > 0);
32-
assert(pos != NULL);
33-
assert(grad != NULL);
32+
assert(pos != nullptr);
33+
assert(grad != nullptr);
3434
assert(dim == 3 * ucell.nat);
3535

3636
ModuleBase::GlobalFunc::ZEROS(pos, dim);
@@ -65,8 +65,8 @@ void Ions_Move_Basic::move_atoms(UnitCell &ucell, double *move, double *pos)
6565
{
6666
ModuleBase::TITLE("Ions_Move_Basic", "move_atoms");
6767

68-
assert(move != NULL);
69-
assert(pos != NULL);
68+
assert(move != nullptr);
69+
assert(pos != nullptr);
7070

7171
//------------------------
7272
// for test only
@@ -95,8 +95,9 @@ void Ions_Move_Basic::move_atoms(UnitCell &ucell, double *move, double *pos)
9595
const double move_threshold = 1.0e-10;
9696
const int total_freedom = ucell.nat * 3;
9797

98-
if (ModuleSymmetry::Symmetry::symm_flag && ucell.symm.all_mbl && ucell.symm.nrotk > 0)
98+
if (ModuleSymmetry::Symmetry::symm_flag && ucell.symm.all_mbl && ucell.symm.nrotk > 0) {
9999
ucell.symm.symmetrize_vec3_nat(move);
100+
}
100101

101102
for (int i = 0; i < total_freedom; i++)
102103
{

source/module_relax/relax_old/ions_move_sd.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Ions_Move_SD::~Ions_Move_SD()
2020
delete[] pos_saved;
2121
}
2222

23-
void Ions_Move_SD::allocate(void)
23+
void Ions_Move_SD::allocate()
2424
{
2525
ModuleBase::TITLE("Ions_Move_SD", "allocate");
2626
assert(dim > 0);
@@ -37,8 +37,8 @@ void Ions_Move_SD::start(UnitCell& ucell, const ModuleBase::matrix& force, const
3737
ModuleBase::TITLE("Ions_Move_SD", "start");
3838

3939
assert(dim > 0);
40-
assert(grad_saved != 0);
41-
assert(pos_saved != 0);
40+
assert(grad_saved != nullptr);
41+
assert(pos_saved != nullptr);
4242

4343
std::vector<double> pos(dim);
4444
std::vector<double> grad(dim);
@@ -49,7 +49,7 @@ void Ions_Move_SD::start(UnitCell& ucell, const ModuleBase::matrix& force, const
4949

5050
// 1: ediff = 0
5151
// 0: ediff < 0
52-
bool judgement = 0;
52+
bool judgement = false;
5353
setup_etot(etot_in, judgement);
5454
setup_gradient(ucell, force, pos.data(), grad.data());
5555

@@ -58,8 +58,9 @@ void Ions_Move_SD::start(UnitCell& ucell, const ModuleBase::matrix& force, const
5858
printf("in cheak_converged");
5959
printf("pos[0]: %f\n", pos[0]);
6060
energy_saved = etot_in;
61-
for (int i = 0; i < dim; i++)
61+
for (int i = 0; i < dim; i++) {
6262
pos_saved[i] = pos[i];
63+
}
6364
for (int i = 0; i < dim; i++)
6465
{
6566
grad_saved[i] = grad[i];
@@ -93,7 +94,7 @@ void Ions_Move_SD::start(UnitCell& ucell, const ModuleBase::matrix& force, const
9394
return;
9495
}
9596

96-
void Ions_Move_SD::cal_tradius_sd(void) const
97+
void Ions_Move_SD::cal_tradius_sd() const
9798
{
9899
static int accepted_number = 0;
99100

0 commit comments

Comments
 (0)