another chunk of neighbor list request updates

This commit is contained in:
Axel Kohlmeyer
2022-03-09 17:57:21 -05:00
parent e8547af049
commit 9bbd1df57b
36 changed files with 190 additions and 321 deletions

View File

@ -31,7 +31,6 @@
#include "memory.h"
#include "my_page.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
@ -342,10 +341,7 @@ void PairILPGrapheneHBN::init_style()
// need a full neighbor list, including neighbors of ghosts
int irequest = neighbor->request(this, instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->requests[irequest]->ghost = 1;
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_GHOST);
// local ILP neighbor list
// create pages if first time or if neighbor pgsize/oneatom has changed

View File

@ -31,7 +31,6 @@
#include "memory.h"
#include "my_page.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
@ -313,10 +312,7 @@ void PairKolmogorovCrespiFull::init_style()
// need a full neighbor list, including neighbors of ghosts
int irequest = neighbor->request(this, instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->requests[irequest]->ghost = 1;
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_GHOST);
// local KC neighbor list
// create pages if first time or if neighbor pgsize/oneatom has changed

View File

@ -248,7 +248,7 @@ void PairKolmogorovCrespiZ::init_style()
if (force->newton_pair == 0)
error->all(FLERR, "Pair style kolmogorov/crespi/z requires newton pair on");
neighbor->request(this, instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -245,7 +245,7 @@ void PairLebedevaZ::init_style()
if (force->newton_pair == 0)
error->all(FLERR,"Pair style lebedeva/z requires newton pair on");
neighbor->request(this,instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -29,19 +29,17 @@
#include "pair_smd_hertz.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "domain.h"
#include "force.h"
#include "comm.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "memory.h"
#include "domain.h"
#include "error.h"
#include "force.h"
#include "memory.h"
#include "neigh_list.h"
#include "neighbor.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
@ -329,8 +327,7 @@ void PairHertz::init_style() {
if (!atom->contact_radius_flag)
error->all(FLERR, "Pair style smd/hertz requires atom style with contact_radius");
int irequest = neighbor->request(this);
neighbor->requests[irequest]->size = 1;
neighbor->add_request(this, NeighConst::REQ_SIZE);
// set maxrad_dynamic and maxrad_frozen for each type
// include future Fix pour particles as dynamic

View File

@ -25,27 +25,27 @@
#include "pair_smd_tlsph.h"
#include "fix_smd_tlsph_reference_configuration.h"
#include "atom.h"
#include "comm.h"
#include "domain.h"
#include "error.h"
#include "fix.h"
#include "force.h"
#include "group.h"
#include "memory.h"
#include "modify.h"
#include "neighbor.h"
#include "smd_kernels.h"
#include "smd_material_models.h"
#include "smd_math.h"
#include "update.h"
#include <cmath>
#include <cstring>
#include <iostream>
#include <Eigen/Eigen>
#include "fix_smd_tlsph_reference_configuration.h"
#include "atom.h"
#include "domain.h"
#include "group.h"
#include "force.h"
#include "update.h"
#include "modify.h"
#include "fix.h"
#include "comm.h"
#include "neighbor.h"
#include "neigh_request.h"
#include "memory.h"
#include "error.h"
#include "smd_material_models.h"
#include "smd_kernels.h"
#include "smd_math.h"
#include <iostream>
using namespace SMD_Kernels;
using namespace Eigen;
@ -1725,8 +1725,7 @@ void PairTlsph::init_style() {
}
// request a granular neighbor list
int irequest = neighbor->request(this);
neighbor->requests[irequest]->size = 1;
neighbor->add_request(this, NeighConst::REQ_SIZE);
// set maxrad_dynamic and maxrad_frozen for each type
// include future Fix pour particles as dynamic

View File

@ -29,20 +29,18 @@
#include "pair_smd_triangulated_surface.h"
#include <cmath>
#include "atom.h"
#include "comm.h"
#include "domain.h"
#include "error.h"
#include "force.h"
#include "memory.h"
#include "neigh_list.h"
#include "neighbor.h"
#include <cmath>
#include <cstring>
#include <Eigen/Eigen>
#include "atom.h"
#include "domain.h"
#include "force.h"
#include "comm.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "memory.h"
#include "error.h"
using namespace std;
using namespace LAMMPS_NS;
@ -411,14 +409,7 @@ void PairTriSurf::init_style() {
if (!atom->contact_radius_flag)
error->all(FLERR, "Pair style smd/smd/tri_surface requires atom style with contact_radius");
// old: half list
int irequest = neighbor->request(this);
neighbor->requests[irequest]->size = 1;
// need a full neighbor list
// int irequest = neighbor->request(this);
// neighbor->requests[irequest]->half = 0;
// neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_SIZE);
// set maxrad_dynamic and maxrad_frozen for each type
// include future Fix pour particles as dynamic

View File

@ -31,7 +31,6 @@
#include "error.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "smd_kernels.h"
#include "smd_material_models.h"
@ -1434,10 +1433,8 @@ double PairULSPH::init_one(int i, int j) {
void PairULSPH::init_style() {
int i;
//printf(" in init style\n");
// request a granular neighbor list
int irequest = neighbor->request(this);
neighbor->requests[irequest]->size = 1;
// request a granular neighbor list
neighbor->add_request(this, NeighConst::REQ_SIZE);
// set maxrad_dynamic and maxrad_frozen for each type
// include future Fix pour particles as dynamic

View File

@ -512,7 +512,7 @@ void PairADP::init_style()
file2array();
array2spline();
neighbor->request(this,instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -18,7 +18,6 @@
#include "pair_atm.h"
#include <cmath>
#include "atom.h"
#include "citeme.h"
#include "comm.h"
@ -26,9 +25,9 @@
#include "force.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include <cmath>
using namespace LAMMPS_NS;
@ -257,9 +256,7 @@ void PairATM::init_style()
// need a full neighbor list
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
}
/* ----------------------------------------------------------------------

View File

@ -46,7 +46,6 @@
#include "math_special.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
#include "tabular_function.h"
@ -417,10 +416,7 @@ void PairBOP::init_style()
// need a full neighbor list and neighbors of ghosts
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->requests[irequest]->ghost = 1;
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_GHOST);
}
/* ---------------------------------------------------------------------- */

View File

@ -32,7 +32,6 @@
#include "memory.h"
#include "my_page.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
@ -108,12 +107,12 @@ PairComb::~PairComb()
memory->destroy(sht_num);
memory->sfree(sht_first);
delete [] ipage;
delete[] ipage;
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
delete [] esm;
delete[] esm;
}
}
@ -483,9 +482,7 @@ void PairComb::init_style()
// need a full neighbor list
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
// local Comb neighbor list
// create pages if first time or if neighbor pgsize/oneatom has changed
@ -496,7 +493,7 @@ void PairComb::init_style()
if (oneatom != neighbor->oneatom) create = 1;
if (create) {
delete [] ipage;
delete[] ipage;
pgsize = neighbor->pgsize;
oneatom = neighbor->oneatom;

View File

@ -31,7 +31,6 @@
#include "memory.h"
#include "my_page.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
#include "text_file_reader.h"
@ -126,13 +125,13 @@ PairComb3::~PairComb3()
memory->destroy(sht_num);
memory->sfree(sht_first);
delete [] ipage;
delete[] ipage;
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(cutghost);
delete [] esm;
delete[] esm;
}
}
@ -216,11 +215,8 @@ void PairComb3::init_style()
if (!atom->q_flag)
error->all(FLERR,"Pair style COMB3 requires atom attribute q");
// need a full neighbor list
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->requests[irequest]->ghost = 1;
// need a full neighbor list
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_GHOST);
// local Comb neighbor list
// create pages if first time or if neighbor pgsize/oneatom has changed
@ -231,7 +227,7 @@ void PairComb3::init_style()
if (oneatom != neighbor->oneatom) create = 1;
if (create) {
delete [] ipage;
delete[] ipage;
pgsize = neighbor->pgsize;
oneatom = neighbor->oneatom;
@ -2503,10 +2499,10 @@ void PairComb3::tables()
}
}
delete [] vrc;
delete [] rrc;
delete [] cc2;
delete [] cc3;
delete[] vrc;
delete[] rrc;
delete[] cc2;
delete[] cc3;
memory->destroy(rvdw);
}

View File

@ -425,7 +425,7 @@ void PairEAM::init_style()
file2array();
array2spline();
neighbor->request(this,instance_me);
neighbor->add_request(this);
embedstep = -1;
}

View File

@ -29,7 +29,6 @@
#include "force.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
@ -747,9 +746,7 @@ void PairEDIP::init_style()
// need a full neighbor list
int irequest = neighbor->request(this, instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
}
/* ----------------------------------------------------------------------

View File

@ -28,7 +28,6 @@
#include "math_extra.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
@ -561,9 +560,7 @@ void PairEDIPMulti::init_style()
// need a full neighbor list
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
}
/* ----------------------------------------------------------------------

View File

@ -382,7 +382,7 @@ void PairEIM::init_style()
file2array();
array2spline();
neighbor->request(this,instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -27,7 +27,6 @@
#include "memory.h"
#include "my_page.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include <cmath>
@ -76,7 +75,7 @@ PairExTeP::~PairExTeP()
memory->destroy(SR_numneigh);
memory->sfree(SR_firstneigh);
delete [] ipage;
delete[] ipage;
memory->destroy(Nt);
memory->destroy(Nd);
@ -473,12 +472,7 @@ void PairExTeP::init_style()
// need a full neighbor list
int irequest = neighbor->request(this);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
// including neighbors of ghosts
neighbor->requests[irequest]->ghost = 1;
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_GHOST);
// create pages if first time or if neighbor pgsize/oneatom has changed
@ -488,7 +482,7 @@ void PairExTeP::init_style()
if (oneatom != neighbor->oneatom) create = 1;
if (create) {
delete [] ipage;
delete[] ipage;
pgsize = neighbor->pgsize;
oneatom = neighbor->oneatom;
@ -652,7 +646,7 @@ void PairExTeP::read_file(char *file)
}
// deallocate words array
delete [] words;
delete[] words;
/* F_IJ (3) */
// read the spline coefficients
@ -742,7 +736,7 @@ void PairExTeP::read_file(char *file)
}
}
delete [] words;
delete[] words;
/* END F_IJ (3) */
}

View File

@ -27,7 +27,6 @@
#include "math_extra.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
@ -285,9 +284,7 @@ void PairGW::init_style()
// need a full neighbor list
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
}
/* ----------------------------------------------------------------------

View File

@ -24,7 +24,6 @@
#include "comm.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "my_page.h"
#include "memory.h"
#include "error.h"
@ -153,10 +152,7 @@ void PairLCBOP::init_style()
// need a full neighbor list, including neighbors of ghosts
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->requests[irequest]->ghost = 1;
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_GHOST);
// local SR neighbor list
// create pages if first time or if neighbor pgsize/oneatom has changed

View File

@ -421,12 +421,12 @@ void PairLocalDensity::coeff(int narg, char **arg)
void PairLocalDensity::init_style()
{
// spline rho and frho arrays
// request half neighbor list
array2spline();
// half neighbor request
neighbor->request(this);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -579,15 +579,8 @@ void PairMEAMSpline::init_style()
error->all(FLERR,"Pair style meam/spline requires newton pair on");
// Need both full and half neighbor list.
int irequest_full = neighbor->request(this,instance_me);
neighbor->requests[irequest_full]->id = 1;
neighbor->requests[irequest_full]->half = 0;
neighbor->requests[irequest_full]->full = 1;
int irequest_half = neighbor->request(this,instance_me);
neighbor->requests[irequest_half]->id = 2;
// neighbor->requests[irequest_half]->half = 1;
// neighbor->requests[irequest_half]->halffull = 1;
// neighbor->requests[irequest_half]->halffulllist = irequest_full;
neighbor->add_request(this, NeighConst::REQ_FULL)->set_id(1);
neighbor->add_request(this)->set_id(2);
}
/* ----------------------------------------------------------------------

View File

@ -381,8 +381,7 @@ void PairMEAMSWSpline::coeff(int narg, char **arg)
// for now, only allow single element
if (nelements > 1)
error->all(FLERR,
"Pair meam/sw/spline only supports single element potentials");
error->all(FLERR, "Pair meam/sw/spline only supports single element potentials");
// read potential file
@ -463,12 +462,8 @@ void PairMEAMSWSpline::init_style()
error->all(FLERR,"Pair style meam/sw/spline requires newton pair on");
// Need both full and half neighbor list.
int irequest_full = neighbor->request(this,instance_me);
neighbor->requests[irequest_full]->id = 1;
neighbor->requests[irequest_full]->half = 0;
neighbor->requests[irequest_full]->full = 1;
int irequest_half = neighbor->request(this,instance_me);
neighbor->requests[irequest_half]->id = 2;
neighbor->add_request(this, NeighConst::REQ_FULL)->set_id(1);
neighbor->add_request(this)->set_id(2);
}
/* ----------------------------------------------------------------------

View File

@ -1,4 +1,3 @@
// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@ -23,9 +22,9 @@
#include "comm.h"
#include "error.h"
#include "force.h"
#include "math_const.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
@ -33,10 +32,10 @@
#include <cstring>
using namespace LAMMPS_NS;
using MathConst::MY_PI;
#define DELTA 4
#define SMALL 0.001
#define PI 3.141592653589793238462643383279
/* ---------------------------------------------------------------------- */
@ -71,15 +70,15 @@ PairNb3bHarmonic::~PairNb3bHarmonic()
void PairNb3bHarmonic::compute(int eflag, int vflag)
{
int i,j,k,ii,jj,kk,inum,jnum,jnumm1;
int itype,jtype,ktype,ijparam,ikparam,ijkparam;
double xtmp,ytmp,ztmp,evdwl;
double rsq1,rsq2;
double delr1[3],delr2[3],fj[3],fk[3];
int *ilist,*jlist,*numneigh,**firstneigh;
int i, j, k, ii, jj, kk, inum, jnum, jnumm1;
int itype, jtype, ktype, ijparam, ikparam, ijkparam;
double xtmp, ytmp, ztmp, evdwl;
double rsq1, rsq2;
double delr1[3], delr2[3], fj[3], fk[3];
int *ilist, *jlist, *numneigh, **firstneigh;
evdwl = 0.0;
ev_init(eflag,vflag);
ev_init(eflag, vflag);
double **x = atom->x;
double **f = atom->f;
@ -111,10 +110,10 @@ void PairNb3bHarmonic::compute(int eflag, int vflag)
delr1[0] = x[j][0] - xtmp;
delr1[1] = x[j][1] - ytmp;
delr1[2] = x[j][2] - ztmp;
rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2];
rsq1 = delr1[0] * delr1[0] + delr1[1] * delr1[1] + delr1[2] * delr1[2];
if (rsq1 > params[ijparam].cutsq) continue;
for (kk = jj+1; kk < jnum; kk++) {
for (kk = jj + 1; kk < jnum; kk++) {
k = jlist[kk];
k &= NEIGHMASK;
ktype = map[type[k]];
@ -124,11 +123,11 @@ void PairNb3bHarmonic::compute(int eflag, int vflag)
delr2[0] = x[k][0] - xtmp;
delr2[1] = x[k][1] - ytmp;
delr2[2] = x[k][2] - ztmp;
rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2];
rsq2 = delr2[0] * delr2[0] + delr2[1] * delr2[1] + delr2[2] * delr2[2];
if (rsq2 > params[ikparam].cutsq) continue;
threebody(&params[ijparam],&params[ikparam],&params[ijkparam],
rsq1,rsq2,delr1,delr2,fj,fk,eflag,evdwl);
threebody(&params[ijparam], &params[ikparam], &params[ijkparam], rsq1, rsq2, delr1, delr2,
fj, fk, eflag, evdwl);
f[i][0] -= fj[0] + fk[0];
f[i][1] -= fj[1] + fk[1];
@ -140,7 +139,7 @@ void PairNb3bHarmonic::compute(int eflag, int vflag)
f[k][1] += fk[1];
f[k][2] += fk[2];
if (evflag) ev_tally3(i,j,k,evdwl,0.0,fj,fk,delr1,delr2);
if (evflag) ev_tally3(i, j, k, evdwl, 0.0, fj, fk, delr1, delr2);
}
}
}
@ -153,21 +152,21 @@ void PairNb3bHarmonic::compute(int eflag, int vflag)
void PairNb3bHarmonic::allocate()
{
allocated = 1;
int n = atom->ntypes;
int np1 = atom->ntypes + 1;
memory->create(setflag,n+1,n+1,"pair:setflag");
memory->create(cutsq,n+1,n+1,"pair:cutsq");
memory->create(setflag, np1, np1, "pair:setflag");
memory->create(cutsq, np1, np1, "pair:cutsq");
map = new int[n+1];
map = new int[np1];
}
/* ----------------------------------------------------------------------
global settings
------------------------------------------------------------------------- */
void PairNb3bHarmonic::settings(int narg, char **/*arg*/)
void PairNb3bHarmonic::settings(int narg, char ** /*arg*/)
{
if (narg != 0) error->all(FLERR,"Illegal pair_style command");
if (narg != 0) error->all(FLERR, "Illegal pair_style command");
}
/* ----------------------------------------------------------------------
@ -178,7 +177,7 @@ void PairNb3bHarmonic::coeff(int narg, char **arg)
{
if (!allocated) allocate();
map_element2type(narg-3,arg+3);
map_element2type(narg - 3, arg + 3);
// read potential file and initialize potential parameters
@ -186,23 +185,19 @@ void PairNb3bHarmonic::coeff(int narg, char **arg)
setup_params();
}
/* ----------------------------------------------------------------------
init specific to this pair style
------------------------------------------------------------------------- */
void PairNb3bHarmonic::init_style()
{
if (atom->tag_enable == 0)
error->all(FLERR,"Pair style nb3b/harmonic requires atom IDs");
if (atom->tag_enable == 0) error->all(FLERR, "Pair style nb3b/harmonic requires atom IDs");
if (force->newton_pair == 0)
error->all(FLERR,"Pair style nb3b/harmonic requires newton pair on");
error->all(FLERR, "Pair style nb3b/harmonic requires newton pair on");
// need a full neighbor list
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
}
/* ----------------------------------------------------------------------
@ -211,7 +206,7 @@ void PairNb3bHarmonic::init_style()
double PairNb3bHarmonic::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 cutmax;
}
@ -228,13 +223,12 @@ void PairNb3bHarmonic::read_file(char *file)
if (comm->me == 0) {
PotentialFileReader reader(lmp, file, "nb3b/harmonic", unit_convert_flag);
char * line;
char *line;
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
double conversion_factor = utils::get_conversion_factor(utils::ENERGY, unit_convert);
while ((line = reader.next_line(NPARAMS_PER_LINE))) {
try {
ValueTokenizer values(line);
@ -262,21 +256,20 @@ void PairNb3bHarmonic::read_file(char *file)
if (nparams == maxparam) {
maxparam += DELTA;
params = (Param *) memory->srealloc(params,maxparam*sizeof(Param),
"pair:params");
params = (Param *) memory->srealloc(params, maxparam * sizeof(Param), "pair:params");
// make certain all addional allocated storage is initialized
// to avoid false positives when checking with valgrind
memset(params + nparams, 0, DELTA*sizeof(Param));
memset(params + nparams, 0, DELTA * sizeof(Param));
}
params[nparams].ielement = ielement;
params[nparams].jelement = jelement;
params[nparams].kelement = kelement;
params[nparams].k_theta = values.next_double();
params[nparams].theta0 = values.next_double();
params[nparams].cutoff = values.next_double();
params[nparams].k_theta = values.next_double();
params[nparams].theta0 = values.next_double();
params[nparams].cutoff = values.next_double();
if (unit_convert) params[nparams].k_theta *= conversion_factor;
} catch (TokenizerException &e) {
@ -285,7 +278,7 @@ void PairNb3bHarmonic::read_file(char *file)
if (params[nparams].k_theta < 0.0 || params[nparams].theta0 < 0.0 ||
params[nparams].cutoff < 0.0)
error->one(FLERR,"Illegal nb3b/harmonic parameter");
error->one(FLERR, "Illegal nb3b/harmonic parameter");
nparams++;
}
@ -295,17 +288,17 @@ void PairNb3bHarmonic::read_file(char *file)
MPI_Bcast(&maxparam, 1, MPI_INT, 0, world);
if (comm->me != 0) {
params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params");
params = (Param *) memory->srealloc(params, maxparam * sizeof(Param), "pair:params");
}
MPI_Bcast(params, maxparam*sizeof(Param), MPI_BYTE, 0, world);
MPI_Bcast(params, maxparam * sizeof(Param), MPI_BYTE, 0, world);
}
/* ---------------------------------------------------------------------- */
void PairNb3bHarmonic::setup_params()
{
int i,j,k,m,n;
int i, j, k, m, n;
double rtmp;
// set elem3param for all triplet combinations
@ -313,20 +306,19 @@ void PairNb3bHarmonic::setup_params()
// do not allow for ACB in place of ABC
memory->destroy(elem3param);
memory->create(elem3param,nelements,nelements,nelements,"pair:elem3param");
memory->create(elem3param, nelements, nelements, nelements, "pair:elem3param");
for (i = 0; i < nelements; i++)
for (j = 0; j < nelements; j++)
for (k = 0; k < nelements; k++) {
n = -1;
for (m = 0; m < nparams; m++) {
if (i == params[m].ielement && j == params[m].jelement &&
k == params[m].kelement) {
if (n >= 0) error->all(FLERR,"Potential file has duplicate entry");
if (i == params[m].ielement && j == params[m].jelement && k == params[m].kelement) {
if (n >= 0) error->all(FLERR, "Potential file has duplicate entry");
n = m;
}
}
if (n < 0) error->all(FLERR,"Potential file is missing an entry");
if (n < 0) error->all(FLERR, "Potential file is missing an entry");
elem3param[i][j][k] = n;
}
@ -341,8 +333,7 @@ void PairNb3bHarmonic::setup_params()
params[m].cut = params[m].cutoff;
params[m].cutsq = params[m].cut * params[m].cut;
params[m].theta0 = params[m].theta0 / 180.0 * PI;
params[m].theta0 = params[m].theta0 / 180.0 * MY_PI;
}
// set cutmax to max of all params
@ -356,48 +347,44 @@ void PairNb3bHarmonic::setup_params()
/* ---------------------------------------------------------------------- */
void PairNb3bHarmonic::threebody(Param * /*paramij*/, Param * /*paramik*/,
Param *paramijk,
double rsq1, double rsq2,
double *delr1, double *delr2,
double *fj, double *fk, int eflag, double &eng)
void PairNb3bHarmonic::threebody(Param * /*paramij*/, Param * /*paramik*/, Param *paramijk,
double rsq1, double rsq2, double *delr1, double *delr2, double *fj,
double *fk, int eflag, double &eng)
{
double dtheta,tk;
double r1,r2,c,s,a,a11,a12,a22;
double dtheta, tk;
double r1, r2, c, s, a, a11, a12, a22;
// angle (cos and sin)
r1 = sqrt(rsq1);
r2 = sqrt(rsq2);
c = delr1[0]*delr2[0] + delr1[1]*delr2[1] + delr1[2]*delr2[2];
c /= r1*r2;
c = delr1[0] * delr2[0] + delr1[1] * delr2[1] + delr1[2] * delr2[2];
c /= r1 * r2;
if (c > 1.0) c = 1.0;
if (c < -1.0) c = -1.0;
s = sqrt(1.0 - c*c);
s = sqrt(1.0 - c * c);
if (s < SMALL) s = SMALL;
s = 1.0/s;
s = 1.0 / s;
// force & energy
dtheta = acos(c) - paramijk->theta0;
tk = paramijk->k_theta * dtheta;
if (eflag) eng = tk*dtheta;
if (eflag) eng = tk * dtheta;
a = -2.0 * tk * s;
a11 = a*c / rsq1;
a12 = -a / (r1*r2);
a22 = a*c / rsq2;
a11 = a * c / rsq1;
a12 = -a / (r1 * r2);
a22 = a * c / rsq2;
fj[0] = a11*delr1[0] + a12*delr2[0];
fj[1] = a11*delr1[1] + a12*delr2[1];
fj[2] = a11*delr1[2] + a12*delr2[2];
fk[0] = a22*delr2[0] + a12*delr1[0];
fk[1] = a22*delr2[1] + a12*delr1[1];
fk[2] = a22*delr2[2] + a12*delr1[2];
fj[0] = a11 * delr1[0] + a12 * delr2[0];
fj[1] = a11 * delr1[1] + a12 * delr2[1];
fj[2] = a11 * delr1[2] + a12 * delr2[2];
fk[0] = a22 * delr2[0] + a12 * delr1[0];
fk[1] = a22 * delr2[1] + a12 * delr1[1];
fk[2] = a22 * delr2[2] + a12 * delr1[2];
}

View File

@ -29,7 +29,6 @@
#include "math_extra.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
#include "tabular_function.h"
@ -525,9 +524,7 @@ void PairPolymorphic::init_style()
// need a full neighbor list
int irequest = neighbor->request(this);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
}
/* ----------------------------------------------------------------------

View File

@ -24,7 +24,6 @@
#include "force.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
@ -264,9 +263,7 @@ void PairSW::init_style()
// need a full neighbor list
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
}
/* ----------------------------------------------------------------------

View File

@ -29,7 +29,6 @@
#include "force.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
@ -743,9 +742,7 @@ void PairTersoffTable::init_style()
// need a full neighbor list
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
}
/* ----------------------------------------------------------------------

View File

@ -26,7 +26,6 @@
#include "memory.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "potential_file_reader.h"
#include <cmath>
@ -270,9 +269,7 @@ void PairVashishta::init_style()
// need a full neighbor list
int irequest = neighbor->request(this);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
}
/* ----------------------------------------------------------------------

View File

@ -14,21 +14,21 @@
#include "fix_bond_create.h"
#include <cstring>
#include "update.h"
#include "respa.h"
#include "atom.h"
#include "force.h"
#include "modify.h"
#include "pair.h"
#include "comm.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "random_mars.h"
#include "memory.h"
#include "error.h"
#include "force.h"
#include "math_const.h"
#include "memory.h"
#include "modify.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "pair.h"
#include "random_mars.h"
#include "respa.h"
#include "update.h"
#include <cstring>
using namespace LAMMPS_NS;
using namespace FixConst;
@ -283,11 +283,7 @@ void FixBondCreate::init()
}
// need a half neighbor list, built every Nevery steps
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->pair = 0;
neighbor->requests[irequest]->fix = 1;
neighbor->requests[irequest]->occasional = 1;
neighbor->add_request(this, NeighConst::REQ_OCCASIONAL);
lastcheck = -1;
}

View File

@ -26,7 +26,6 @@
#include "memory.h"
#include "modify.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "pair.h"
#include "random_mars.h"
@ -160,10 +159,7 @@ void FixBondSwap::init()
// need a half neighbor list, built every Nevery steps
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->pair = 0;
neighbor->requests[irequest]->fix = 1;
neighbor->requests[irequest]->occasional = 1;
neighbor->add_request(this, NeighConst::REQ_OCCASIONAL);
// zero out stats

View File

@ -26,7 +26,6 @@
#include "math_extra.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
#include "update.h"
@ -503,9 +502,7 @@ void PairMesoCNT::init_style()
// need a full neighbor list
int irequest = neighbor->request(this, instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
}
/* ----------------------------------------------------------------------

View File

@ -16,7 +16,6 @@
#include "pair_mesont_tpm.h"
#include "export_mesont.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
@ -24,12 +23,11 @@
#include "error.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include <cstring>
#include <cmath>
#include <array>
#include <array>
#include <fstream>
#include <algorithm>
@ -765,10 +763,7 @@ void PairMESONTTPM::write_data_all(FILE *fp) {
void PairMESONTTPM::init_style() {
//make sure that a full list is created (including ghost nodes)
int r = neighbor->request(this,instance_me);
neighbor->requests[r]->half = false;
neighbor->requests[r]->full = true;
neighbor->requests[r]->ghost = true;
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_GHOST);
}
void* PairMESONTTPM::extract(const char *str, int &) {

View File

@ -769,7 +769,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist,
if (domain->triclinic) {
if (comm->me == 0)
printf("Can not handle triclinic box yet\n");
error->all(__FILE__,__LINE__,"Can not handle triclinic cell with mgpt yet.");
error->all(FLERR,"Can not handle triclinic cell with mgpt yet.");
}
/*
@ -876,7 +876,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist,
if (first[i+1] > nneitot) {
printf("nneitot = %d, short list full. i=%d\n",
nneitot,i);
error->one(__FILE__,__LINE__,"Shit! Short list full\n");
error->one(FLERR,"Shit! Short list full\n");
}
}
@ -1272,7 +1272,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist,
" k=%d first[k]=%d first[k+1]=%d mk=%d\n",
j,first[j],first[j+1],mj,
k,first[k],first[k+1],mk);
error->one(__FILE__,__LINE__,"Shit, brkoen quad loop");
error->one(FLERR,"Shit, brkoen quad loop");
}
if (nlist_short[mj] == nlist_short[mk]) {
@ -1804,7 +1804,7 @@ void PairMGPT::allocate()
------------------------------------------------------------------------- */
void PairMGPT::settings(int narg, char **/*arg*/)
{
if (narg != 0) error->all(__FILE__,__LINE__,"Illegal pair_style command");
if (narg != 0) error->all(FLERR,"Illegal pair_style command");
}
/* ----------------------------------------------------------------------
@ -1816,18 +1816,18 @@ void PairMGPT::coeff(int narg, char **arg)
int single_precision = 0;
if (narg < 5)
error->all(__FILE__,__LINE__,
error->all(FLERR,
"Not enough arguments for mgpt (MGPT) pair coefficients.");
if (!allocated) allocate();
// Make sure I,J args are * *
if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0)
error->all(__FILE__,__LINE__,"Incorrect args for pair coefficients");
error->all(FLERR,"Incorrect args for pair coefficients");
double vol;
if (sscanf(arg[4], "%lg", &vol) != 1 || vol <= 0.0)
error->all(__FILE__,__LINE__,"Invalid volume in mgpt (MGPT) pair coefficients.");
error->all(FLERR,"Invalid volume in mgpt (MGPT) pair coefficients.");
volpres_flag = 1;
single_precision = 0;
@ -1846,8 +1846,8 @@ void PairMGPT::coeff(int narg, char **arg)
char line[1024];
sprintf(line,"(In %s:%d) Invalid value for volumetric pressure argument.\n"
"It should be \"volpress yes\" or \"volpress no\".\n"
"The value is \"%s\".\n",__FILE__,__LINE__,arg[iarg+1]);
error->all(__FILE__,__LINE__,line);
"The value is \"%s\".\n",FLERR,arg[iarg+1]);
error->all(FLERR,line);
}
volpres_tag = 1;
iarg += 2;
@ -1868,8 +1868,8 @@ void PairMGPT::coeff(int narg, char **arg)
"It should be e.g. \"nbody=1234\" (for single, pair, triple, and quad forces/energiers)\n"
"For e.g. only pair and triple forces/energies, use \"nbody=23\".\n"
"The default is \"nbody=1234\".\n"
"The current value is \"%s\".\n",__FILE__,__LINE__,arg[iarg+1]);
error->all(__FILE__,__LINE__,line);
"The current value is \"%s\".\n",FLERR,arg[iarg+1]);
error->all(FLERR,line);
}
nbody_tag = 1;
iarg += 2;
@ -1882,8 +1882,8 @@ void PairMGPT::coeff(int narg, char **arg)
char line[1024];
sprintf(line,"(In %s:%d) Invalid value for precision argument.\n"
"It should be \"precision single\" or \"precision double\".\n"
"The value is \"%s\".\n",__FILE__,__LINE__,arg[iarg+1]);
error->all(__FILE__,__LINE__,line);
"The value is \"%s\".\n",FLERR,arg[iarg+1]);
error->all(FLERR,line);
}
precision_tag = 1;
iarg += 2;
@ -1894,8 +1894,8 @@ void PairMGPT::coeff(int narg, char **arg)
" volpress {yes|no} , default = yes\n"
" precision {single|double} , default = double\n"
" nbody {[1234,]*} , default = whichever terms potential require\n"
"The invalid argument is \"%s\".\n",__FILE__,__LINE__,arg[iarg]);
error->all(__FILE__,__LINE__,line);
"The invalid argument is \"%s\".\n",FLERR,arg[iarg]);
error->all(FLERR,line);
}
}
@ -1995,18 +1995,11 @@ void PairMGPT::coeff(int narg, char **arg)
void PairMGPT::init_style()
{
if (force->newton_pair == 0)
error->all(__FILE__,__LINE__,"Pair style mgpt requires newton pair on.");
error->all(FLERR,"Pair style mgpt requires newton pair on.");
// Need full neighbor list.
int irequest_full = neighbor->request(this);
neighbor->requests[irequest_full]->id = 1;
neighbor->requests[irequest_full]->half = 0;
neighbor->requests[irequest_full]->full = 1;
neighbor->requests[irequest_full]->ghost = 1;
// Also need half neighbor list.
int irequest_half = neighbor->request(this);
neighbor->requests[irequest_half]->id = 2;
// Need a half list and a full neighbor list with neighbors of ghosts
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_GHOST)->set_id(1);
neighbor->add_request(this)->set_id(2);
}
/* ----------------------------------------------------------------------

View File

@ -27,7 +27,6 @@
#include "math_special.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "potential_file_reader.h"
@ -249,10 +248,7 @@ void PairAGNI::coeff(int narg, char **arg)
void PairAGNI::init_style()
{
// need a full neighbor list
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
}
/* ----------------------------------------------------------------------

View File

@ -471,16 +471,13 @@ void PairSRP::init_style()
// bond particles do not belong to group all
// but thermo normalization is by nall
// therefore should turn off normalization
int me;
MPI_Comm_rank(world,&me);
char *arg1[2];
arg1[0] = (char *) "norm";
arg1[1] = (char *) "no";
output->thermo->modify_params(2, arg1);
if (me == 0)
error->message(FLERR,"Thermo normalization turned off by pair srp");
if (comm->me == 0) error->message(FLERR,"Thermo normalization turned off by pair srp");
neighbor->request(this,instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -24,7 +24,6 @@
#include "memory.h"
#include "modify.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "update.h"
@ -271,15 +270,11 @@ void PairTracker::init_style()
if (!atom->radius_flag && finitecutflag)
error->all(FLERR, "Pair tracker requires atom attribute radius for finite cutoffs");
// need a history neigh list
int irequest = neighbor->request(this, instance_me);
if (finitecutflag) {
neighbor->requests[irequest]->size = 1;
neighbor->requests[irequest]->history = 1;
// history flag won't affect results, but match granular pairstyles
// so neighborlist can be copied to reduce overhead
}
int neigh_flags = NeighConst::REQ_DEFAULT;
// history flag won't affect results, but match granular pairstyles
// so neighborlist can be copied to reduce overhead
if (finitecutflag) neigh_flags |= NeighConst::REQ_SIZE | NeighConst::REQ_HISTORY;
neighbor->add_request(this, neigh_flags);
// if history is stored and first init, create Fix to store history
// it replaces FixDummy, created in the constructor
@ -288,10 +283,12 @@ void PairTracker::init_style()
if (fix_history == nullptr) {
modify->replace_fix("NEIGH_HISTORY_TRACK_DUMMY",
fmt::format("NEIGH_HISTORY_TRACK all NEIGH_HISTORY {}", size_history), 1);
int ifix = modify->find_fix("NEIGH_HISTORY_TRACK");
fix_history = (FixNeighHistory *) modify->fix[ifix];
fix_history = (FixNeighHistory *) modify->get_fix_by_id("NEIGH_HISTORY_TRACK");
fix_history->pair = this;
fix_history->use_bit_flag = 0;
} else {
fix_history = (FixNeighHistory *) modify->get_fix_by_id("NEIGH_HISTORY_TRACK");
if (!fix_history) error->all(FLERR, "Could not find pair fix neigh history ID");
}
if (finitecutflag) {
@ -342,10 +339,6 @@ void PairTracker::init_style()
MPI_Allreduce(&onerad_frozen[1], &maxrad_frozen[1], atom->ntypes, MPI_DOUBLE, MPI_MAX, world);
}
int ifix = modify->find_fix("NEIGH_HISTORY_TRACK");
if (ifix < 0) error->all(FLERR, "Could not find pair fix neigh history ID");
fix_history = (FixNeighHistory *) modify->fix[ifix];
auto trackfixes = modify->get_fix_by_style("pair/tracker");
if (trackfixes.size() != 1)
error->all(FLERR, "Must use exactly one fix pair/tracker command with pair style tracker");