Fix merge conflicts, minor style fixes
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "memory.h"
|
||||
#include "read_data.h"
|
||||
#include "tokenizer.h"
|
||||
|
||||
#include <cstring>
|
||||
@ -54,8 +55,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"mol") == 0) {
|
||||
if (atom->molecule_flag)
|
||||
error->all(FLERR,"Fix property/atom mol when atom_style "
|
||||
"already has molecule attribute");
|
||||
error->all(FLERR,"Fix property/atom mol when atom_style already has molecule attribute");
|
||||
if (molecule_flag)
|
||||
error->all(FLERR,"Fix property/atom cannot specify mol twice");
|
||||
styles[nvalue] = MOLECULE;
|
||||
@ -95,6 +95,8 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
index[nvalue] = atom->find_custom(&arg[iarg][2],flag,ncols);
|
||||
if (index[nvalue] >= 0)
|
||||
error->all(FLERR,"Fix property/atom vector name already exists");
|
||||
if (ReadData::is_data_section(id))
|
||||
error->all(FLERR,"Fix property/atom fix ID must not be a data file section name");
|
||||
index[nvalue] = atom->add_custom(&arg[iarg][2],0,0);
|
||||
cols[nvalue] = 0;
|
||||
values_peratom++;
|
||||
@ -107,6 +109,8 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
index[nvalue] = atom->find_custom(&arg[iarg][2],flag,ncols);
|
||||
if (index[nvalue] >= 0)
|
||||
error->all(FLERR,"Fix property/atom vector name already exists");
|
||||
if (ReadData::is_data_section(id))
|
||||
error->all(FLERR,"Fix property/atom fix ID must not be a data file section name");
|
||||
index[nvalue] = atom->add_custom(&arg[iarg][2],1,0);
|
||||
cols[nvalue] = 0;
|
||||
values_peratom++;
|
||||
@ -122,6 +126,8 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
which = atom->find_custom(&arg[iarg][3],flag,ncols);
|
||||
if (which >= 0)
|
||||
error->all(FLERR,"Fix property/atom array name {} already exists", &arg[iarg][3]);
|
||||
if (ReadData::is_data_section(id))
|
||||
error->all(FLERR,"Fix property/atom fix ID must not be a data file section name");
|
||||
|
||||
ncols = utils::inumeric(FLERR,arg[iarg+1],true,lmp);
|
||||
if (ncols < 1)
|
||||
@ -151,9 +157,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"ghost") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) border = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) border = 1;
|
||||
else error->all(FLERR,"Illegal fix property/atom command");
|
||||
border = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal fix property/atom command");
|
||||
}
|
||||
@ -181,7 +185,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
// register with Atom class
|
||||
|
||||
nmax_old = 0;
|
||||
if (!lmp->kokkos) grow_arrays(atom->nmax);
|
||||
if (!lmp->kokkos) FixPropertyAtom::grow_arrays(atom->nmax);
|
||||
atom->add_callback(Atom::GROW);
|
||||
atom->add_callback(Atom::RESTART);
|
||||
if (border) atom->add_callback(Atom::BORDER);
|
||||
@ -485,8 +489,8 @@ double FixPropertyAtom::memory_usage()
|
||||
else if (styles[m] == RMASS) bytes = atom->nmax * sizeof(double);
|
||||
else if (styles[m] == IVEC) bytes = atom->nmax * sizeof(int);
|
||||
else if (styles[m] == DVEC) bytes = atom->nmax * sizeof(double);
|
||||
else if (styles[m] == IARRAY) bytes = atom->nmax * cols[m] * sizeof(int);
|
||||
else if (styles[m] == DARRAY) bytes = atom->nmax * cols[m] * sizeof(double);
|
||||
else if (styles[m] == IARRAY) bytes = (size_t) atom->nmax * cols[m] * sizeof(int);
|
||||
else if (styles[m] == DARRAY) bytes = (size_t) atom->nmax * cols[m] * sizeof(double);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
@ -523,11 +527,11 @@ void FixPropertyAtom::grow_arrays(int nmax)
|
||||
memset(&atom->dvector[index[nv]][nmax_old],0,nbytes);
|
||||
} else if (styles[nv] == IARRAY) {
|
||||
memory->grow(atom->iarray[index[nv]],nmax,cols[nv],"atom:iarray");
|
||||
size_t nbytes = (nmax-nmax_old) * cols[nv] * sizeof(int);
|
||||
size_t nbytes = (size_t) (nmax-nmax_old) * cols[nv] * sizeof(int);
|
||||
if (nbytes) memset(&atom->iarray[index[nv]][nmax_old][0],0,nbytes);
|
||||
} else if (styles[nv] == DARRAY) {
|
||||
memory->grow(atom->darray[index[nv]],nmax,cols[nv],"atom:darray");
|
||||
size_t nbytes = (nmax-nmax_old) * cols[nv] * sizeof(double);
|
||||
size_t nbytes = (size_t) (nmax-nmax_old) * cols[nv] * sizeof(double);
|
||||
if (nbytes) memset(&atom->darray[index[nv]][nmax_old][0],0,nbytes);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user