Merge pull request #1393 from akohlmey/collected-small-changes

Collected small changes
This commit is contained in:
Axel Kohlmeyer 2019-03-29 13:57:07 -04:00 committed by GitHub
commit dd22b80a9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 310 additions and 289 deletions

View File

@ -1168,6 +1168,10 @@ if(PKG_GPU)
message(FATAL_ERROR "Could not find bin2c, use -DBIN2C=/path/to/bin2c to help cmake finding it.")
endif()
option(CUDPP_OPT "Enable CUDPP_OPT" ON)
option(CUDA_MPS_SUPPORT "Enable tweaks to support CUDA Multi-process service (MPS)" OFF)
if(CUDA_MPS_SUPPORT)
set(GPU_CUDA_MPS_FLAGS "-DCUDA_PROXY")
endif()
set(GPU_ARCH "sm_30" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)")
@ -1231,7 +1235,7 @@ if(PKG_GPU)
add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
target_link_libraries(gpu ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS})
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT)
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS})
if(CUDPP_OPT)
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
target_compile_definitions(gpu PRIVATE -DUSE_CUDPP)

View File

@ -1503,6 +1503,16 @@ target API.
</dl>
</td>
</tr>
<tr>
<td><code>CUDA_MPS_SUPPORT</code> (CUDA only)</td>
<td>Enable tweaks for running with Nvidia CUDA Multi-process services daemon</td>
<td>
<dl>
<dt><code>on</code></dt>
<dt><code>off</code> (default)</dt>
</dl>
</td>
</tr>
<tr>
<td><code>BIN2C</code> (CUDA only)</td>
<td>Path to bin2c executable, will automatically pick up the first one in your $PATH.</td>

View File

@ -211,7 +211,7 @@ $(VENV):
@( \
$(VIRTUALENV) -p $(PYTHON) $(VENV); \
. $(VENV)/bin/activate; \
pip install Sphinx; \
pip install Sphinx==1.7.6; \
deactivate;\
)

View File

@ -82,17 +82,19 @@ which GPU hardware to build for.
[CMake build]:
-D GPU_API=value # value = opencl (default) or cuda
-D GPU_PREC=value # precision setting
# value = double or mixed (default) or single
-D OCL_TUNE=value # hardware choice for GPU_API=opencl
# generic (default) or intel (Intel CPU) or fermi, kepler, cypress (NVIDIA)
-D GPU_ARCH=value # primary GPU hardware choice for GPU_API=cuda
# value = sm_XX, see below
# default is Cuda-compiler dependent, but typically sm_20
-D CUDPP_OPT=value # optimization setting for GPU_API=cuda
# enables CUDA Performance Primitives Optimizations
# yes (default) or no :pre
-D GPU_API=value # value = opencl (default) or cuda
-D GPU_PREC=value # precision setting
# value = double or mixed (default) or single
-D OCL_TUNE=value # hardware choice for GPU_API=opencl
# generic (default) or intel (Intel CPU) or fermi, kepler, cypress (NVIDIA)
-D GPU_ARCH=value # primary GPU hardware choice for GPU_API=cuda
# value = sm_XX, see below
# default is Cuda-compiler dependent, but typically sm_20
-D CUDPP_OPT=value # optimization setting for GPU_API=cuda
# enables CUDA Performance Primitives Optimizations
# value = yes (default) or no
-D CUDA_MPS_SUPPORT=value # enables some tweaks required to run with active nvidia-cuda-mps daemon
# value = yes or no (default) :pre
GPU_ARCH settings for different GPU hardware is as follows:

View File

@ -1277,6 +1277,7 @@ kcl
Kd
KDevelop
ke
kepler
KE
Keblinski
keflag
@ -1690,6 +1691,7 @@ mpiexec
mpiio
mpirun
mplayer
mps
Mryglod
mscg
MSCG
@ -1973,6 +1975,7 @@ oneway
onn
ons
OO
opencl
openKIM
OpenMP
openmp

View File

@ -933,7 +933,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs,
"rendezvous:inbuf");
MPI_Alltoallv(inbuf_a2a,sendcount,sdispls,MPI_CHAR,
inbuf_rvous,recvcount,rdispls,MPI_CHAR,world);
inbuf_rvous,recvcount,rdispls,MPI_CHAR,world);
if (!inorder) {
memory->destroy(procs_a2a);
@ -1036,7 +1036,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs,
outbuf = (char *) memory->smalloc((bigint) nout*outsize,"rendezvous:outbuf");
MPI_Alltoallv(outbuf_a2a,sendcount,sdispls,MPI_CHAR,
outbuf,recvcount,rdispls,MPI_CHAR,world);
outbuf,recvcount,rdispls,MPI_CHAR,world);
memory->destroy(procs_rvous);
memory->sfree(outbuf_rvous);

View File

@ -88,7 +88,7 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) :
int n = strlen(arg[iarg+2]) + 1;
tstr = new char[n];
strcpy(tstr,arg[iarg+2]);
tflag = 1;
tflag = 1;
} else error->all(FLERR,"Illegal compute angle/local command");
iarg += 3;
} else error->all(FLERR,"Illegal compute angle/local command");
@ -102,9 +102,9 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) :
for (int i = 0; i < nvar; i++) {
vvar[i] = input->variable->find(vstr[i]);
if (vvar[i] < 0)
error->all(FLERR,"Variable name for copute angle/local does not exist");
error->all(FLERR,"Variable name for copute angle/local does not exist");
if (!input->variable->equalstyle(vvar[i]))
error->all(FLERR,"Variable for compute angle/local is invalid style");
error->all(FLERR,"Variable for compute angle/local is invalid style");
}
if (tstr) {
@ -153,7 +153,7 @@ void ComputeAngleLocal::init()
for (int i = 0; i < nvar; i++) {
vvar[i] = input->variable->find(vstr[i]);
if (vvar[i] < 0)
error->all(FLERR,"Variable name for compute angle/local does not exist");
error->all(FLERR,"Variable name for compute angle/local does not exist");
}
if (tstr) {
@ -261,53 +261,53 @@ int ComputeAngleLocal::compute_angles(int flag)
// theta needed by one or more outputs
if (tflag) {
delx1 = x[atom1][0] - x[atom2][0];
dely1 = x[atom1][1] - x[atom2][1];
delz1 = x[atom1][2] - x[atom2][2];
domain->minimum_image(delx1,dely1,delz1);
delx1 = x[atom1][0] - x[atom2][0];
dely1 = x[atom1][1] - x[atom2][1];
delz1 = x[atom1][2] - x[atom2][2];
domain->minimum_image(delx1,dely1,delz1);
rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1;
r1 = sqrt(rsq1);
delx2 = x[atom3][0] - x[atom2][0];
dely2 = x[atom3][1] - x[atom2][1];
delz2 = x[atom3][2] - x[atom2][2];
domain->minimum_image(delx2,dely2,delz2);
rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1;
r1 = sqrt(rsq1);
rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2;
r2 = sqrt(rsq2);
delx2 = x[atom3][0] - x[atom2][0];
dely2 = x[atom3][1] - x[atom2][1];
delz2 = x[atom3][2] - x[atom2][2];
domain->minimum_image(delx2,dely2,delz2);
// c = cosine of angle
// theta = angle in radians
rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2;
r2 = sqrt(rsq2);
c = delx1*delx2 + dely1*dely2 + delz1*delz2;
c /= r1*r2;
if (c > 1.0) c = 1.0;
if (c < -1.0) c = -1.0;
theta = acos(c);
// c = cosine of angle
// theta = angle in radians
c = delx1*delx2 + dely1*dely2 + delz1*delz2;
c /= r1*r2;
if (c > 1.0) c = 1.0;
if (c < -1.0) c = -1.0;
theta = acos(c);
}
if (nvalues == 1) ptr = &vlocal[m];
else ptr = alocal[m];
if (nvar) {
ivar = 0;
if (tstr) input->variable->internal_set(tvar,theta);
ivar = 0;
if (tstr) input->variable->internal_set(tvar,theta);
}
for (n = 0; n < nvalues; n++) {
switch (bstyle[n]) {
case THETA:
ptr[n] = 180.0*theta/MY_PI;
break;
case ENG:
if (atype > 0) ptr[n] = angle->single(atype,atom1,atom2,atom3);
else ptr[n] = 0.0;
break;
case VARIABLE:
ptr[n] = input->variable->compute_equal(vvar[ivar]);
ivar++;
break;
switch (bstyle[n]) {
case THETA:
ptr[n] = 180.0*theta/MY_PI;
break;
case ENG:
if (atype > 0) ptr[n] = angle->single(atype,atom1,atom2,atom3);
else ptr[n] = 0.0;
break;
case VARIABLE:
ptr[n] = input->variable->compute_equal(vvar[ivar]);
ivar++;
break;
}
}

View File

@ -105,9 +105,9 @@ ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) :
for (int i = 0; i < nvar; i++) {
vvar[i] = input->variable->find(vstr[i]);
if (vvar[i] < 0)
error->all(FLERR,"Variable name for copute bond/local does not exist");
error->all(FLERR,"Variable name for copute bond/local does not exist");
if (!input->variable->equalstyle(vvar[i]))
error->all(FLERR,"Variable for compute bond/local is invalid style");
error->all(FLERR,"Variable for compute bond/local is invalid style");
}
if (dstr) {
@ -168,7 +168,7 @@ void ComputeBondLocal::init()
for (int i = 0; i < nvar; i++) {
vvar[i] = input->variable->find(vstr[i]);
if (vvar[i] < 0)
error->all(FLERR,"Variable name for compute bond/local does not exist");
error->all(FLERR,"Variable name for compute bond/local does not exist");
}
if (dstr) {
@ -377,10 +377,10 @@ int ComputeBondLocal::compute_bonds(int flag)
if (nvalues == 1) ptr = &vlocal[m];
else ptr = alocal[m];
if (nvar) {
ivar = 0;
if (dstr) input->variable->internal_set(dvar,sqrt(rsq));
}
if (nvar) {
ivar = 0;
if (dstr) input->variable->internal_set(dvar,sqrt(rsq));
}
for (n = 0; n < nvalues; n++) {
switch (bstyle[n]) {
@ -408,10 +408,10 @@ int ComputeBondLocal::compute_bonds(int flag)
case VELVIB:
ptr[n] = vvib;
break;
case VARIABLE:
ptr[n] = input->variable->compute_equal(vvar[ivar]);
ivar++;
break;
case VARIABLE:
ptr[n] = input->variable->compute_equal(vvar[ivar]);
ivar++;
break;
}
}
}

View File

@ -71,7 +71,7 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) :
ids[nvalues] = NULL;
if (strncmp(arg[iarg],"c_",2) == 0 ||
strncmp(arg[iarg],"f_",2) == 0) {
strncmp(arg[iarg],"f_",2) == 0) {
if (arg[iarg][0] == 'c') which[nvalues] = COMPUTE;
else if (arg[iarg][0] == 'f') which[nvalues] = FIX;
@ -123,15 +123,15 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) :
"does not calculate per-chunk values");
if (argindex[i] == 0) {
if (!modify->compute[icompute]->vector_flag)
error->all(FLERR,"Compute chunk/spread/atom compute "
if (!modify->compute[icompute]->vector_flag)
error->all(FLERR,"Compute chunk/spread/atom compute "
"does not calculate global vector");
} else {
if (!modify->compute[icompute]->array_flag)
error->all(FLERR,"Compute chunk/spread/atom compute "
if (!modify->compute[icompute]->array_flag)
error->all(FLERR,"Compute chunk/spread/atom compute "
"does not calculate global array");
if (argindex[i] > modify->compute[icompute]->size_array_cols)
error->all(FLERR,"Compute chunk/spread/atom compute array "
if (argindex[i] > modify->compute[icompute]->size_array_cols)
error->all(FLERR,"Compute chunk/spread/atom compute array "
"is accessed out-of-range");
}
@ -140,15 +140,15 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) :
if (ifix < 0)
error->all(FLERR,"Fix ID for compute chunk/spread/atom does not exist");
if (argindex[i] == 0) {
if (!modify->fix[ifix]->vector_flag)
error->all(FLERR,"Compute chunk/spread/atom fix "
if (!modify->fix[ifix]->vector_flag)
error->all(FLERR,"Compute chunk/spread/atom fix "
"does not calculate global vector");
} else {
if (!modify->fix[ifix]->array_flag)
error->all(FLERR,"Compute chunk/spread/atom fix "
if (!modify->fix[ifix]->array_flag)
error->all(FLERR,"Compute chunk/spread/atom fix "
"does not calculate global array");
if (argindex[i] > modify->fix[ifix]->size_array_cols)
error->all(FLERR,"Compute chunk/spread/atom fix array "
if (argindex[i] > modify->fix[ifix]->size_array_cols)
error->all(FLERR,"Compute chunk/spread/atom fix array "
"is accessed out-of-range");
}
}
@ -281,14 +281,14 @@ void ComputeChunkSpreadAtom::compute_peratom()
compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR;
}
double *cvector = compute->vector;
for (i = 0; i < nlocal; i++, ptr += nstride) {
*ptr = 0.0;
if (!(mask[i] & groupbit)) continue;
index = ichunk[i]-1;
if (index < 0 || index >= nchunk) continue;
*ptr = cvector[index];
}
double *cvector = compute->vector;
for (i = 0; i < nlocal; i++, ptr += nstride) {
*ptr = 0.0;
if (!(mask[i] & groupbit)) continue;
index = ichunk[i]-1;
if (index < 0 || index >= nchunk) continue;
*ptr = cvector[index];
}
} else {
if (!(compute->invoked_flag & INVOKED_ARRAY)) {
@ -297,13 +297,13 @@ void ComputeChunkSpreadAtom::compute_peratom()
}
int icol = argindex[m]-1;
double **carray = compute->array;
for (i = 0; i < nlocal; i++, ptr += nstride) {
*ptr = 0.0;
if (!(mask[i] & groupbit)) continue;
index = ichunk[i]-1;
if (index < 0 || index >= nchunk) continue;
*ptr = carray[index][icol];
}
for (i = 0; i < nlocal; i++, ptr += nstride) {
*ptr = 0.0;
if (!(mask[i] & groupbit)) continue;
index = ichunk[i]-1;
if (index < 0 || index >= nchunk) continue;
*ptr = carray[index][icol];
}
}
// access fix data, check if fix frequency is a match

View File

@ -101,10 +101,10 @@ ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) :
for (int i = 0; i < nvar; i++) {
vvar[i] = input->variable->find(vstr[i]);
if (vvar[i] < 0)
error->all(FLERR,
error->all(FLERR,
"Variable name for copute dihedral/local does not exist");
if (!input->variable->equalstyle(vvar[i]))
error->all(FLERR,"Variable for compute dihedral/local is invalid style");
error->all(FLERR,"Variable for compute dihedral/local is invalid style");
}
if (pstr) {
@ -154,7 +154,7 @@ void ComputeDihedralLocal::init()
for (int i = 0; i < nvar; i++) {
vvar[i] = input->variable->find(vstr[i]);
if (vvar[i] < 0)
error->all(FLERR,
error->all(FLERR,
"Variable name for compute dihedral/local does not exist");
}
@ -307,19 +307,19 @@ int ComputeDihedralLocal::compute_dihedrals(int flag)
else ptr = alocal[m];
if (nvar) {
ivar = 0;
if (pstr) input->variable->internal_set(pvar,phi);
ivar = 0;
if (pstr) input->variable->internal_set(pvar,phi);
}
for (n = 0; n < nvalues; n++) {
switch (bstyle[n]) {
case PHI:
ptr[n] = 180.0*phi/MY_PI;
break;
case VARIABLE:
ptr[n] = input->variable->compute_equal(vvar[ivar]);
ivar++;
break;
switch (bstyle[n]) {
case PHI:
ptr[n] = 180.0*phi/MY_PI;
break;
case VARIABLE:
ptr[n] = input->variable->compute_equal(vvar[ivar]);
ivar++;
break;
}
}

View File

@ -141,7 +141,7 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Compute property/atom for "
"atom property that isn't allocated");
pack_choice[i] = &ComputePropertyAtom::pack_mu;
} else if (strcmp(arg[iarg],"spx") == 0) { // pack magnetic variables
} else if (strcmp(arg[iarg],"spx") == 0) { // pack magnetic variables
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for "
"atom property that isn't allocated");

View File

@ -84,7 +84,9 @@ class ComputePropertyAtom : public Compute {
void pack_radius(int);
void pack_diameter(int);
void pack_spx(int); // pack magnetic variables
// pack magnetic variables
void pack_spx(int);
void pack_spy(int);
void pack_spz(int);
void pack_sp(int);

View File

@ -443,44 +443,44 @@ class Memory : protected Pointers {
template <typename TYPE>
TYPE ****grow(TYPE ****&array, int n1, int n2, int n3, int n4,
const char *name)
const char *name)
{
if (array == NULL) return create(array, n1, n2, n3, n4, name);
if (array == NULL) return create(array, n1, n2, n3, n4, name);
bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3*n4;
TYPE *data = (TYPE *)srealloc(array[0][0][0], nbytes, name);
nbytes = ((bigint) sizeof(TYPE *)) * n1*n2*n3;
TYPE **cube = (TYPE **)srealloc(array[0][0], nbytes, name);
nbytes = ((bigint) sizeof(TYPE **)) * n1*n2;
TYPE ***plane = (TYPE ***)srealloc(array[0], nbytes, name);
nbytes = ((bigint) sizeof(TYPE ***)) * n1;
array = (TYPE ****)srealloc(array, nbytes, name);
bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3*n4;
TYPE *data = (TYPE *)srealloc(array[0][0][0], nbytes, name);
nbytes = ((bigint) sizeof(TYPE *)) * n1*n2*n3;
TYPE **cube = (TYPE **)srealloc(array[0][0], nbytes, name);
nbytes = ((bigint) sizeof(TYPE **)) * n1*n2;
TYPE ***plane = (TYPE ***)srealloc(array[0], nbytes, name);
nbytes = ((bigint) sizeof(TYPE ***)) * n1;
array = (TYPE ****)srealloc(array, nbytes, name);
int i, j, k;
bigint m1, m2;
bigint n = 0;
for (i = 0; i < n1; i++) {
m2 = ((bigint)i) * n2;
array[i] = &plane[m2];
for (j = 0; j < n2; j++) {
m1 = ((bigint)i) * n2 + j;
m2 = ((bigint)i) * n2*n3 + j*n3;
plane[m1] = &cube[m2];
for (k = 0; k < n3; k++) {
m1 = ((bigint)i) * n2*n3 + j*n3 + k;
cube[m1] = &data[n];
n += n4;
}
}
}
return array;
int i, j, k;
bigint m1, m2;
bigint n = 0;
for (i = 0; i < n1; i++) {
m2 = ((bigint)i) * n2;
array[i] = &plane[m2];
for (j = 0; j < n2; j++) {
m1 = ((bigint)i) * n2 + j;
m2 = ((bigint)i) * n2*n3 + j*n3;
plane[m1] = &cube[m2];
for (k = 0; k < n3; k++) {
m1 = ((bigint)i) * n2*n3 + j*n3 + k;
cube[m1] = &data[n];
n += n4;
}
}
}
return array;
}
template <typename TYPE>
TYPE *****grow(TYPE *****&array, int n1, int n2, int n3, int n4,
const char *name)
const char *name)
{
fail(name); return NULL;
fail(name); return NULL;
}
/* ----------------------------------------------------------------------

View File

@ -822,20 +822,20 @@ void Special::angle_trim()
int nsend = 0;
for (i = 0; i < nlocal; i++) {
for (j = 0; j < num_angle[i]; j++) {
if (tag[i] != angle_atom2[i][j]) continue;
m = atom->map(angle_atom1[i][j]);
if (m < 0 || m >= nlocal) nsend++;
m = atom->map(angle_atom3[i][j]);
if (m < 0 || m >= nlocal) nsend++;
if (tag[i] != angle_atom2[i][j]) continue;
m = atom->map(angle_atom1[i][j]);
if (m < 0 || m >= nlocal) nsend++;
m = atom->map(angle_atom3[i][j]);
if (m < 0 || m >= nlocal) nsend++;
}
for (j = 0; j < num_dihedral[i]; j++) {
if (tag[i] != dihedral_atom2[i][j]) continue;
m = atom->map(dihedral_atom1[i][j]);
if (m < 0 || m >= nlocal) nsend++;
m = atom->map(dihedral_atom3[i][j]);
if (m < 0 || m >= nlocal) nsend++;
m = atom->map(dihedral_atom4[i][j]);
if (m < 0 || m >= nlocal) nsend++;
if (tag[i] != dihedral_atom2[i][j]) continue;
m = atom->map(dihedral_atom1[i][j]);
if (m < 0 || m >= nlocal) nsend++;
m = atom->map(dihedral_atom3[i][j]);
if (m < 0 || m >= nlocal) nsend++;
m = atom->map(dihedral_atom4[i][j]);
if (m < 0 || m >= nlocal) nsend++;
}
}
@ -853,51 +853,51 @@ void Special::angle_trim()
nsend = 0;
for (i = 0; i < nlocal; i++) {
for (j = 0; j < num_angle[i]; j++) {
if (tag[i] != angle_atom2[i][j]) continue;
if (tag[i] != angle_atom2[i][j]) continue;
m = atom->map(angle_atom1[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = angle_atom1[i][j] % nprocs;
inbuf[nsend].atomID = angle_atom1[i][j];
inbuf[nsend].partnerID = angle_atom3[i][j];
nsend++;
}
m = atom->map(angle_atom1[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = angle_atom1[i][j] % nprocs;
inbuf[nsend].atomID = angle_atom1[i][j];
inbuf[nsend].partnerID = angle_atom3[i][j];
nsend++;
}
m = atom->map(angle_atom3[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = angle_atom3[i][j] % nprocs;
inbuf[nsend].atomID = angle_atom3[i][j];
inbuf[nsend].partnerID = angle_atom1[i][j];
nsend++;
}
m = atom->map(angle_atom3[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = angle_atom3[i][j] % nprocs;
inbuf[nsend].atomID = angle_atom3[i][j];
inbuf[nsend].partnerID = angle_atom1[i][j];
nsend++;
}
}
for (j = 0; j < num_dihedral[i]; j++) {
if (tag[i] != dihedral_atom2[i][j]) continue;
if (tag[i] != dihedral_atom2[i][j]) continue;
m = atom->map(dihedral_atom1[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = dihedral_atom1[i][j] % nprocs;
inbuf[nsend].atomID = dihedral_atom1[i][j];
inbuf[nsend].partnerID = dihedral_atom3[i][j];
nsend++;
}
m = atom->map(dihedral_atom1[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = dihedral_atom1[i][j] % nprocs;
inbuf[nsend].atomID = dihedral_atom1[i][j];
inbuf[nsend].partnerID = dihedral_atom3[i][j];
nsend++;
}
m = atom->map(dihedral_atom3[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = dihedral_atom3[i][j] % nprocs;
inbuf[nsend].atomID = dihedral_atom3[i][j];
inbuf[nsend].partnerID = dihedral_atom1[i][j];
nsend++;
}
m = atom->map(dihedral_atom3[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = dihedral_atom3[i][j] % nprocs;
inbuf[nsend].atomID = dihedral_atom3[i][j];
inbuf[nsend].partnerID = dihedral_atom1[i][j];
nsend++;
}
m = atom->map(dihedral_atom4[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = dihedral_atom4[i][j] % nprocs;
inbuf[nsend].atomID = dihedral_atom4[i][j];
inbuf[nsend].partnerID = dihedral_atom2[i][j];
nsend++;
}
m = atom->map(dihedral_atom4[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = dihedral_atom4[i][j] % nprocs;
inbuf[nsend].atomID = dihedral_atom4[i][j];
inbuf[nsend].partnerID = dihedral_atom2[i][j];
nsend++;
}
}
}
@ -925,7 +925,7 @@ void Special::angle_trim()
for (i = 0; i < nlocal; i++)
for (j = 0; j < nspecial[i][1]; j++)
flag[i][j] = 0;
flag[i][j] = 0;
// reset nspecial[1] and onethree for all owned atoms based on output info
// based on owned info plus rendezvous output info
@ -933,68 +933,68 @@ void Special::angle_trim()
for (i = 0; i < nlocal; i++) {
for (j = 0; j < num_angle[i]; j++) {
if (tag[i] != angle_atom2[i][j]) continue;
if (tag[i] != angle_atom2[i][j]) continue;
m = atom->map(angle_atom1[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][1]; k++)
if (onethree[m][k] == angle_atom3[i][j]) {
flag[m][k] = 1;
break;
}
}
m = atom->map(angle_atom1[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][1]; k++)
if (onethree[m][k] == angle_atom3[i][j]) {
flag[m][k] = 1;
break;
}
}
m = atom->map(angle_atom3[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][1]; k++)
if (onethree[m][k] == angle_atom1[i][j]) {
flag[m][k] = 1;
break;
}
}
m = atom->map(angle_atom3[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][1]; k++)
if (onethree[m][k] == angle_atom1[i][j]) {
flag[m][k] = 1;
break;
}
}
}
for (j = 0; j < num_dihedral[i]; j++) {
if (tag[i] != dihedral_atom2[i][j]) continue;
if (tag[i] != dihedral_atom2[i][j]) continue;
m = atom->map(dihedral_atom1[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][1]; k++)
if (onethree[m][k] == dihedral_atom3[i][j]) {
flag[m][k] = 1;
break;
}
}
m = atom->map(dihedral_atom1[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][1]; k++)
if (onethree[m][k] == dihedral_atom3[i][j]) {
flag[m][k] = 1;
break;
}
}
m = atom->map(dihedral_atom3[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][1]; k++)
if (onethree[m][k] == dihedral_atom1[i][j]) {
flag[m][k] = 1;
break;
}
}
m = atom->map(dihedral_atom3[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][1]; k++)
if (onethree[m][k] == dihedral_atom1[i][j]) {
flag[m][k] = 1;
break;
}
}
m = atom->map(dihedral_atom4[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][1]; k++)
if (onethree[m][k] == dihedral_atom2[i][j]) {
flag[m][k] = 1;
break;
}
}
m = atom->map(dihedral_atom4[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][1]; k++)
if (onethree[m][k] == dihedral_atom2[i][j]) {
flag[m][k] = 1;
break;
}
}
}
}
for (m = 0; m < nreturn; m++) {
i = atom->map(outbuf[m].atomID);
for (k = 0; k < nspecial[i][1]; k++)
if (onethree[i][k] == outbuf[m].partnerID) {
flag[i][k] = 1;
break;
}
if (onethree[i][k] == outbuf[m].partnerID) {
flag[i][k] = 1;
break;
}
}
memory->destroy(outbuf);
// use flag values to compress onefour list for each atom
@ -1002,11 +1002,11 @@ void Special::angle_trim()
for (i = 0; i < nlocal; i++) {
j = 0;
while (j < nspecial[i][1]) {
if (flag[i][j] == 0) {
onethree[i][j] = onethree[i][nspecial[i][1]-1];
flag[i][j] = flag[i][nspecial[i][1]-1];
nspecial[i][1]--;
} else j++;
if (flag[i][j] == 0) {
onethree[i][j] = onethree[i][nspecial[i][1]-1];
flag[i][j] = flag[i][nspecial[i][1]-1];
nspecial[i][1]--;
} else j++;
}
}
@ -1077,11 +1077,11 @@ void Special::dihedral_trim()
int nsend = 0;
for (i = 0; i < nlocal; i++) {
for (j = 0; j < num_dihedral[i]; j++) {
if (tag[i] != dihedral_atom2[i][j]) continue;
m = atom->map(dihedral_atom1[i][j]);
if (m < 0 || m >= nlocal) nsend++;
m = atom->map(dihedral_atom4[i][j]);
if (m < 0 || m >= nlocal) nsend++;
if (tag[i] != dihedral_atom2[i][j]) continue;
m = atom->map(dihedral_atom1[i][j]);
if (m < 0 || m >= nlocal) nsend++;
m = atom->map(dihedral_atom4[i][j]);
if (m < 0 || m >= nlocal) nsend++;
}
}
@ -1100,23 +1100,23 @@ void Special::dihedral_trim()
nsend = 0;
for (i = 0; i < nlocal; i++) {
for (j = 0; j < num_dihedral[i]; j++) {
if (tag[i] != dihedral_atom2[i][j]) continue;
if (tag[i] != dihedral_atom2[i][j]) continue;
m = atom->map(dihedral_atom1[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = dihedral_atom1[i][j] % nprocs;
inbuf[nsend].atomID = dihedral_atom1[i][j];
inbuf[nsend].partnerID = dihedral_atom4[i][j];
nsend++;
}
m = atom->map(dihedral_atom1[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = dihedral_atom1[i][j] % nprocs;
inbuf[nsend].atomID = dihedral_atom1[i][j];
inbuf[nsend].partnerID = dihedral_atom4[i][j];
nsend++;
}
m = atom->map(dihedral_atom4[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = dihedral_atom4[i][j] % nprocs;
inbuf[nsend].atomID = dihedral_atom4[i][j];
inbuf[nsend].partnerID = dihedral_atom1[i][j];
nsend++;
}
m = atom->map(dihedral_atom4[i][j]);
if (m < 0 || m >= nlocal) {
proclist[nsend] = dihedral_atom4[i][j] % nprocs;
inbuf[nsend].atomID = dihedral_atom4[i][j];
inbuf[nsend].partnerID = dihedral_atom1[i][j];
nsend++;
}
}
}
@ -1144,39 +1144,39 @@ void Special::dihedral_trim()
for (i = 0; i < nlocal; i++)
for (j = 0; j < nspecial[i][2]; j++)
flag[i][j] = 0;
flag[i][j] = 0;
for (i = 0; i < nlocal; i++) {
for (j = 0; j < num_dihedral[i]; j++) {
if (tag[i] != dihedral_atom2[i][j]) continue;
if (tag[i] != dihedral_atom2[i][j]) continue;
m = atom->map(dihedral_atom1[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][2]; k++)
if (onefour[m][k] == dihedral_atom4[i][j]) {
flag[m][k] = 1;
break;
}
}
m = atom->map(dihedral_atom1[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][2]; k++)
if (onefour[m][k] == dihedral_atom4[i][j]) {
flag[m][k] = 1;
break;
}
}
m = atom->map(dihedral_atom4[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][2]; k++)
if (onefour[m][k] == dihedral_atom1[i][j]) {
flag[m][k] = 1;
break;
}
}
m = atom->map(dihedral_atom4[i][j]);
if (m >= 0 && m < nlocal) {
for (k = 0; k < nspecial[m][2]; k++)
if (onefour[m][k] == dihedral_atom1[i][j]) {
flag[m][k] = 1;
break;
}
}
}
}
for (m = 0; m < nreturn; m++) {
i = atom->map(outbuf[m].atomID);
for (k = 0; k < nspecial[i][2]; k++)
if (onefour[i][k] == outbuf[m].partnerID) {
flag[i][k] = 1;
break;
}
if (onefour[i][k] == outbuf[m].partnerID) {
flag[i][k] = 1;
break;
}
}
memory->destroy(outbuf);
@ -1186,11 +1186,11 @@ void Special::dihedral_trim()
for (i = 0; i < nlocal; i++) {
j = 0;
while (j < nspecial[i][2]) {
if (flag[i][j] == 0) {
onefour[i][j] = onefour[i][nspecial[i][2]-1];
flag[i][j] = flag[i][nspecial[i][2]-1];
nspecial[i][2]--;
} else j++;
if (flag[i][j] == 0) {
onefour[i][j] = onefour[i][nspecial[i][2]-1];
flag[i][j] = flag[i][nspecial[i][2]-1];
nspecial[i][2]--;
} else j++;
}
}
@ -1225,8 +1225,8 @@ void Special::dihedral_trim()
------------------------------------------------------------------------- */
int Special::rendezvous_ids(int n, char *inbuf,
int &flag, int *&proclist, char *&outbuf,
void *ptr)
int &flag, int *&proclist, char *&outbuf,
void *ptr)
{
Special *sptr = (Special *) ptr;
Memory *memory = sptr->memory;
@ -1255,7 +1255,7 @@ int Special::rendezvous_ids(int n, char *inbuf,
flag = 0;
return 0;
}
/* ----------------------------------------------------------------------
process data for atoms assigned to me in rendezvous decomposition