Fix invalid memory read, from @akohlmey
This commit is contained in:
@ -60,7 +60,7 @@ namespace ReaxFF {
|
||||
hbond_list = hbonds->select.hbond_list;
|
||||
|
||||
for (j = 0; j < system->n; ++j)
|
||||
if (system->reax_param.sbp[system->my_atoms[j].type].p_hbond == 1) {
|
||||
if ((system->my_atoms[j].type >= 0) && (system->reax_param.sbp[system->my_atoms[j].type].p_hbond == 1)) {
|
||||
type_j = system->my_atoms[j].type;
|
||||
start_j = Start_Index(j, bonds);
|
||||
end_j = End_Index(j, bonds);
|
||||
|
||||
@ -56,7 +56,7 @@ namespace ReaxFF {
|
||||
if (control->hbond_cut > 0)
|
||||
for (i = 0; i < system->n; ++i) {
|
||||
atom = &(system->my_atoms[i]);
|
||||
if (system->reax_param.sbp[atom->type].p_hbond == 1 && atom->type >= 0)
|
||||
if ((atom->type >= 0) && (system->reax_param.sbp[atom->type].p_hbond == 1 && atom->type >= 0))
|
||||
atom->Hindex = system->numH++;
|
||||
else atom->Hindex = -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user