Unverified Commit f81b963a authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

more strict argument checking and initializing output data to zero

parent c92378ea
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ static const char cite_user_ptm_package[] =

ComputePTMAtom::ComputePTMAtom(LAMMPS *lmp, int narg, char **arg)
    : Compute(lmp, narg, arg), list(NULL), output(NULL) {
  if (narg < 5)
  if (narg < 5 || narg > 6)
    error->all(FLERR, "Illegal compute ptm/atom command");

  char *structures = arg[3];
@@ -283,6 +283,10 @@ void ComputePTMAtom::compute_peratom() {
  int *mask = atom->mask;
  ptmnbrdata_t nbrlist = {x, numneigh, firstneigh, ilist, atom->nlocal, mask, group2bit};

  // zero output

  memset(output,0,nmax*NUM_COLUMNS*sizeof(double));

  for (int ii = 0; ii < inum; ii++) {

    int i = ilist[ii];