Skip to content

Commit 5c416f5

Browse files
committed
fix useless assert
1 parent 78a3697 commit 5c416f5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

source/module_elecstate/elecstate_energy.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,16 @@ double ElecState::cal_delta_eband(const UnitCell& ucell) const
131131
if (get_xc_func_type() == 3 || get_xc_func_type() == 5)
132132
{
133133
v_ofk = this->pot->get_effective_vofk(0);
134+
134135
}
135-
assert(v_ofk!=nullptr);
136+
136137
for (int ir = 0; ir < this->charge->rhopw->nrxx; ir++)
137138
{
138139
deband_aux -= this->charge->rho[0][ir] * (v_eff[ir] - v_fixed[ir]);
139140
if (get_xc_func_type() == 3 || get_xc_func_type() == 5)
140141
{
142+
// cause in the get_effective_vofk, the func will return nullptr
143+
assert(v_ofk!=nullptr);
141144
deband_aux -= this->charge->kin_r[0][ir] * v_ofk[ir];
142145
}
143146
}
@@ -201,12 +204,13 @@ double ElecState::cal_delta_escf() const
201204
{
202205
v_ofk = this->pot->get_effective_vofk(0);
203206
}
204-
assert(v_ofk!=nullptr);
205207
for (int ir = 0; ir < this->charge->rhopw->nrxx; ir++)
206208
{
207209
descf -= (this->charge->rho[0][ir] - this->charge->rho_save[0][ir]) * (v_eff[ir] - v_fixed[ir]);
208210
if (get_xc_func_type() == 3 || get_xc_func_type() == 5)
209211
{
212+
// cause in the get_effective_vofk, the func will return nullptr
213+
assert(v_ofk!=nullptr);
210214
descf -= (this->charge->kin_r[0][ir] - this->charge->kin_r_save[0][ir]) * v_ofk[ir];
211215
}
212216
}

source/module_hamilt_general/operator.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ Operator<T, Device>::~Operator()
2525
}
2626
else
2727
{//delete main chain if sub_chain is deleted
28-
assert(last != nullptr);
2928
Operator* node_delete = last;
30-
assert(node_delete->next_sub_op != nullptr);
3129
last_sub = last->next_sub_op;
3230
node_delete->next_sub_op = nullptr;
3331
last = last->next_op;

0 commit comments

Comments
 (0)