modernize
This commit is contained in:
@ -46,7 +46,7 @@ ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
hist(nullptr), histall(nullptr), typecount(nullptr), icount(nullptr), jcount(nullptr),
|
hist(nullptr), histall(nullptr), typecount(nullptr), icount(nullptr), jcount(nullptr),
|
||||||
duplicates(nullptr)
|
duplicates(nullptr)
|
||||||
{
|
{
|
||||||
if (narg < 4) error->all(FLERR,"Illegal compute rdf command");
|
if (narg < 4) utils::missing_cmd_args(FLERR,"compute rdf", error);
|
||||||
|
|
||||||
array_flag = 1;
|
array_flag = 1;
|
||||||
extarray = 0;
|
extarray = 0;
|
||||||
@ -67,14 +67,14 @@ ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg],"cutoff") == 0) {
|
if (strcmp(arg[iarg],"cutoff") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute rdf command");
|
if (iarg+2 > narg) utils::missing_cmd_args(FLERR,"compute rdf cutoff", error);
|
||||||
if ((neighbor->style == Neighbor::MULTI) || (neighbor->style == Neighbor::MULTI_OLD))
|
if ((neighbor->style == Neighbor::MULTI) || (neighbor->style == Neighbor::MULTI_OLD))
|
||||||
error->all(FLERR, "Compute rdf with custom cutoff requires neighbor style 'bin' or 'nsq'");
|
error->all(FLERR, "Compute rdf with custom cutoff requires neighbor style 'bin' or 'nsq'");
|
||||||
cutoff_user = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
cutoff_user = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||||
if (cutoff_user <= 0.0) cutflag = 0;
|
if (cutoff_user <= 0.0) cutflag = 0;
|
||||||
else cutflag = 1;
|
else cutflag = 1;
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else error->all(FLERR,"Illegal compute rdf command");
|
} else error->all(FLERR,"Unknown compute rdf keyword {}", arg[iarg]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pairwise args
|
// pairwise args
|
||||||
@ -141,17 +141,17 @@ ComputeRDF::~ComputeRDF()
|
|||||||
{
|
{
|
||||||
memory->destroy(rdfpair);
|
memory->destroy(rdfpair);
|
||||||
memory->destroy(nrdfpair);
|
memory->destroy(nrdfpair);
|
||||||
delete [] ilo;
|
delete[] ilo;
|
||||||
delete [] ihi;
|
delete[] ihi;
|
||||||
delete [] jlo;
|
delete[] jlo;
|
||||||
delete [] jhi;
|
delete[] jhi;
|
||||||
memory->destroy(hist);
|
memory->destroy(hist);
|
||||||
memory->destroy(histall);
|
memory->destroy(histall);
|
||||||
memory->destroy(array);
|
memory->destroy(array);
|
||||||
delete [] typecount;
|
delete[] typecount;
|
||||||
delete [] icount;
|
delete[] icount;
|
||||||
delete [] jcount;
|
delete[] jcount;
|
||||||
delete [] duplicates;
|
delete[] duplicates;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -160,8 +160,7 @@ void ComputeRDF::init()
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (!force->pair && !cutflag)
|
if (!force->pair && !cutflag)
|
||||||
error->all(FLERR,"Compute rdf requires a pair style be defined "
|
error->all(FLERR,"Compute rdf requires a pair style or an explicit cutoff");
|
||||||
"or cutoff specified");
|
|
||||||
|
|
||||||
if (cutflag) {
|
if (cutflag) {
|
||||||
double skin = neighbor->skin;
|
double skin = neighbor->skin;
|
||||||
@ -256,7 +255,7 @@ void ComputeRDF::init_norm()
|
|||||||
for (i = 0; i < npairs; i++) jcount[i] = scratch[i];
|
for (i = 0; i < npairs; i++) jcount[i] = scratch[i];
|
||||||
MPI_Allreduce(duplicates,scratch,npairs,MPI_INT,MPI_SUM,world);
|
MPI_Allreduce(duplicates,scratch,npairs,MPI_INT,MPI_SUM,world);
|
||||||
for (i = 0; i < npairs; i++) duplicates[i] = scratch[i];
|
for (i = 0; i < npairs; i++) duplicates[i] = scratch[i];
|
||||||
delete [] scratch;
|
delete[] scratch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
Reference in New Issue
Block a user