add sanity check on valid angle type

This commit is contained in:
Axel Kohlmeyer
2022-12-25 06:25:45 -05:00
parent ecf11f2f20
commit c4f2befb1f

View File

@ -56,6 +56,9 @@ void AngleWrite::command(int narg, char **arg)
if (narg != 4) error->all(FLERR, "Illegal angle_write command");
int atype = utils::inumeric(FLERR, arg[0], false, lmp);
if ((atype <= 0) || (atype > atom->nangletypes))
error->all(FLERR, "Invalid angle type {} in angle_write command", atype);
int n = utils::inumeric(FLERR, arg[1], false, lmp);
std::string table_file = arg[2];
std::string keyword = arg[3];