git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14270 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -73,10 +73,22 @@ PairSRP::PairSRP(LAMMPS *lmp) : Pair(lmp)
|
||||
|
||||
nextra = 1;
|
||||
segment = NULL;
|
||||
|
||||
// generate unique fix-id for this pair style instance
|
||||
fix_id = strdup("XX_FIX_SRP");
|
||||
fix_id[0] = '0' + srp_instance / 10;
|
||||
fix_id[1] = '0' + srp_instance % 10;
|
||||
++srp_instance;
|
||||
|
||||
// create fix SRP instance here, as it has to
|
||||
// be executed before all other fixes
|
||||
char **fixarg = new char*[3];
|
||||
fixarg[0] = fix_id;
|
||||
fixarg[1] = (char *) "all";
|
||||
fixarg[2] = (char *) "SRP";
|
||||
modify->add_fix(3,fixarg);
|
||||
f_srp = (FixSRP *) modify->fix[modify->nfix-1];
|
||||
delete [] fixarg;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -436,16 +448,10 @@ void PairSRP::init_style()
|
||||
if (!force->newton_pair)
|
||||
error->all(FLERR,"PairSRP: Pair srp requires newton pair on");
|
||||
|
||||
// need fix srp
|
||||
// invoke here instead of constructor
|
||||
// to make restart possible
|
||||
char **fixarg = new char*[3];
|
||||
fixarg[0] = fix_id;
|
||||
fixarg[1] = (char *) "all";
|
||||
fixarg[2] = (char *) "SRP";
|
||||
modify->add_fix(3,fixarg);
|
||||
f_srp = (FixSRP *) modify->fix[modify->nfix-1];
|
||||
delete [] fixarg;
|
||||
// verify that fix SRP is still defined and has not been changed.
|
||||
int ifix = modify->find_fix(fix_id);
|
||||
if (f_srp != (FixSRP *)modify->fix[ifix])
|
||||
error->all(FLERR,"Fix SRP has been changed unexpectedly");
|
||||
|
||||
// set bond type in fix srp
|
||||
// bonds of this type will be represented by bond particles
|
||||
|
||||
@ -435,8 +435,7 @@ void lammps_gather_atoms(void *ptr, char *name,
|
||||
if (count == 1) vector = (int *) vptr;
|
||||
else array = (int **) vptr;
|
||||
|
||||
int *copy;
|
||||
lmp->memory->create(copy,count*natoms,"lib/gather:copy");
|
||||
int *copy = (int*) data;
|
||||
for (i = 0; i < count*natoms; i++) copy[i] = 0;
|
||||
|
||||
tagint *tag = lmp->atom->tag;
|
||||
@ -452,8 +451,7 @@ void lammps_gather_atoms(void *ptr, char *name,
|
||||
copy[offset++] = array[i][0];
|
||||
}
|
||||
|
||||
MPI_Allreduce(copy,data,count*natoms,MPI_INT,MPI_SUM,lmp->world);
|
||||
lmp->memory->destroy(copy);
|
||||
MPI_Allreduce(MPI_IN_PLACE,data,count*natoms,MPI_INT,MPI_SUM,lmp->world);
|
||||
|
||||
} else {
|
||||
double *vector = NULL;
|
||||
@ -461,8 +459,7 @@ void lammps_gather_atoms(void *ptr, char *name,
|
||||
if (count == 1) vector = (double *) vptr;
|
||||
else array = (double **) vptr;
|
||||
|
||||
double *copy;
|
||||
lmp->memory->create(copy,count*natoms,"lib/gather:copy");
|
||||
double *copy = (double*) data;
|
||||
for (i = 0; i < count*natoms; i++) copy[i] = 0.0;
|
||||
|
||||
tagint *tag = lmp->atom->tag;
|
||||
@ -479,8 +476,7 @@ void lammps_gather_atoms(void *ptr, char *name,
|
||||
}
|
||||
}
|
||||
|
||||
MPI_Allreduce(copy,data,count*natoms,MPI_DOUBLE,MPI_SUM,lmp->world);
|
||||
lmp->memory->destroy(copy);
|
||||
MPI_Allreduce(MPI_IN_PLACE,data,count*natoms,MPI_DOUBLE,MPI_SUM,lmp->world);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user