guard against extracting too many elements from the MEAM library into the statically sized arrays

this will abort with a meaningful error message and people can fix up their LAMMPS binary as needed.
This commit is contained in:
Axel Kohlmeyer
2019-04-06 16:23:10 -04:00
parent cb27d03c79
commit 3070a11041

View File

@ -226,6 +226,9 @@ void PairMEAMC::coeff(int narg, char **arg)
}
nelements = narg - 4 - atom->ntypes;
if (nelements < 1) error->all(FLERR,"Incorrect args for pair coefficients");
if (nelements > maxelt)
error->all(FLERR,"Too many elements extracted from MEAM library. "
"Increase 'maxelt' in meam.h and recompile.");
elements = new char*[nelements];
mass = new double[nelements];