Latest version of PairGrid

This commit is contained in:
Aidan Thompson
2021-10-22 17:01:20 -06:00
parent e698d295fc
commit 1450af8ba1
5 changed files with 18 additions and 10 deletions

View File

@ -205,8 +205,8 @@ void PairSNAGrid::settings(int narg, char ** arg)
// process required arguments // process required arguments
memory->create(radelem,ntypes+1,"sna/grid/local:radelem"); // offset by 1 to match up with types memory->create(radelem,ntypes+1,"pair:sna/grid:radelem"); // offset by 1 to match up with types
memory->create(wjelem,ntypes+1,"sna/grid/local:wjelem"); memory->create(wjelem,ntypes+1,"pair:sna/grid:wjelem");
rcutfac = atof(arg[0]); rcutfac = atof(arg[0]);
rfac0 = atof(arg[1]); rfac0 = atof(arg[1]);
@ -221,7 +221,7 @@ void PairSNAGrid::settings(int narg, char ** arg)
double cut; double cut;
cutmax = 0.0; cutmax = 0.0;
memory->create(cutsq,ntypes+1,ntypes+1,"sna/grid/local:cutsq"); memory->create(cutsq,ntypes+1,ntypes+1,"pair:sna/grid:cutsq");
for(int i = 1; i <= ntypes; i++) { for(int i = 1; i <= ntypes; i++) {
cut = 2.0*radelem[i]*rcutfac; cut = 2.0*radelem[i]*rcutfac;
if (cut > cutmax) cutmax = cut; if (cut > cutmax) cutmax = cut;
@ -262,7 +262,7 @@ void PairSNAGrid::settings(int narg, char ** arg)
if (iarg+2 > narg) if (iarg+2 > narg)
error->all(FLERR,"Illegal pair sna/grid command"); error->all(FLERR,"Illegal pair sna/grid command");
chemflag = 1; chemflag = 1;
memory->create(map,ntypes+1,"compute_sna_grid_local:map"); memory->create(map,ntypes+1,"pair:sna/grid:map");
nelements = utils::inumeric(FLERR,arg[iarg+1],false,lmp); nelements = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
for (int i = 0; i < ntypes; i++) { for (int i = 0; i < ntypes; i++) {
int jelem = utils::inumeric(FLERR,arg[iarg+2+i],false,lmp); int jelem = utils::inumeric(FLERR,arg[iarg+2+i],false,lmp);

View File

@ -45,7 +45,6 @@ class PairSNAGrid : public PairGrid {
int *map; // map types to [0,nelements) int *map; // map types to [0,nelements)
int nelements, chemflag; int nelements, chemflag;
class SNA *snaptr; class SNA *snaptr;
double cutmax;
int quadraticflag; int quadraticflag;
}; };

View File

@ -67,6 +67,7 @@ void PairGrid::init()
void PairGrid::setup() void PairGrid::setup()
{ {
printf("Hello, world! C\n");
deallocate_grid(); deallocate_grid();
set_grid_global(); set_grid_global();
set_grid_local(); set_grid_local();
@ -297,9 +298,11 @@ 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 + atom->ntypes) 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");
map_element2type(narg-4,arg+4); // map_element2type(narg-4,arg+4);
// map_element2type(0,nullptr);
} }
@ -321,13 +324,13 @@ void PairGrid::init_style()
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
init for one type pair i,j and corresponding j,i return maximum force cut off distance
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
double PairGrid::init_one(int i, int j) double PairGrid::init_one(int i, int 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");
return 0.0; return cutmax;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -99,6 +99,8 @@ void Verlet::setup(int flag)
} }
} }
printf("Hello, world! A\n");
if (lmp->kokkos) if (lmp->kokkos)
error->all(FLERR,"KOKKOS package requires run_style verlet/kk"); error->all(FLERR,"KOKKOS package requires run_style verlet/kk");
@ -126,6 +128,8 @@ void Verlet::setup(int flag)
modify->setup_post_neighbor(); modify->setup_post_neighbor();
neighbor->ncalls = 0; neighbor->ncalls = 0;
printf("Hello, world! B\n");
// compute all forces // compute all forces
force->setup(); force->setup();
@ -133,6 +137,8 @@ void Verlet::setup(int flag)
force_clear(); force_clear();
modify->setup_pre_force(vflag); modify->setup_pre_force(vflag);
printf("Hello, world!\n");
if (pair_compute_flag) force->pair->compute(eflag,vflag); if (pair_compute_flag) force->pair->compute(eflag,vflag);
else if (force->pair) force->pair->compute_dummy(eflag,vflag); else if (force->pair) force->pair->compute_dummy(eflag,vflag);