Merge pull request #407 from frobnitzem/master

Add error check to lammps_gather_atoms/lammps_scatter_atoms in library.cpp
This commit is contained in:
sjplimp 2017-03-10 11:00:30 -07:00 committed by GitHub
commit c97feafca6
1 changed files with 8 additions and 0 deletions

View File

@ -761,6 +761,10 @@ void lammps_gather_atoms(void *ptr, char *name,
int i,j,offset;
void *vptr = lmp->atom->extract(name);
if(vptr == NULL) {
lmp->error->warning(FLERR,"lammps_gather_atoms: unknown property name");
return;
}
// copy = Natom length vector of per-atom values
// use atom ID to insert each atom's values into copy
@ -857,6 +861,10 @@ void lammps_scatter_atoms(void *ptr, char *name,
int i,j,m,offset;
void *vptr = lmp->atom->extract(name);
if(vptr == NULL) {
lmp->error->warning(FLERR,"lammps_scatter_atoms: unknown property name");
return;
}
// copy = Natom length vector of per-atom values
// use atom ID to insert each atom's values into copy