diff --git a/src/REAXFF/reaxff_hydrogen_bonds.cpp b/src/REAXFF/reaxff_hydrogen_bonds.cpp index 6f5c663da0..421dd7e1a4 100644 --- a/src/REAXFF/reaxff_hydrogen_bonds.cpp +++ b/src/REAXFF/reaxff_hydrogen_bonds.cpp @@ -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); diff --git a/src/REAXFF/reaxff_init_md.cpp b/src/REAXFF/reaxff_init_md.cpp index 268af75358..55c7a03f7c 100644 --- a/src/REAXFF/reaxff_init_md.cpp +++ b/src/REAXFF/reaxff_init_md.cpp @@ -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; }