Skip to content

Commit eb1665c

Browse files
PKUJZXmohanchen
andauthored
Fix: initialize variable gamma to prevent undefined behavior in lattice_change_cg.cpp (#7038)
Co-authored-by: Mohan Chen <mohanchen@pku.edu.cn>
1 parent a84c95b commit eb1665c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

source/source_relax/lattice_change_cg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ void Lattice_Change_CG::setup_cg_grad(double *grad,
279279
{
280280
ModuleBase::TITLE("Lattice_Change_CG", "setup_cg_grad");
281281
assert(Lattice_Change_Basic::stress_step > 0);
282-
double gamma;
282+
double gamma = 0.0;
283283
double cg0_cg, cg0_cg0, cg0_g;
284284

285285
if (ncggrad % 10000 == 0 || flag == 2)

0 commit comments

Comments
 (0)