Merge branch 'clean-master2' of github.com:julient31/lammps into pppm_spin
Conflicts: src/SPIN/pair_spin_exchange.cpp src/atom.cpp src/pair.cpp
This commit is contained in:
73
src/atom.cpp
73
src/atom.cpp
@ -58,6 +58,7 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
|
||||
natoms = 0;
|
||||
nlocal = nghost = nmax = 0;
|
||||
ntypes = 0;
|
||||
nellipsoids = nlines = ntris = nbodies = 0;
|
||||
nbondtypes = nangletypes = ndihedraltypes = nimpropertypes = 0;
|
||||
nbonds = nangles = ndihedrals = nimpropers = 0;
|
||||
|
||||
@ -99,7 +100,7 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
|
||||
// SPIN package
|
||||
|
||||
sp = fm = fm_long = NULL;
|
||||
|
||||
|
||||
// USER-DPD
|
||||
|
||||
uCond = uMech = uChem = uCG = uCGnew = NULL;
|
||||
@ -739,6 +740,45 @@ int Atom::tag_consecutive()
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
check that bonus data settings are valid
|
||||
error if number of atoms with ellipsoid/line/tri/body flags
|
||||
are consistent with global setting.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::bonus_check()
|
||||
{
|
||||
bigint local_ellipsoids = 0, local_lines = 0, local_tris = 0;
|
||||
bigint local_bodies = 0, num_global;
|
||||
|
||||
for (int i = 0; i < nlocal; ++i) {
|
||||
if (ellipsoid && (ellipsoid[i] >=0)) ++local_ellipsoids;
|
||||
if (line && (line[i] >=0)) ++local_lines;
|
||||
if (tri && (tri[i] >=0)) ++local_tris;
|
||||
if (body && (body[i] >=0)) ++local_bodies;
|
||||
}
|
||||
|
||||
MPI_Allreduce(&local_ellipsoids,&num_global,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
if (nellipsoids != num_global)
|
||||
error->all(FLERR,"Inconsistent 'ellipsoids' header value and number of "
|
||||
"atoms with enabled ellipsoid flags");
|
||||
|
||||
MPI_Allreduce(&local_lines,&num_global,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
if (nlines != num_global)
|
||||
error->all(FLERR,"Inconsistent 'lines' header value and number of "
|
||||
"atoms with enabled line flags");
|
||||
|
||||
MPI_Allreduce(&local_tris,&num_global,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
if (ntris != num_global)
|
||||
error->all(FLERR,"Inconsistent 'tris' header value and number of "
|
||||
"atoms with enabled tri flags");
|
||||
|
||||
MPI_Allreduce(&local_bodies,&num_global,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
if (nbodies != num_global)
|
||||
error->all(FLERR,"Inconsistent 'bodies' header value and number of "
|
||||
"atoms with enabled body flags");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
count and return words in a single line
|
||||
make copy of line before using strtok so as not to change line
|
||||
@ -1517,7 +1557,7 @@ void Atom::set_mass(const char *file, int line, int itype, double value)
|
||||
called from reading of input script
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::set_mass(const char *file, int line, int narg, char **arg)
|
||||
void Atom::set_mass(const char *file, int line, int /*narg*/, char **arg)
|
||||
{
|
||||
if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style");
|
||||
|
||||
@ -1534,7 +1574,8 @@ void Atom::set_mass(const char *file, int line, int narg, char **arg)
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
set all masses as read in from restart file
|
||||
set all masses
|
||||
called from reading of restart file, also from ServerMD
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::set_mass(double *values)
|
||||
@ -1884,11 +1925,19 @@ void Atom::setup_sort_bins()
|
||||
// user setting if explicitly set
|
||||
// default = 1/2 of neighbor cutoff
|
||||
// check if neighbor cutoff = 0.0
|
||||
// and in that case, disable sorting
|
||||
|
||||
double binsize;
|
||||
double binsize = 0.0;
|
||||
if (userbinsize > 0.0) binsize = userbinsize;
|
||||
else binsize = 0.5 * neighbor->cutneighmax;
|
||||
if (binsize == 0.0) error->all(FLERR,"Atom sorting has bin size = 0.0");
|
||||
else if (neighbor->cutneighmax > 0.0) binsize = 0.5 * neighbor->cutneighmax;
|
||||
|
||||
if ((binsize == 0.0) && (sortfreq > 0)) {
|
||||
sortfreq = 0;
|
||||
if (comm->me == 0)
|
||||
error->warning(FLERR,"No pairwise cutoff or binsize set. "
|
||||
"Atom sorting therefore disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
double bininv = 1.0/binsize;
|
||||
|
||||
@ -2036,9 +2085,7 @@ void Atom::delete_callback(const char *id, int flag)
|
||||
{
|
||||
if (id == NULL) return;
|
||||
|
||||
int ifix;
|
||||
for (ifix = 0; ifix < modify->nfix; ifix++)
|
||||
if (strcmp(id,modify->fix[ifix]->id) == 0) break;
|
||||
int ifix = modify->find_fix(id);
|
||||
|
||||
// compact the list of callbacks
|
||||
|
||||
@ -2046,6 +2093,8 @@ void Atom::delete_callback(const char *id, int flag)
|
||||
int match;
|
||||
for (match = 0; match < nextra_grow; match++)
|
||||
if (extra_grow[match] == ifix) break;
|
||||
if ((nextra_grow == 0) || (match == nextra_grow))
|
||||
error->all(FLERR,"Trying to delete non-existent Atom::grow() callback");
|
||||
for (int i = match; i < nextra_grow-1; i++)
|
||||
extra_grow[i] = extra_grow[i+1];
|
||||
nextra_grow--;
|
||||
@ -2054,6 +2103,8 @@ void Atom::delete_callback(const char *id, int flag)
|
||||
int match;
|
||||
for (match = 0; match < nextra_restart; match++)
|
||||
if (extra_restart[match] == ifix) break;
|
||||
if ((nextra_restart == 0) || (match == nextra_restart))
|
||||
error->all(FLERR,"Trying to delete non-existent Atom::restart() callback");
|
||||
for (int i = match; i < nextra_restart-1; i++)
|
||||
extra_restart[i] = extra_restart[i+1];
|
||||
nextra_restart--;
|
||||
@ -2062,6 +2113,8 @@ void Atom::delete_callback(const char *id, int flag)
|
||||
int match;
|
||||
for (match = 0; match < nextra_border; match++)
|
||||
if (extra_border[match] == ifix) break;
|
||||
if ((nextra_border == 0) || (match == nextra_border))
|
||||
error->all(FLERR,"Trying to delete non-existent Atom::border() callback");
|
||||
for (int i = match; i < nextra_border-1; i++)
|
||||
extra_border[i] = extra_border[i+1];
|
||||
nextra_border--;
|
||||
@ -2278,7 +2331,7 @@ int Atom::memcheck(const char *str)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strlen(memstr) + n >= memlength) {
|
||||
if ((int)strlen(memstr) + n >= memlength) {
|
||||
memlength += DELTA_MEMSTR;
|
||||
memory->grow(memstr,memlength,"atom:memstr");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user