new SNAP potential for W

This commit is contained in:
Steve Plimpton
2017-02-21 15:49:21 -07:00
parent cb982f2f28
commit 1cd4c48ccc
98 changed files with 13326 additions and 1081 deletions

View File

@ -18,6 +18,7 @@
#include <mpi.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "compute_rdf.h"
#include "atom.h"
#include "update.h"
@ -51,8 +52,32 @@ ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) :
nbin = force->inumeric(FLERR,arg[3]);
if (nbin < 1) error->all(FLERR,"Illegal compute rdf command");
if (narg == 4) npairs = 1;
else npairs = (narg-4)/2;
// optional args
// nargpair = # of pairwise args, starting at iarg = 4
cutflag = 0;
int iarg;
for (iarg = 4; iarg < narg; iarg++)
if (strcmp(arg[iarg],"cutoff") == 0) break;
int nargpair = iarg - 4;
while (iarg < narg) {
if (strcmp(arg[iarg],"cutoff") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal compute rdf command");
cutoff_user = force->numeric(FLERR,arg[iarg+1]);
if (cutoff_user <= 0.0) cutflag = 0;
else cutflag = 1;
iarg += 2;
} else error->all(FLERR,"Illegal compute rdf command");
}
// pairwise args
if (nargpair == 0) npairs = 1;
else npairs = nargpair/2;
size_array_rows = nbin;
size_array_cols = 1 + 2*npairs;
@ -65,15 +90,15 @@ ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) :
jlo = new int[npairs];
jhi = new int[npairs];
if (narg == 4) {
if (nargpair == 0) {
ilo[0] = 1; ihi[0] = ntypes;
jlo[0] = 1; jhi[0] = ntypes;
npairs = 1;
} else {
npairs = 0;
int iarg = 4;
while (iarg < narg) {
iarg = 4;
while (iarg < 4+nargpair) {
force->bounds(FLERR,arg[iarg],atom->ntypes,ilo[npairs],ihi[npairs]);
force->bounds(FLERR,arg[iarg+1],atom->ntypes,jlo[npairs],jhi[npairs]);
if (ilo[npairs] > ihi[npairs] || jlo[npairs] > jhi[npairs])
@ -127,8 +152,31 @@ void ComputeRDF::init()
{
int i,j,m;
if (force->pair) delr = force->pair->cutforce / nbin;
else error->all(FLERR,"Compute rdf requires a pair style be defined");
if (!force->pair && !cutflag)
error->all(FLERR,"Compute rdf requires a pair style be defined "
"or cutoff specified");
if (cutflag) {
double skin = neighbor->skin;
mycutneigh = cutoff_user + skin;
double cutghost; // as computed by Neighbor and Comm
if (force->pair)
cutghost = MAX(force->pair->cutforce+skin,comm->cutghostuser);
else
cutghost = comm->cutghostuser;
if (mycutneigh > cutghost)
error->all(FLERR,"Compure rdf cutoff exceeds ghost atom range - "
"use comm_modify cutoff command");
if (force->pair && mycutneigh < force->pair->cutforce + skin)
if (comm->me == 0)
error->warning(FLERR,"Compute rdf cutoff less than neighbor cutoff - "
"forcing a needless neighbor list build");
delr = cutoff_user / nbin;
} else delr = force->pair->cutforce / nbin;
delrinv = 1.0/delr;
// set 1st column of output array to bin coords
@ -172,11 +220,21 @@ void ComputeRDF::init()
delete [] scratch;
// need an occasional half neighbor list
// if user specified, request a cutoff = cutoff_user + skin
// skin is included b/c Neighbor uses this value similar
// to its cutneighmax = force cutoff + skin
// also, this NeighList may be used by this compute for multiple steps
// (until next reneighbor), so it needs to contain atoms further
// than cutoff_user apart, just like a normal neighbor list does
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->pair = 0;
neighbor->requests[irequest]->compute = 1;
neighbor->requests[irequest]->occasional = 1;
if (cutflag) {
neighbor->requests[irequest]->cut = 1;
neighbor->requests[irequest]->cutoff = mycutneigh;
}
}
/* ---------------------------------------------------------------------- */