Merge branch 'master' into prepare-clang-format

# Conflicts:
#	src/KOKKOS/nbin_kokkos.h
#	src/KOKKOS/nbin_ssa_kokkos.h
#	src/MOLECULE/bond_fene_expand.h
#	src/USER-DPD/nbin_ssa.h
#	src/USER-DPD/nstencil_half_bin_2d_ssa.h
#	src/USER-DPD/nstencil_half_bin_3d_ssa.h
#	src/USER-INTEL/nbin_intel.h
#	src/USER-MISC/fix_propel_self.cpp
#	src/USER-OMP/npair_full_multi_old_omp.h
#	src/USER-OMP/npair_half_multi_old_newton_omp.h
#	src/USER-OMP/npair_half_size_multi_newtoff_omp.h
#	src/USER-OMP/npair_halffull_newtoff_omp.h
#	src/USER-OMP/npair_halffull_newton_omp.h
#	src/USER-OMP/npair_skip_omp.h
#	src/main.cpp
#	src/nbin_standard.h
#	src/npair_full_multi_old.h
#	src/npair_halffull_newtoff.h
#	src/npair_halffull_newton.h
#	src/npair_skip.h
#	src/npair_skip_respa.h
#	src/npair_skip_size.h
#	src/npair_skip_size_off2on.h
#	src/npair_skip_size_off2on_oneside.h
#	src/nstencil_full_bin_2d.h
#	src/nstencil_full_bin_3d.h
#	src/nstencil_full_ghost_bin_2d.h
#	src/nstencil_full_ghost_bin_3d.h
#	src/nstencil_full_multi_2d.h
#	src/nstencil_full_multi_3d.h
#	src/nstencil_full_multi_old_2d.h
#	src/nstencil_full_multi_old_3d.h
#	src/nstencil_half_bin_2d_newtoff.cpp
#	src/nstencil_half_bin_3d_newtoff.cpp
#	src/nstencil_half_bin_3d_newton_tri.h
#	src/nstencil_half_ghost_bin_2d_newtoff.cpp
#	src/nstencil_half_ghost_bin_2d_newtoff.h
#	src/nstencil_half_ghost_bin_3d_newtoff.cpp
#	src/nstencil_half_ghost_bin_3d_newtoff.h
#	src/nstencil_half_multi_2d.h
#	src/nstencil_half_multi_2d_newtoff.h
#	src/nstencil_half_multi_2d_newton_tri.h
#	src/nstencil_half_multi_2d_tri.h
#	src/nstencil_half_multi_3d_newtoff.h
#	src/nstencil_half_multi_3d_newton_tri.h
This commit is contained in:
Axel Kohlmeyer
2021-05-14 14:53:49 -04:00
626 changed files with 54551 additions and 12282 deletions

View File

@ -36,7 +36,6 @@
#include "update.h"
#include <cstring>
#ifdef _OPENMP
#include <omp.h>
#endif
@ -59,6 +58,9 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp)
bordergroup = 0;
cutghostuser = 0.0;
cutusermulti = nullptr;
cutusermultiold = nullptr;
ncollections = 0;
ncollections_cutoff = 0;
ghost_velocity = 0;
user_procgrid[0] = user_procgrid[1] = user_procgrid[2] = 0;
@ -77,6 +79,7 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp)
grid2proc = nullptr;
xsplit = ysplit = zsplit = nullptr;
rcbnew = 0;
multi_reduce = 0;
// use of OpenMP threads
// query OpenMP for number of threads/process set by user at run-time
@ -118,6 +121,7 @@ Comm::~Comm()
memory->destroy(ysplit);
memory->destroy(zsplit);
memory->destroy(cutusermulti);
memory->destroy(cutusermultiold);
delete [] customfile;
delete [] outfile;
}
@ -145,9 +149,16 @@ void Comm::copy_arrays(Comm *oldcomm)
memcpy(zsplit,oldcomm->zsplit,(procgrid[2]+1)*sizeof(double));
}
ncollections = oldcomm->ncollections;
ncollections_cutoff = oldcomm->ncollections_cutoff;
if (oldcomm->cutusermulti) {
memory->create(cutusermulti,atom->ntypes+1,"comm:cutusermulti");
memcpy(cutusermulti,oldcomm->cutusermulti,atom->ntypes+1);
memory->create(cutusermulti,ncollections_cutoff,"comm:cutusermulti");
memcpy(cutusermulti,oldcomm->cutusermulti,ncollections_cutoff);
}
if (oldcomm->cutusermultiold) {
memory->create(cutusermultiold,atom->ntypes+1,"comm:cutusermultiold");
memcpy(cutusermultiold,oldcomm->cutusermultiold,atom->ntypes+1);
}
if (customfile)
@ -236,6 +247,18 @@ void Comm::init()
maxexchange_fix_dynamic = 0;
for (int i = 0; i < nfix; i++)
if (fix[i]->maxexchange_dynamic) maxexchange_fix_dynamic = 1;
if ((mode == Comm::MULTI) && (neighbor->style != Neighbor::MULTI))
error->all(FLERR,"Cannot use comm mode multi without multi-style neighbor lists");
if (multi_reduce) {
if (force->newton == 0)
error->all(FLERR,"Cannot use multi/reduce communication with Newton off");
if (neighbor->any_full())
error->all(FLERR,"Cannot use multi/reduce communication with a full neighbor list");
if (mode != Comm::MULTI)
error->all(FLERR,"Cannot use multi/reduce communication without mode multi");
}
}
/* ----------------------------------------------------------------------
@ -271,13 +294,26 @@ void Comm::modify_params(int narg, char **arg)
if (strcmp(arg[iarg+1],"single") == 0) {
// need to reset cutghostuser when switching comm mode
if (mode == Comm::MULTI) cutghostuser = 0.0;
if (mode == Comm::MULTIOLD) cutghostuser = 0.0;
memory->destroy(cutusermulti);
cutusermulti = nullptr;
memory->destroy(cutusermultiold);
mode = Comm::SINGLE;
} else if (strcmp(arg[iarg+1],"multi") == 0) {
if (neighbor->style != Neighbor::MULTI)
error->all(FLERR,"Cannot use comm mode 'multi' without 'multi' style neighbor lists");
// need to reset cutghostuser when switching comm mode
if (mode == Comm::SINGLE) cutghostuser = 0.0;
if (mode == Comm::MULTIOLD) cutghostuser = 0.0;
memory->destroy(cutusermultiold);
mode = Comm::MULTI;
} else if (strcmp(arg[iarg+1],"multi/old") == 0) {
if (neighbor->style == Neighbor::MULTI)
error->all(FLERR,"Cannot use comm mode 'multi/old' with 'multi' style neighbor lists");
// need to reset cutghostuser when switching comm mode
if (mode == Comm::SINGLE) cutghostuser = 0.0;
if (mode == Comm::MULTI) cutghostuser = 0.0;
memory->destroy(cutusermulti);
mode = Comm::MULTIOLD;
} else error->all(FLERR,"Illegal comm_modify command");
iarg += 2;
} else if (strcmp(arg[iarg],"group") == 0) {
@ -292,8 +328,9 @@ void Comm::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg],"cutoff") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
if (mode == Comm::MULTI)
error->all(FLERR,
"Use cutoff/multi keyword to set cutoff in multi mode");
error->all(FLERR, "Use cutoff/multi keyword to set cutoff in multi mode");
if (mode == Comm::MULTIOLD)
error->all(FLERR, "Use cutoff/multi/old keyword to set cutoff in multi mode");
cutghostuser = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (cutghostuser < 0.0)
error->all(FLERR,"Invalid cutoff in comm_modify command");
@ -303,16 +340,45 @@ void Comm::modify_params(int narg, char **arg)
double cut;
if (mode == Comm::SINGLE)
error->all(FLERR,"Use cutoff keyword to set cutoff in single mode");
if (mode == Comm::MULTIOLD)
error->all(FLERR,"Use cutoff/multi/old keyword to set cutoff in multi/old mode");
if (domain->box_exist == 0)
error->all(FLERR,
"Cannot set cutoff/multi before simulation box is defined");
error->all(FLERR, "Cannot set cutoff/multi before simulation box is defined");
// Check if # of collections has changed, if so erase any previously defined cutoffs
// Neighbor will reset ncollections if collections are redefined
if (! cutusermulti || ncollections_cutoff != neighbor->ncollections) {
ncollections_cutoff = neighbor->ncollections;
memory->destroy(cutusermulti);
memory->create(cutusermulti,ncollections_cutoff,"comm:cutusermulti");
for (i=0; i < ncollections_cutoff; ++i)
cutusermulti[i] = -1.0;
}
utils::bounds(FLERR,arg[iarg+1],1,ncollections_cutoff,nlo,nhi,error);
cut = utils::numeric(FLERR,arg[iarg+2],false,lmp);
cutghostuser = MAX(cutghostuser,cut);
if (cut < 0.0)
error->all(FLERR,"Invalid cutoff in comm_modify command");
// collections use 1-based indexing externally and 0-based indexing internally
for (i=nlo; i<=nhi; ++i)
cutusermulti[i-1] = cut;
iarg += 3;
} else if (strcmp(arg[iarg],"cutoff/multi/old") == 0) {
int i,nlo,nhi;
double cut;
if (mode == Comm::SINGLE)
error->all(FLERR,"Use cutoff keyword to set cutoff in single mode");
if (mode == Comm::MULTI)
error->all(FLERR,"Use cutoff/multi keyword to set cutoff in multi mode");
if (domain->box_exist == 0)
error->all(FLERR, "Cannot set cutoff/multi before simulation box is defined");
const int ntypes = atom->ntypes;
if (iarg+3 > narg)
error->all(FLERR,"Illegal comm_modify command");
if (cutusermulti == nullptr) {
memory->create(cutusermulti,ntypes+1,"comm:cutusermulti");
if (cutusermultiold == nullptr) {
memory->create(cutusermultiold,ntypes+1,"comm:cutusermultiold");
for (i=0; i < ntypes+1; ++i)
cutusermulti[i] = -1.0;
cutusermultiold[i] = -1.0;
}
utils::bounds(FLERR,arg[iarg+1],1,ntypes,nlo,nhi,error);
cut = utils::numeric(FLERR,arg[iarg+2],false,lmp);
@ -320,8 +386,13 @@ void Comm::modify_params(int narg, char **arg)
if (cut < 0.0)
error->all(FLERR,"Invalid cutoff in comm_modify command");
for (i=nlo; i<=nhi; ++i)
cutusermulti[i] = cut;
cutusermultiold[i] = cut;
iarg += 3;
} else if (strcmp(arg[iarg],"reduce/multi") == 0) {
if (mode == Comm::SINGLE)
error->all(FLERR,"Use reduce/multi in mode multi only");
multi_reduce = 1;
iarg += 1;
} else if (strcmp(arg[iarg],"vel") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) ghost_velocity = 1;
@ -668,6 +739,13 @@ double Comm::get_comm_cutoff()
error->warning(FLERR,"Communication cutoff adjusted to {}",maxcommcutoff);
}
// Check maximum interval size for neighbor multi
if (neighbor->interval_collection_flag) {
for (int i = 0; i < neighbor->ncollections; i++){
maxcommcutoff = MAX(maxcommcutoff, neighbor->collection2cut[i]);
}
}
return maxcommcutoff;
}