Updated to latest LAMMPS
This commit is contained in:
@ -148,13 +148,13 @@ ComputeSNAGrid::ComputeSNAGrid(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"switchinnerflag") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute snap command");
|
||||
error->all(FLERR,"Illegal compute sna/grid command");
|
||||
switchinnerflag = atoi(arg[iarg+1]);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"sinner") == 0) {
|
||||
iarg++;
|
||||
if (iarg+ntypes > narg)
|
||||
error->all(FLERR,"Illegal compute snap command");
|
||||
error->all(FLERR,"Illegal compute sna/grid command");
|
||||
memory->create(sinnerelem,ntypes+1,"snap:sinnerelem");
|
||||
for (int i = 0; i < ntypes; i++)
|
||||
sinnerelem[i+1] = utils::numeric(FLERR,arg[iarg+i],false,lmp);
|
||||
@ -163,7 +163,7 @@ ComputeSNAGrid::ComputeSNAGrid(LAMMPS *lmp, int narg, char **arg) :
|
||||
} else if (strcmp(arg[iarg],"dinner") == 0) {
|
||||
iarg++;
|
||||
if (iarg+ntypes > narg)
|
||||
error->all(FLERR,"Illegal compute snap command");
|
||||
error->all(FLERR,"Illegal compute sna/grid command");
|
||||
memory->create(dinnerelem,ntypes+1,"snap:dinnerelem");
|
||||
for (int i = 0; i < ntypes; i++)
|
||||
dinnerelem[i+1] = utils::numeric(FLERR,arg[iarg+i],false,lmp);
|
||||
@ -201,20 +201,20 @@ ComputeSNAGrid::~ComputeSNAGrid()
|
||||
|
||||
void ComputeSNAGrid::init()
|
||||
{
|
||||
if (force->pair == nullptr)
|
||||
error->all(FLERR,"Compute sna/grid requires a pair style be defined");
|
||||
// if (force->pair == nullptr)
|
||||
// error->all(FLERR,"Compute sna/grid requires a pair style be defined");
|
||||
|
||||
if (cutmax > force->pair->cutforce)
|
||||
error->all(FLERR,"Compute sna/grid cutoff is longer than pairwise cutoff");
|
||||
// if (cutmax > force->pair->cutforce)
|
||||
// error->all(FLERR,"Compute sna/grid cutoff is longer than pairwise cutoff");
|
||||
|
||||
// need an occasional full neighbor list
|
||||
// // need an occasional full neighbor list
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->pair = 0;
|
||||
neighbor->requests[irequest]->compute = 1;
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->requests[irequest]->occasional = 1;
|
||||
// int irequest = neighbor->request(this,instance_me);
|
||||
// neighbor->requests[irequest]->pair = 0;
|
||||
// neighbor->requests[irequest]->compute = 1;
|
||||
// neighbor->requests[irequest]->half = 0;
|
||||
// neighbor->requests[irequest]->full = 1;
|
||||
// neighbor->requests[irequest]->occasional = 1;
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++)
|
||||
@ -282,7 +282,8 @@ void ComputeSNAGrid::compute_array()
|
||||
int jtype = type[j];
|
||||
int jelem = 0;
|
||||
if (chemflag)
|
||||
jelem = map[jtype];
|
||||
jelem = map[jtype];
|
||||
|
||||
if (rsq < cutsq[jtype][jtype] && rsq > 1e-20) {
|
||||
snaptr->rij[ninside][0] = delx;
|
||||
snaptr->rij[ninside][1] = dely;
|
||||
@ -290,7 +291,11 @@ void ComputeSNAGrid::compute_array()
|
||||
snaptr->inside[ninside] = j;
|
||||
snaptr->wj[ninside] = wjelem[jtype];
|
||||
snaptr->rcutij[ninside] = 2.0*radelem[jtype]*rcutfac;
|
||||
snaptr->element[ninside] = jelem; // element index for multi-element snap
|
||||
if (switchinnerflag) {
|
||||
snaptr->sinnerij[ninside] = sinnerelem[jelem];
|
||||
snaptr->dinnerij[ninside] = dinnerelem[jelem];
|
||||
}
|
||||
if (chemflag) snaptr->element[ninside] = jelem;
|
||||
ninside++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,13 +148,13 @@ ComputeSNAGridLocal::ComputeSNAGridLocal(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"switchinnerflag") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute snap command");
|
||||
error->all(FLERR,"Illegal compute sna/grid/local command");
|
||||
switchinnerflag = atoi(arg[iarg+1]);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"sinner") == 0) {
|
||||
iarg++;
|
||||
if (iarg+ntypes > narg)
|
||||
error->all(FLERR,"Illegal compute snap command");
|
||||
error->all(FLERR,"Illegal compute sna/grid/local command");
|
||||
memory->create(sinnerelem,ntypes+1,"snap:sinnerelem");
|
||||
for (int i = 0; i < ntypes; i++)
|
||||
sinnerelem[i+1] = utils::numeric(FLERR,arg[iarg+i],false,lmp);
|
||||
@ -163,7 +163,7 @@ ComputeSNAGridLocal::ComputeSNAGridLocal(LAMMPS *lmp, int narg, char **arg) :
|
||||
} else if (strcmp(arg[iarg],"dinner") == 0) {
|
||||
iarg++;
|
||||
if (iarg+ntypes > narg)
|
||||
error->all(FLERR,"Illegal compute snap command");
|
||||
error->all(FLERR,"Illegal compute sna/grid/local command");
|
||||
memory->create(dinnerelem,ntypes+1,"snap:dinnerelem");
|
||||
for (int i = 0; i < ntypes; i++)
|
||||
dinnerelem[i+1] = utils::numeric(FLERR,arg[iarg+i],false,lmp);
|
||||
@ -200,20 +200,20 @@ ComputeSNAGridLocal::~ComputeSNAGridLocal()
|
||||
|
||||
void ComputeSNAGridLocal::init()
|
||||
{
|
||||
if (force->pair == nullptr)
|
||||
error->all(FLERR,"Compute sna/grid/local requires a pair style be defined");
|
||||
// if (force->pair == nullptr)
|
||||
// error->all(FLERR,"Compute sna/grid/local requires a pair style be defined");
|
||||
|
||||
if (cutmax > force->pair->cutforce)
|
||||
error->all(FLERR,"Compute sna/grid/local cutoff is longer than pairwise cutoff");
|
||||
// if (cutmax > force->pair->cutforce)
|
||||
// error->all(FLERR,"Compute sna/grid/local cutoff is longer than pairwise cutoff");
|
||||
|
||||
// need an occasional full neighbor list
|
||||
// // need an occasional full neighbor list
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->pair = 0;
|
||||
neighbor->requests[irequest]->compute = 1;
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->requests[irequest]->occasional = 1;
|
||||
// int irequest = neighbor->request(this,instance_me);
|
||||
// neighbor->requests[irequest]->pair = 0;
|
||||
// neighbor->requests[irequest]->compute = 1;
|
||||
// neighbor->requests[irequest]->half = 0;
|
||||
// neighbor->requests[irequest]->full = 1;
|
||||
// neighbor->requests[irequest]->occasional = 1;
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++)
|
||||
@ -234,6 +234,7 @@ void ComputeSNAGridLocal::init_list(int /*id*/, NeighList *ptr)
|
||||
|
||||
void ComputeSNAGridLocal::compute_local()
|
||||
{
|
||||
printf("Entering compute_local()\n");
|
||||
invoked_array = update->ntimestep;
|
||||
|
||||
// compute sna for each gridpoint
|
||||
@ -290,7 +291,11 @@ void ComputeSNAGridLocal::compute_local()
|
||||
snaptr->inside[ninside] = j;
|
||||
snaptr->wj[ninside] = wjelem[jtype];
|
||||
snaptr->rcutij[ninside] = 2.0*radelem[jtype]*rcutfac;
|
||||
snaptr->element[ninside] = jelem; // element index for multi-element snap
|
||||
if (switchinnerflag) {
|
||||
snaptr->sinnerij[ninside] = sinnerelem[jelem];
|
||||
snaptr->dinnerij[ninside] = dinnerelem[jelem];
|
||||
}
|
||||
if (chemflag) snaptr->element[ninside] = jelem; // element index for multi-element snap
|
||||
ninside++;
|
||||
}
|
||||
}
|
||||
@ -323,6 +328,7 @@ void ComputeSNAGridLocal::compute_local()
|
||||
// copy 4d array to 2d array
|
||||
|
||||
copy_gridlocal_to_local_array();
|
||||
printf("Exiting compute_local()\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -59,15 +59,16 @@ void PairSNAGrid::init_style()
|
||||
if (force->newton_pair == 0)
|
||||
error->all(FLERR,"Pair style sna/grid requires newton pair on");
|
||||
|
||||
// need a full neighbor list
|
||||
// // need a full neighbor list
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
// int irequest = neighbor->request(this,instance_me);
|
||||
// neighbor->requests[irequest]->half = 0;
|
||||
// neighbor->requests[irequest]->full = 1;
|
||||
|
||||
snaptr = new SNA(lmp, rfac0, twojmax,
|
||||
rmin0, switchflag, bzeroflag,
|
||||
chemflag, bnormflag, wselfallflag, nelements);
|
||||
chemflag, bnormflag, wselfallflag,
|
||||
nelements, switchinnerflag);
|
||||
ncoeff = snaptr->ncoeff;
|
||||
ndesc = ndesc_base + ncoeff;
|
||||
snaptr->init();
|
||||
@ -213,8 +214,8 @@ void PairSNAGrid::compute(int eflag, int vflag)
|
||||
const double rsq = delx*delx + dely*dely + delz*delz;
|
||||
int jtype = type[j];
|
||||
int jelem = 0;
|
||||
if (chemflag)
|
||||
jelem = map[jtype];
|
||||
jelem = map[jtype];
|
||||
|
||||
if (rsq < cutsq[jtype][jtype] && rsq > 1e-20) {
|
||||
snaptr->rij[ninside][0] = delx;
|
||||
snaptr->rij[ninside][1] = dely;
|
||||
@ -222,7 +223,11 @@ void PairSNAGrid::compute(int eflag, int vflag)
|
||||
snaptr->inside[ninside] = j;
|
||||
snaptr->wj[ninside] = wjelem[jtype];
|
||||
snaptr->rcutij[ninside] = 2.0*radelem[jtype]*rcutfac;
|
||||
snaptr->element[ninside] = jelem; // element index for multi-element snap
|
||||
if (switchinnerflag) {
|
||||
snaptr->sinnerij[ninside] = 0.5*(sinnerelem[ielem]+sinnerelem[jelem]);
|
||||
snaptr->dinnerij[ninside] = 0.5*(dinnerelem[ielem]+dinnerelem[jelem]);
|
||||
}
|
||||
if (chemflag) snaptr->element[ninside] = jelem;
|
||||
ninside++;
|
||||
}
|
||||
}
|
||||
@ -243,12 +248,7 @@ void PairSNAGrid::compute(int eflag, int vflag)
|
||||
|
||||
for (int jj = 0; jj < ninside; jj++) {
|
||||
int j = snaptr->inside[jj];
|
||||
if (chemflag)
|
||||
snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj],
|
||||
snaptr->rcutij[jj],jj, snaptr->element[jj]);
|
||||
else
|
||||
snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj],
|
||||
snaptr->rcutij[jj],jj, 0);
|
||||
snaptr->compute_duidrj(jj);
|
||||
|
||||
snaptr->compute_deidrj(fij);
|
||||
|
||||
@ -326,6 +326,7 @@ void PairSNAGrid::settings(int narg, char ** arg)
|
||||
chemflag = 0;
|
||||
bnormflag = 0;
|
||||
wselfallflag = 0;
|
||||
switchinnerflag = 0;
|
||||
nelements = 1;
|
||||
|
||||
// process required arguments
|
||||
@ -357,6 +358,11 @@ void PairSNAGrid::settings(int narg, char ** arg)
|
||||
}
|
||||
}
|
||||
|
||||
// set local input checks
|
||||
|
||||
int sinnerflag = 0;
|
||||
int dinnerflag = 0;
|
||||
|
||||
// process optional args
|
||||
|
||||
int iarg = nargmin;
|
||||
@ -405,6 +411,29 @@ void PairSNAGrid::settings(int narg, char ** arg)
|
||||
error->all(FLERR,"Illegal pair sna/grid command");
|
||||
wselfallflag = atoi(arg[iarg+1]);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"switchinnerflag") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal pair sna/grid command");
|
||||
switchinnerflag = atoi(arg[iarg+1]);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"sinner") == 0) {
|
||||
iarg++;
|
||||
if (iarg+ntypes > narg)
|
||||
error->all(FLERR,"Illegal pair sna/grid command");
|
||||
memory->create(sinnerelem,ntypes+1,"snap:sinnerelem");
|
||||
for (int i = 0; i < ntypes; i++)
|
||||
sinnerelem[i+1] = utils::numeric(FLERR,arg[iarg+i],false,lmp);
|
||||
sinnerflag = 1;
|
||||
iarg += ntypes;
|
||||
} else if (strcmp(arg[iarg],"dinner") == 0) {
|
||||
iarg++;
|
||||
if (iarg+ntypes > narg)
|
||||
error->all(FLERR,"Illegal pair sna/grid command");
|
||||
memory->create(dinnerelem,ntypes+1,"snap:dinnerelem");
|
||||
for (int i = 0; i < ntypes; i++)
|
||||
dinnerelem[i+1] = utils::numeric(FLERR,arg[iarg+i],false,lmp);
|
||||
dinnerflag = 1;
|
||||
iarg += ntypes;
|
||||
} else error->all(FLERR,"Illegal pair sna/grid command");
|
||||
|
||||
}
|
||||
|
||||
@ -45,6 +45,9 @@ class PairSNAGrid : public PairGrid {
|
||||
int quadraticflag;
|
||||
int twojmax, switchflag, bzeroflag, bnormflag;
|
||||
int chemflag, wselfallflag;
|
||||
int switchinnerflag;
|
||||
double *sinnerelem;
|
||||
double *dinnerelem;
|
||||
double rfac0, rmin0;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user