Eliminated a few mistakes,s till not working
This commit is contained in:
@ -56,6 +56,6 @@ pair_style sna/grid grid ${ngrid} ${ngrid} ${ngrid} &
|
|||||||
${rcutfac} ${rfac0} ${twojmax} ${radelem} &
|
${rcutfac} ${rfac0} ${twojmax} ${radelem} &
|
||||||
${wj} rmin0 ${rmin0} bzeroflag ${bzero} &
|
${wj} rmin0 ${rmin0} bzeroflag ${bzero} &
|
||||||
quadraticflag ${quad} switchflag ${switch}
|
quadraticflag ${quad} switchflag ${switch}
|
||||||
pair_coeff * *
|
pair_coeff * * Al
|
||||||
|
|
||||||
run 0
|
run 0
|
||||||
|
|||||||
@ -53,14 +53,11 @@ PairSNAGrid::~PairSNAGrid()
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PairSNAGrid::init()
|
void PairSNAGrid::init_style()
|
||||||
{
|
{
|
||||||
if (force->pair == nullptr)
|
if (force->pair == nullptr)
|
||||||
error->all(FLERR,"Pair sna/grid requires a pair style be defined");
|
error->all(FLERR,"Pair sna/grid requires a pair style be defined");
|
||||||
|
|
||||||
if (cutmax > force->pair->cutforce)
|
|
||||||
error->all(FLERR,"Pair 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);
|
int irequest = neighbor->request(this,instance_me);
|
||||||
@ -70,7 +67,13 @@ void PairSNAGrid::init()
|
|||||||
neighbor->requests[irequest]->full = 1;
|
neighbor->requests[irequest]->full = 1;
|
||||||
neighbor->requests[irequest]->occasional = 1;
|
neighbor->requests[irequest]->occasional = 1;
|
||||||
|
|
||||||
|
snaptr = new SNA(lmp, rfac0, twojmax,
|
||||||
|
rmin0, switchflag, bzeroflag,
|
||||||
|
chemflag, bnormflag, wselfallflag, nelements);
|
||||||
|
ndesc = ndesc_base + snaptr->ncoeff;
|
||||||
|
printf("ndesc = %d\n", ndesc);
|
||||||
snaptr->init();
|
snaptr->init();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -173,8 +176,6 @@ void PairSNAGrid::compute(int eflag, int vflag)
|
|||||||
|
|
||||||
void PairSNAGrid::settings(int narg, char ** arg)
|
void PairSNAGrid::settings(int narg, char ** arg)
|
||||||
{
|
{
|
||||||
double rfac0, rmin0;
|
|
||||||
int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag;
|
|
||||||
|
|
||||||
// call base class first
|
// call base class first
|
||||||
|
|
||||||
@ -232,6 +233,8 @@ void PairSNAGrid::settings(int narg, char ** arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("settings cutmax = %g \n",cutmax);
|
||||||
|
|
||||||
// process optional args
|
// process optional args
|
||||||
|
|
||||||
int iarg = nargmin;
|
int iarg = nargmin;
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class PairSNAGrid : public PairGrid {
|
|||||||
PairSNAGrid(class LAMMPS *);
|
PairSNAGrid(class LAMMPS *);
|
||||||
~PairSNAGrid();
|
~PairSNAGrid();
|
||||||
|
|
||||||
void init();
|
void init_style();
|
||||||
void init_list(int, class NeighList *);
|
void init_list(int, class NeighList *);
|
||||||
void settings(int, char **);
|
void settings(int, char **);
|
||||||
void compute(int, int);
|
void compute(int, int);
|
||||||
@ -43,9 +43,12 @@ class PairSNAGrid : public PairGrid {
|
|||||||
double *radelem;
|
double *radelem;
|
||||||
double *wjelem;
|
double *wjelem;
|
||||||
int *map; // map types to [0,nelements)
|
int *map; // map types to [0,nelements)
|
||||||
int nelements, chemflag;
|
int nelements;
|
||||||
class SNA *snaptr;
|
class SNA *snaptr;
|
||||||
int quadraticflag;
|
int quadraticflag;
|
||||||
|
int twojmax, switchflag, bzeroflag, bnormflag;
|
||||||
|
int chemflag, wselfallflag;
|
||||||
|
double rfac0, rmin0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,20 +59,19 @@ PairGrid::~PairGrid()
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PairGrid::init()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
void PairGrid::setup()
|
void PairGrid::setup()
|
||||||
{
|
{
|
||||||
printf("Hello, world! C\n");
|
printf("Hello, world! C\n");
|
||||||
deallocate_grid();
|
deallocate_grid();
|
||||||
|
printf("Hello, world! D\n");
|
||||||
set_grid_global();
|
set_grid_global();
|
||||||
|
printf("Hello, world! E\n");
|
||||||
set_grid_local();
|
set_grid_local();
|
||||||
|
printf("Hello, world! F\n");
|
||||||
allocate_grid();
|
allocate_grid();
|
||||||
|
printf("Hello, world! G\n");
|
||||||
assign_coords();
|
assign_coords();
|
||||||
|
printf("Hello, world! H\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -96,6 +95,7 @@ void PairGrid::allocate_grid()
|
|||||||
{
|
{
|
||||||
if (nxlo <= nxhi && nylo <= nyhi && nzlo <= nzhi) {
|
if (nxlo <= nxhi && nylo <= nyhi && nzlo <= nzhi) {
|
||||||
gridlocal_allocated = 1;
|
gridlocal_allocated = 1;
|
||||||
|
printf("ngridlocal = %d ndesc = %d\n",ngridlocal, ndesc);
|
||||||
memory->create4d_offset(gridlocal,ndesc,nzlo,nzhi,nylo,nyhi,
|
memory->create4d_offset(gridlocal,ndesc,nzlo,nzhi,nylo,nyhi,
|
||||||
nxlo,nxhi,"pair/grid:gridlocal");
|
nxlo,nxhi,"pair/grid:gridlocal");
|
||||||
memory->create(alocal, ngridlocal, ndesc, "pair/grid:alocal");
|
memory->create(alocal, ngridlocal, ndesc, "pair/grid:alocal");
|
||||||
@ -209,6 +209,7 @@ void PairGrid::set_grid_local()
|
|||||||
|
|
||||||
void PairGrid::assign_coords()
|
void PairGrid::assign_coords()
|
||||||
{
|
{
|
||||||
|
printf("nxhi/lo = %d %d nyhi/lo = %d %d nzhi/lo = %d %d\n",nxlo,nxhi,nylo,nyhi,nzlo,nzhi);
|
||||||
int igrid = 0;
|
int igrid = 0;
|
||||||
for (int iz = nzlo; iz <= nzhi; iz++)
|
for (int iz = nzlo; iz <= nzhi; iz++)
|
||||||
for (int iy = nylo; iy <= nyhi; iy++)
|
for (int iy = nylo; iy <= nyhi; iy++)
|
||||||
@ -266,6 +267,10 @@ void PairGrid::allocate()
|
|||||||
allocated = 1;
|
allocated = 1;
|
||||||
int n = atom->ntypes;
|
int n = atom->ntypes;
|
||||||
memory->create(setflag,n+1,n+1,"pair:setflag");
|
memory->create(setflag,n+1,n+1,"pair:setflag");
|
||||||
|
for (int i = 1; i <= n; i++)
|
||||||
|
for (int j = i; j <= n; j++)
|
||||||
|
setflag[i][j] = 0;
|
||||||
|
|
||||||
memory->create(cutsq,n+1,n+1,"pair:cutsq");
|
memory->create(cutsq,n+1,n+1,"pair:cutsq");
|
||||||
map = new int[n+1];
|
map = new int[n+1];
|
||||||
}
|
}
|
||||||
@ -298,38 +303,23 @@ void PairGrid::settings(int narg, char ** arg)
|
|||||||
void PairGrid::coeff(int narg, char **arg)
|
void PairGrid::coeff(int narg, char **arg)
|
||||||
{
|
{
|
||||||
if (!allocated) allocate();
|
if (!allocated) allocate();
|
||||||
if (narg != 2) error->all(FLERR,"Incorrect args for pair coefficients");
|
if (narg < 2) error->all(FLERR,"Incorrect args for pair coefficients");
|
||||||
// if (narg != 2 + atom->ntypes) error->all(FLERR,"Incorrect args for pair coefficients");
|
// if (narg != 2 + atom->ntypes) error->all(FLERR,"Incorrect args for pair coefficients");
|
||||||
|
|
||||||
// map_element2type(narg-4,arg+4);
|
map_element2type(narg-2,arg+2);
|
||||||
// map_element2type(0,nullptr);
|
// map_element2type(0,nullptr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
|
||||||
init specific to this pair style
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
void PairGrid::init_style()
|
|
||||||
{
|
|
||||||
if (force->newton_pair == 0)
|
|
||||||
error->all(FLERR,"Pair style grid requires newton pair on");
|
|
||||||
|
|
||||||
// no neighbor list
|
|
||||||
|
|
||||||
// int irequest = neighbor->request(this,instance_me);
|
|
||||||
// neighbor->requests[irequest]->half = 0;
|
|
||||||
// neighbor->requests[irequest]->full = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
return maximum force cut off distance
|
return maximum force cut off distance
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
double PairGrid::init_one(int i, int j)
|
double PairGrid::init_one(int i, int j)
|
||||||
{
|
{
|
||||||
|
printf("i = %d j = %d setflag = %d\n", i, j, setflag[i][j]);
|
||||||
if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set");
|
if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set");
|
||||||
|
printf("PairGrid cutmax = %g\n",cutmax);
|
||||||
return cutmax;
|
return cutmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ class PairGrid : public Pair {
|
|||||||
public:
|
public:
|
||||||
PairGrid(class LAMMPS *);
|
PairGrid(class LAMMPS *);
|
||||||
virtual ~PairGrid();
|
virtual ~PairGrid();
|
||||||
void init();
|
virtual void init_style(){};
|
||||||
void setup();
|
void setup();
|
||||||
virtual void compute(int, int) {
|
virtual void compute(int, int) {
|
||||||
printf("DANGER! This function should always be overridden by child\n");
|
printf("DANGER! This function should always be overridden by child\n");
|
||||||
@ -36,7 +36,6 @@ class PairGrid : public Pair {
|
|||||||
|
|
||||||
void settings(int, char **);
|
void settings(int, char **);
|
||||||
virtual void coeff(int, char **);
|
virtual void coeff(int, char **);
|
||||||
virtual void init_style();
|
|
||||||
virtual double init_one(int, int);
|
virtual double init_one(int, int);
|
||||||
double memory_usage();
|
double memory_usage();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user