git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8074 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2012-05-17 21:06:43 +00:00
parent 3244bcbb98
commit 967a143e7e
4 changed files with 51 additions and 10 deletions

View File

@ -285,6 +285,7 @@ int MPI_Allreduce(void *sendbuf, void *recvbuf, int count,
else if (datatype == MPI_LONG_LONG) n = count*sizeof(uint64_t);
else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int);
if (sendbuf == MPI_IN_PLACE || recvbuf == MPI_IN_PLACE) return;
memcpy(recvbuf,sendbuf,n);
return 0;
}
@ -306,6 +307,7 @@ int MPI_Reduce(void *sendbuf, void *recvbuf, int count,
else if (datatype == MPI_LONG_LONG) n = count*sizeof(uint64_t);
else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int);
if (sendbuf == MPI_IN_PLACE || recvbuf == MPI_IN_PLACE) return;
memcpy(recvbuf,sendbuf,n);
return 0;
}
@ -325,6 +327,7 @@ int MPI_Scan(void *sendbuf, void *recvbuf, int count,
else if (datatype == MPI_LONG_LONG) n = count*sizeof(uint64_t);
else if (datatype == MPI_DOUBLE_INT) n = count*sizeof(double_int);
if (sendbuf == MPI_IN_PLACE || recvbuf == MPI_IN_PLACE) return;
memcpy(recvbuf,sendbuf,n);
return 0;
}
@ -346,6 +349,7 @@ int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
else if (sendtype == MPI_LONG_LONG) n = sendcount*sizeof(uint64_t);
else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int);
if (sendbuf == MPI_IN_PLACE || recvbuf == MPI_IN_PLACE) return;
memcpy(recvbuf,sendbuf,n);
return 0;
}
@ -367,6 +371,7 @@ int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
else if (sendtype == MPI_LONG_LONG) n = sendcount*sizeof(uint64_t);
else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int);
if (sendbuf == MPI_IN_PLACE || recvbuf == MPI_IN_PLACE) return;
memcpy(recvbuf,sendbuf,n);
return 0;
}
@ -387,6 +392,7 @@ int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
else if (datatype == MPI_LONG_LONG) n = *recvcounts*sizeof(uint64_t);
else if (datatype == MPI_DOUBLE_INT) n = *recvcounts*sizeof(double_int);
if (sendbuf == MPI_IN_PLACE || recvbuf == MPI_IN_PLACE) return;
memcpy(recvbuf,sendbuf,n);
return 0;
}
@ -408,6 +414,7 @@ int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
else if (sendtype == MPI_LONG_LONG) n = sendcount*sizeof(uint64_t);
else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int);
if (sendbuf == MPI_IN_PLACE || recvbuf == MPI_IN_PLACE) return;
memcpy(recvbuf,sendbuf,n);
return 0;
}
@ -429,6 +436,7 @@ int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
else if (sendtype == MPI_LONG_LONG) n = sendcount*sizeof(uint64_t);
else if (sendtype == MPI_DOUBLE_INT) n = sendcount*sizeof(double_int);
if (sendbuf == MPI_IN_PLACE || recvbuf == MPI_IN_PLACE) return;
memcpy(recvbuf,sendbuf,n);
return 0;
}
@ -450,6 +458,7 @@ int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
else if (sendtype == MPI_LONG_LONG) n = recvcount*sizeof(uint64_t);
else if (sendtype == MPI_DOUBLE_INT) n = recvcount*sizeof(double_int);
if (sendbuf == MPI_IN_PLACE || recvbuf == MPI_IN_PLACE) return;
memcpy(recvbuf,sendbuf,n);
return 0;
}

View File

@ -14,6 +14,8 @@
#ifndef MPI_STUBS
#define MPI_STUBS
#include "stdlib.h"
/* use C bindings for MPI interface */
#ifdef __cplusplus
@ -48,6 +50,8 @@ extern "C" {
#define MPI_Datatype int
#define MPI_Op int
#define MPI_IN_PLACE NULL
#define MPI_MAX_PROCESSOR_NAME 128
/* MPI data structs */

View File

@ -22,6 +22,7 @@
#include "math_extra.h"
#include "atom.h"
#include "force.h"
#include "group.h"
#include "comm.h"
#include "irregular.h"
#include "modify.h"
@ -65,6 +66,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
pcouple = NONE;
drag = 0.0;
allremap = 1;
id_dilate = NULL;
mtchain = mpchain = 3;
nc_tchain = nc_pchain = 1;
mtk_flag = 1;
@ -91,7 +93,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
fixedpoint[1] = 0.5*(domain->boxlo[1]+domain->boxhi[1]);
fixedpoint[2] = 0.5*(domain->boxlo[2]+domain->boxhi[2]);
// Used by FixNVTSllod to preserve non-default value
// used by FixNVTSllod to preserve non-default value
mtchain_default_flag = 1;
@ -242,9 +244,18 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
} else if (strcmp(arg[iarg],"dilate") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command");
if (strcmp(arg[iarg+1],"all") == 0) allremap = 1;
else if (strcmp(arg[iarg+1],"partial") == 0) allremap = 0;
else error->all(FLERR,"Illegal fix nvt/npt/nph command");
else {
allremap = 0;
delete [] id_dilate;
int n = strlen(arg[iarg+2]) + 1;
id_dilate = new char[n];
strcpy(id_dilate,arg[iarg+2]);
int idilate = group->find(id_dilate);
if (idilate == -1)
error->all(FLERR,"Fix nvt/npt/nph dilate group ID does not exist");
}
iarg += 2;
} else if (strcmp(arg[iarg],"tchain") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command");
mtchain = atoi(arg[iarg+1]);
@ -508,6 +519,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
FixNH::~FixNH()
{
delete [] id_dilate;
delete [] rfix;
delete irregular;
@ -554,6 +566,15 @@ int FixNH::setmask()
void FixNH::init()
{
// recheck that group_dilate has not been deleted
if (allremap == 0) {
int idilate = group->find(id_dilate);
if (idilate == -1)
error->all(FLERR,"Fix nvt/npt/nph dilate group ID does not exist");
dilate_group_bit = group->bitmask[idilate];
}
// ensure no conflict with fix deform
if (pstat_flag)
@ -975,7 +996,7 @@ void FixNH::remap()
if (allremap) domain->x2lamda(nlocal);
else {
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
if (mask[i] & dilate_group_bit)
domain->x2lamda(x[i],x[i]);
}
@ -1105,9 +1126,12 @@ void FixNH::remap()
// tilt factor to cell length ratio can not exceed TILTMAX in one step
if (domain->yz < -TILTMAX*domain->yprd || domain->yz > TILTMAX*domain->yprd ||
domain->xz < -TILTMAX*domain->xprd || domain->xz > TILTMAX*domain->xprd ||
domain->xy < -TILTMAX*domain->xprd || domain->xy > TILTMAX*domain->xprd)
if (domain->yz < -TILTMAX*domain->yprd ||
domain->yz > TILTMAX*domain->yprd ||
domain->xz < -TILTMAX*domain->xprd ||
domain->xz > TILTMAX*domain->xprd ||
domain->xy < -TILTMAX*domain->xprd ||
domain->xy > TILTMAX*domain->xprd)
error->all(FLERR,"Fix npt/nph has tilted box too far in one step - "
"periodic cell is too far from equilibrium state");
@ -1119,7 +1143,7 @@ void FixNH::remap()
if (allremap) domain->lamda2x(nlocal);
else {
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
if (mask[i] & dilate_group_bit)
domain->lamda2x(x[i],x[i]);
}
@ -1290,11 +1314,13 @@ int FixNH::modify_param(int narg, char **arg)
strcpy(id_temp,arg[1]);
int icompute = modify->find_compute(arg[1]);
if (icompute < 0) error->all(FLERR,"Could not find fix_modify temperature ID");
if (icompute < 0)
error->all(FLERR,"Could not find fix_modify temperature ID");
temperature = modify->compute[icompute];
if (temperature->tempflag == 0)
error->all(FLERR,"Fix_modify temperature ID does not compute temperature");
error->all(FLERR,
"Fix_modify temperature ID does not compute temperature");
if (temperature->igroup != 0 && comm->me == 0)
error->warning(FLERR,"Temperature for fix modify is not for group all");

View File

@ -64,7 +64,9 @@ class FixNH : public Fix {
double pdrag_factor; // drag factor on barostat
int kspace_flag; // 1 if KSpace invoked, 0 if not
int nrigid; // number of rigid fixes
int dilate_group_bit; // mask for dilation group
int *rfix; // indices of rigid fixes
char *id_dilate; // group name to dilate
class Irregular *irregular; // for migrating atoms after box flips
int nlevels_respa;