convert more neighbor list requests to the new API

This commit is contained in:
Axel Kohlmeyer
2022-03-08 11:38:41 -05:00
parent deb694745b
commit dfbeedfded
31 changed files with 1056 additions and 1146 deletions

View File

@ -1,4 +1,3 @@
// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@ -19,17 +18,17 @@
#include "pair_lj_sdk_coul_long.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "comm.h"
#include "error.h"
#include "force.h"
#include "kspace.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "memory.h"
#include "error.h"
#include "neigh_list.h"
#include "neighbor.h"
#include <cmath>
#include <cstring>
#define LMP_NEED_SDK_FIND_LJ_TYPE 1
#include "lj_sdk_common.h"
@ -90,15 +89,21 @@ void PairLJSDKCoulLong::compute(int eflag, int vflag)
if (evflag) {
if (eflag) {
if (force->newton_pair) eval<1,1,1>();
else eval<1,1,0>();
if (force->newton_pair)
eval<1, 1, 1>();
else
eval<1, 1, 0>();
} else {
if (force->newton_pair) eval<1,0,1>();
else eval<1,0,0>();
if (force->newton_pair)
eval<1, 0, 1>();
else
eval<1, 0, 0>();
}
} else {
if (force->newton_pair) eval<0,0,1>();
else eval<0,0,0>();
if (force->newton_pair)
eval<0, 0, 1>();
else
eval<0, 0, 0>();
}
if (vflag_fdotr) virial_fdotr_compute();
@ -106,8 +111,7 @@ void PairLJSDKCoulLong::compute(int eflag, int vflag)
/* ---------------------------------------------------------------------- */
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
void PairLJSDKCoulLong::eval()
template <int EVFLAG, int EFLAG, int NEWTON_PAIR> void PairLJSDKCoulLong::eval()
{
int i, ii, j, jj, jtype, itable;
double qtmp, xtmp, ytmp, ztmp, delx, dely, delz, evdwl, ecoul, fpair;
@ -185,8 +189,7 @@ void PairLJSDKCoulLong::eval()
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
table = ftable[itable] + fraction * dftable[itable];
forcecoul = qtmp * q[j] * table;
if (EFLAG) ecoul = qtmp*q[j] *
(etable[itable] + fraction*detable[itable]);
if (EFLAG) ecoul = qtmp * q[j] * (etable[itable] + fraction * detable[itable]);
if (factor_coul < 1.0) {
table = ctable[itable] + fraction * dctable[itable];
prefactor = qtmp * q[j] * table;
@ -200,29 +203,26 @@ void PairLJSDKCoulLong::eval()
if (ljt == LJ12_4) {
const double r4inv = r2inv * r2inv;
forcelj = r4inv*(lj1[itype][jtype]*r4inv*r4inv
- lj2[itype][jtype]);
forcelj = r4inv * (lj1[itype][jtype] * r4inv * r4inv - lj2[itype][jtype]);
if (EFLAG)
evdwl = r4inv*(lj3[itype][jtype]*r4inv*r4inv
- lj4[itype][jtype]) - offset[itype][jtype];
evdwl = r4inv * (lj3[itype][jtype] * r4inv * r4inv - lj4[itype][jtype]) -
offset[itype][jtype];
} else if (ljt == LJ9_6) {
const double r3inv = r2inv * sqrt(r2inv);
const double r6inv = r3inv * r3inv;
forcelj = r6inv*(lj1[itype][jtype]*r3inv
- lj2[itype][jtype]);
forcelj = r6inv * (lj1[itype][jtype] * r3inv - lj2[itype][jtype]);
if (EFLAG)
evdwl = r6inv*(lj3[itype][jtype]*r3inv
- lj4[itype][jtype]) - offset[itype][jtype];
evdwl =
r6inv * (lj3[itype][jtype] * r3inv - lj4[itype][jtype]) - offset[itype][jtype];
} else if (ljt == LJ12_6) {
const double r6inv = r2inv * r2inv * r2inv;
forcelj = r6inv*(lj1[itype][jtype]*r6inv
- lj2[itype][jtype]);
forcelj = r6inv * (lj1[itype][jtype] * r6inv - lj2[itype][jtype]);
if (EFLAG)
evdwl = r6inv*(lj3[itype][jtype]*r6inv
- lj4[itype][jtype]) - offset[itype][jtype];
evdwl =
r6inv * (lj3[itype][jtype] * r6inv - lj4[itype][jtype]) - offset[itype][jtype];
}
forcelj *= factor_lj;
if (EFLAG) evdwl *= factor_lj;
@ -239,8 +239,7 @@ void PairLJSDKCoulLong::eval()
f[j][2] -= delz * fpair;
}
if (EVFLAG) ev_tally(i,j,nlocal,NEWTON_PAIR,
evdwl,ecoul,fpair,delx,dely,delz);
if (EVFLAG) ev_tally(i, j, nlocal, NEWTON_PAIR, evdwl, ecoul, fpair, delx, dely, delz);
}
}
f[i][0] += fxtmp;
@ -249,7 +248,6 @@ void PairLJSDKCoulLong::eval()
}
}
/* ----------------------------------------------------------------------
allocate all arrays
------------------------------------------------------------------------- */
@ -257,33 +255,33 @@ void PairLJSDKCoulLong::eval()
void PairLJSDKCoulLong::allocate()
{
allocated = 1;
int n = atom->ntypes;
int np1 = atom->ntypes + 1;
memory->create(setflag,n+1,n+1,"pair:setflag");
memory->create(lj_type,n+1,n+1,"pair:lj_type");
for (int i = 1; i <= n; i++) {
for (int j = i; j <= n; j++) {
memory->create(setflag, np1, np1, "pair:setflag");
memory->create(lj_type, np1, np1, "pair:lj_type");
for (int i = 1; i < np1; i++) {
for (int j = i; j < np1; j++) {
setflag[i][j] = 0;
lj_type[i][j] = LJ_NOT_SET;
}
}
memory->create(cutsq,n+1,n+1,"pair:cutsq");
memory->create(cutsq, np1, np1, "pair:cutsq");
memory->create(cut_lj,n+1,n+1,"pair:cut_lj");
memory->create(cut_ljsq,n+1,n+1,"pair:cut_ljsq");
memory->create(epsilon,n+1,n+1,"pair:epsilon");
memory->create(sigma,n+1,n+1,"pair:sigma");
memory->create(cut_lj, np1, np1, "pair:cut_lj");
memory->create(cut_ljsq, np1, np1, "pair:cut_ljsq");
memory->create(epsilon, np1, np1, "pair:epsilon");
memory->create(sigma, np1, np1, "pair:sigma");
memory->create(lj1,n+1,n+1,"pair:lj1");
memory->create(lj2,n+1,n+1,"pair:lj2");
memory->create(lj3,n+1,n+1,"pair:lj3");
memory->create(lj4,n+1,n+1,"pair:lj4");
memory->create(lj1, np1, np1, "pair:lj1");
memory->create(lj2, np1, np1, "pair:lj2");
memory->create(lj3, np1, np1, "pair:lj3");
memory->create(lj4, np1, np1, "pair:lj4");
memory->create(offset,n+1,n+1,"pair:offset");
memory->create(offset, np1, np1, "pair:offset");
memory->create(rminsq,n+1,n+1,"pair:rminsq");
memory->create(emin,n+1,n+1,"pair:emin");
memory->create(rminsq, np1, np1, "pair:rminsq");
memory->create(emin, np1, np1, "pair:emin");
}
/* ----------------------------------------------------------------------
@ -295,8 +293,10 @@ void PairLJSDKCoulLong::settings(int narg, char **arg)
if (narg < 1 || narg > 2) error->all(FLERR, "Illegal pair_style command");
cut_lj_global = utils::numeric(FLERR, arg[0], false, lmp);
if (narg == 1) cut_coul = cut_lj_global;
else cut_coul = utils::numeric(FLERR,arg[1],false,lmp);
if (narg == 1)
cut_coul = cut_lj_global;
else
cut_coul = utils::numeric(FLERR, arg[1], false, lmp);
// reset cutoffs that have been explicitly set
@ -314,8 +314,7 @@ void PairLJSDKCoulLong::settings(int narg, char **arg)
void PairLJSDKCoulLong::coeff(int narg, char **arg)
{
if (narg < 5 || narg > 6)
error->all(FLERR,"Incorrect args for pair coefficients");
if (narg < 5 || narg > 6) error->all(FLERR, "Incorrect args for pair coefficients");
if (!allocated) allocate();
int ilo, ihi, jlo, jhi;
@ -323,8 +322,7 @@ void PairLJSDKCoulLong::coeff(int narg, char **arg)
utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error);
int lj_type_one = find_lj_type(arg[2], lj_type_list);
if (lj_type_one == LJ_NOT_SET)
error->all(FLERR,"Cannot parse LJ type flag.");
if (lj_type_one == LJ_NOT_SET) error->all(FLERR, "Cannot parse LJ type flag.");
double epsilon_one = utils::numeric(FLERR, arg[3], false, lmp);
double sigma_one = utils::numeric(FLERR, arg[4], false, lmp);
@ -353,17 +351,15 @@ void PairLJSDKCoulLong::coeff(int narg, char **arg)
void PairLJSDKCoulLong::init_style()
{
if (!atom->q_flag)
error->all(FLERR,"Pair style lj/cut/coul/long requires atom attribute q");
if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/coul/long requires atom attribute q");
neighbor->request(this,instance_me);
neighbor->add_request(this);
cut_coulsq = cut_coul * cut_coul;
// insure use of KSpace long-range solver, set g_ewald
if (force->kspace == nullptr)
error->all(FLERR,"Pair style requires a KSpace style");
if (force->kspace == nullptr) error->all(FLERR, "Pair style requires a KSpace style");
g_ewald = force->kspace->g_ewald;
// setup force tables (no rRESPA support yet)
@ -378,29 +374,28 @@ void PairLJSDKCoulLong::init_style()
double PairLJSDKCoulLong::init_one(int i, int j)
{
if (setflag[i][j] == 0)
error->all(FLERR,"No mixing support for lj/sdk/coul/long. "
error->all(FLERR,
"No mixing support for lj/sdk/coul/long. "
"Coefficients for all pairs need to be set explicitly.");
const int ljt = lj_type[i][j];
if (ljt == LJ_NOT_SET)
error->all(FLERR,"unrecognized LJ parameter flag");
if (ljt == LJ_NOT_SET) error->all(FLERR, "unrecognized LJ parameter flag");
double cut = MAX(cut_lj[i][j], cut_coul);
cut_ljsq[i][j] = cut_lj[i][j] * cut_lj[i][j];
lj1[i][j] = lj_prefact[ljt] * lj_pow1[ljt] * epsilon[i][j] *
pow(sigma[i][j],lj_pow1[ljt]);
lj2[i][j] = lj_prefact[ljt] * lj_pow2[ljt] * epsilon[i][j] *
pow(sigma[i][j],lj_pow2[ljt]);
lj1[i][j] = lj_prefact[ljt] * lj_pow1[ljt] * epsilon[i][j] * pow(sigma[i][j], lj_pow1[ljt]);
lj2[i][j] = lj_prefact[ljt] * lj_pow2[ljt] * epsilon[i][j] * pow(sigma[i][j], lj_pow2[ljt]);
lj3[i][j] = lj_prefact[ljt] * epsilon[i][j] * pow(sigma[i][j], lj_pow1[ljt]);
lj4[i][j] = lj_prefact[ljt] * epsilon[i][j] * pow(sigma[i][j], lj_pow2[ljt]);
if (offset_flag && (cut_lj[i][j] > 0.0)) {
double ratio = sigma[i][j] / cut_lj[i][j];
offset[i][j] = lj_prefact[ljt] * epsilon[i][j] *
(pow(ratio,lj_pow1[ljt]) - pow(ratio,lj_pow2[ljt]));
} else offset[i][j] = 0.0;
offset[i][j] =
lj_prefact[ljt] * epsilon[i][j] * (pow(ratio, lj_pow1[ljt]) - pow(ratio, lj_pow2[ljt]));
} else
offset[i][j] = 0.0;
cut_ljsq[j][i] = cut_ljsq[i][j];
cut_lj[j][i] = cut_lj[i][j];
@ -415,20 +410,19 @@ double PairLJSDKCoulLong::init_one(int i, int j)
const double eps = epsilon[i][j];
const double sig = sigma[i][j];
const double rmin = sig*exp(1.0/(lj_pow1[ljt]-lj_pow2[ljt])
*log(lj_pow1[ljt]/lj_pow2[ljt]) );
const double rmin =
sig * exp(1.0 / (lj_pow1[ljt] - lj_pow2[ljt]) * log(lj_pow1[ljt] / lj_pow2[ljt]));
rminsq[j][i] = rminsq[i][j] = rmin * rmin;
const double ratio = sig / rmin;
const double emin_one = lj_prefact[ljt] * eps * (pow(ratio,lj_pow1[ljt])
- pow(ratio,lj_pow2[ljt]));
const double emin_one =
lj_prefact[ljt] * eps * (pow(ratio, lj_pow1[ljt]) - pow(ratio, lj_pow2[ljt]));
emin[j][i] = emin[i][j] = emin_one;
// compute I,J contribution to long-range tail correction
// count total # of atoms of type I and J via Allreduce
if (tail_flag)
error->all(FLERR,"Tail flag not supported by lj/sdk/coul/long pair style");
if (tail_flag) error->all(FLERR, "Tail flag not supported by lj/sdk/coul/long pair style");
return cut;
}
@ -529,7 +523,8 @@ void PairLJSDKCoulLong::read_restart_settings(FILE *fp)
void PairLJSDKCoulLong::write_data(FILE *)
{
error->one(FLERR, "Pair style lj/sdk/coul/* requires using "
error->one(FLERR,
"Pair style lj/sdk/coul/* requires using "
"write_data with the 'pair ij' option");
}
@ -541,16 +536,14 @@ void PairLJSDKCoulLong::write_data_all(FILE *fp)
{
for (int i = 1; i <= atom->ntypes; i++)
for (int j = i; j <= atom->ntypes; j++)
fprintf(fp,"%d %d %s %g %g %g\n",i,j,lj_type_list[lj_type[i][j]],
epsilon[i][j],sigma[i][j],cut_lj[i][j]);
fprintf(fp, "%d %d %s %g %g %g\n", i, j, lj_type_list[lj_type[i][j]], epsilon[i][j],
sigma[i][j], cut_lj[i][j]);
}
/* ---------------------------------------------------------------------- */
double PairLJSDKCoulLong::single(int i, int j, int itype, int jtype,
double rsq,
double factor_coul, double factor_lj,
double &fforce)
double PairLJSDKCoulLong::single(int i, int j, int itype, int jtype, double rsq, double factor_coul,
double factor_lj, double &fforce)
{
double r2inv, r, grij, expm2, t, erfc, prefactor;
double fraction, table, forcecoul, forcelj, phicoul, philj;
@ -597,26 +590,21 @@ double PairLJSDKCoulLong::single(int i, int j, int itype, int jtype,
if (ljt == LJ12_4) {
const double r4inv = r2inv * r2inv;
forcelj = r4inv*(lj1[itype][jtype]*r4inv*r4inv
- lj2[itype][jtype]);
forcelj = r4inv * (lj1[itype][jtype] * r4inv * r4inv - lj2[itype][jtype]);
philj = r4inv*(lj3[itype][jtype]*r4inv*r4inv
- lj4[itype][jtype]) - offset[itype][jtype];
philj =
r4inv * (lj3[itype][jtype] * r4inv * r4inv - lj4[itype][jtype]) - offset[itype][jtype];
} else if (ljt == LJ9_6) {
const double r3inv = r2inv * sqrt(r2inv);
const double r6inv = r3inv * r3inv;
forcelj = r6inv*(lj1[itype][jtype]*r3inv
- lj2[itype][jtype]);
philj = r6inv*(lj3[itype][jtype]*r3inv
- lj4[itype][jtype]) - offset[itype][jtype];
forcelj = r6inv * (lj1[itype][jtype] * r3inv - lj2[itype][jtype]);
philj = r6inv * (lj3[itype][jtype] * r3inv - lj4[itype][jtype]) - offset[itype][jtype];
} else if (ljt == LJ12_6) {
const double r6inv = r2inv * r2inv * r2inv;
forcelj = r6inv*(lj1[itype][jtype]*r6inv
- lj2[itype][jtype]);
philj = r6inv*(lj3[itype][jtype]*r6inv
- lj4[itype][jtype]) - offset[itype][jtype];
forcelj = r6inv * (lj1[itype][jtype] * r6inv - lj2[itype][jtype]);
philj = r6inv * (lj3[itype][jtype] * r6inv - lj4[itype][jtype]) - offset[itype][jtype];
}
forcelj *= factor_lj;
philj *= factor_lj;

View File

@ -1,4 +1,3 @@
// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@ -19,7 +18,6 @@
#include "math_const.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "respa.h"
#include "update.h"
@ -125,13 +123,11 @@ void PairLJClass2::compute(int eflag, int vflag)
}
if (eflag) {
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
offset[itype][jtype];
evdwl = r6inv * (lj3[itype][jtype] * r3inv - lj4[itype][jtype]) - offset[itype][jtype];
evdwl *= factor_lj;
}
if (evflag) ev_tally(i,j,nlocal,newton_pair,
evdwl,0.0,fpair,delx,dely,delz);
if (evflag) ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, fpair, delx, dely, delz);
}
}
}
@ -139,8 +135,7 @@ void PairLJClass2::compute(int eflag, int vflag)
if (vflag_fdotr) virial_fdotr_compute();
}
/* ----------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------- */
void PairLJClass2::compute_inner()
{
@ -380,8 +375,7 @@ void PairLJClass2::compute_outer(int eflag, int vflag)
rinv = sqrt(r2inv);
r3inv = r2inv * rinv;
r6inv = r3inv * r3inv;
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
offset[itype][jtype];
evdwl = r6inv * (lj3[itype][jtype] * r3inv - lj4[itype][jtype]) - offset[itype][jtype];
evdwl *= factor_lj;
}
@ -413,8 +407,7 @@ void PairLJClass2::allocate()
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;
for (int j = i; j <= n; j++) setflag[i][j] = 0;
memory->create(cutsq, n + 1, n + 1, "pair:cutsq");
@ -489,28 +482,22 @@ void PairLJClass2::init_style()
{
// request regular or rRESPA neighbor list
int irequest;
int respa = 0;
int list_style = NeighConst::REQ_DEFAULT;
if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) {
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
auto respa = (Respa *) update->integrate;
if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT;
if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL;
}
irequest = neighbor->request(this,instance_me);
if (respa >= 1) {
neighbor->requests[irequest]->respaouter = 1;
neighbor->requests[irequest]->respainner = 1;
}
if (respa == 2) neighbor->requests[irequest]->respamiddle = 1;
neighbor->add_request(this, list_style);
// set rRESPA cutoffs
if (utils::strmatch(update->integrate_style, "^respa") &&
((Respa *) update->integrate)->level_inner >= 0)
cut_respa = ((Respa *) update->integrate)->cutoff;
else cut_respa = nullptr;
else
cut_respa = nullptr;
}
/* ----------------------------------------------------------------------
@ -523,11 +510,9 @@ double PairLJClass2::init_one(int i, int j)
// mix distance via user-defined rule
if (setflag[i][j] == 0) {
epsilon[i][j] = 2.0 * sqrt(epsilon[i][i]*epsilon[j][j]) *
pow(sigma[i][i],3.0) * pow(sigma[j][j],3.0) /
(pow(sigma[i][i],6.0) + pow(sigma[j][j],6.0));
sigma[i][j] =
pow((0.5 * (pow(sigma[i][i],6.0) + pow(sigma[j][j],6.0))),1.0/6.0);
epsilon[i][j] = 2.0 * sqrt(epsilon[i][i] * epsilon[j][j]) * pow(sigma[i][i], 3.0) *
pow(sigma[j][j], 3.0) / (pow(sigma[i][i], 6.0) + pow(sigma[j][j], 6.0));
sigma[i][j] = pow((0.5 * (pow(sigma[i][i], 6.0) + pow(sigma[j][j], 6.0))), 1.0 / 6.0);
cut[i][j] = mix_distance(cut[i][i], cut[j][j]);
}
@ -539,7 +524,8 @@ double PairLJClass2::init_one(int i, int j)
if (offset_flag && (cut[i][j] > 0.0)) {
double ratio = sigma[i][j] / cut[i][j];
offset[i][j] = epsilon[i][j] * (2.0 * pow(ratio, 9.0) - 3.0 * pow(ratio, 6.0));
} else offset[i][j] = 0.0;
} else
offset[i][j] = 0.0;
lj1[j][i] = lj1[i][j];
lj2[j][i] = lj2[i][j];
@ -571,10 +557,9 @@ double PairLJClass2::init_one(int i, int j)
double sig6 = sig3 * sig3;
double rc3 = cut[i][j] * cut[i][j] * cut[i][j];
double rc6 = rc3 * rc3;
etail_ij = 2.0*MY_PI*all[0]*all[1]*epsilon[i][j] *
sig6 * (sig3 - 3.0*rc3) / (3.0*rc6);
ptail_ij = 2.0*MY_PI*all[0]*all[1]*epsilon[i][j] *
sig6 * (sig3 - 2.0*rc3) / rc6;
etail_ij =
2.0 * MY_PI * all[0] * all[1] * epsilon[i][j] * sig6 * (sig3 - 3.0 * rc3) / (3.0 * rc6);
ptail_ij = 2.0 * MY_PI * all[0] * all[1] * epsilon[i][j] * sig6 * (sig3 - 2.0 * rc3) / rc6;
}
return cut[i][j];
@ -659,15 +644,13 @@ void PairLJClass2::read_restart_settings(FILE *fp)
MPI_Bcast(&tail_flag, 1, MPI_INT, 0, world);
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
void PairLJClass2::write_data(FILE *fp)
{
for (int i = 1; i <= atom->ntypes; i++)
fprintf(fp,"%d %g %g\n",i,epsilon[i][i],sigma[i][i]);
for (int i = 1; i <= atom->ntypes; i++) fprintf(fp, "%d %g %g\n", i, epsilon[i][i], sigma[i][i]);
}
/* ----------------------------------------------------------------------
@ -684,8 +667,7 @@ void PairLJClass2::write_data_all(FILE *fp)
/* ---------------------------------------------------------------------- */
double PairLJClass2::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq,
double /*factor_coul*/, double factor_lj,
double &fforce)
double /*factor_coul*/, double factor_lj, double &fforce)
{
double r2inv, rinv, r3inv, r6inv, forcelj, philj;
@ -696,8 +678,7 @@ double PairLJClass2::single(int /*i*/, int /*j*/, int itype, int jtype, double r
forcelj = r6inv * (lj1[itype][jtype] * r3inv - lj2[itype][jtype]);
fforce = factor_lj * forcelj * r2inv;
philj = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
offset[itype][jtype];
philj = r6inv * (lj3[itype][jtype] * r3inv - lj4[itype][jtype]) - offset[itype][jtype];
return factor_lj * philj;
}

View File

@ -1,4 +1,3 @@
// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@ -14,8 +13,6 @@
#include "pair_lj_class2_coul_cut.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "comm.h"
#include "force.h"
@ -25,6 +22,8 @@
#include "memory.h"
#include "error.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;
@ -259,7 +258,7 @@ void PairLJClass2CoulCut::init_style()
if (!atom->q_flag)
error->all(FLERR,"Pair style lj/class2/coul/cut requires atom attribute q");
neighbor->request(this,instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -1,4 +1,3 @@
// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@ -14,21 +13,20 @@
#include "pair_lj_class2_coul_long.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "comm.h"
#include "error.h"
#include "force.h"
#include "kspace.h"
#include "update.h"
#include "respa.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "math_const.h"
#include "memory.h"
#include "error.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "respa.h"
#include "update.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;
@ -156,14 +154,16 @@ void PairLJClass2CoulLong::compute(int eflag, int vflag)
forcecoul -= (1.0 - factor_coul) * prefactor;
}
}
} else forcecoul = 0.0;
} else
forcecoul = 0.0;
if (rsq < cut_ljsq[itype][jtype]) {
rinv = sqrt(r2inv);
r3inv = r2inv * rinv;
r6inv = r3inv * r3inv;
forcelj = r6inv * (lj1[itype][jtype] * r3inv - lj2[itype][jtype]);
} else forcelj = 0.0;
} else
forcelj = 0.0;
fpair = (forcecoul + factor_lj * forcelj) * r2inv;
@ -185,16 +185,16 @@ void PairLJClass2CoulLong::compute(int eflag, int vflag)
ecoul = qtmp * q[j] * table;
}
if (factor_coul < 1.0) ecoul -= (1.0 - factor_coul) * prefactor;
} else ecoul = 0.0;
} else
ecoul = 0.0;
if (rsq < cut_ljsq[itype][jtype]) {
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
offset[itype][jtype];
evdwl = r6inv * (lj3[itype][jtype] * r3inv - lj4[itype][jtype]) - offset[itype][jtype];
evdwl *= factor_lj;
} else evdwl = 0.0;
} else
evdwl = 0.0;
}
if (evflag) ev_tally(i,j,nlocal,newton_pair,
evdwl,ecoul,fpair,delx,dely,delz);
if (evflag) ev_tally(i, j, nlocal, newton_pair, evdwl, ecoul, fpair, delx, dely, delz);
}
}
}
@ -268,7 +268,8 @@ void PairLJClass2CoulLong::compute_inner()
r3inv = r2inv * rinv;
r6inv = r3inv * r3inv;
forcelj = r6inv * (lj1[itype][jtype] * r3inv - lj2[itype][jtype]);
} else forcelj = 0.0;
} else
forcelj = 0.0;
fpair = (forcecoul + factor_lj * forcelj) * r2inv;
if (rsq > cut_out_on_sq) {
@ -360,7 +361,8 @@ void PairLJClass2CoulLong::compute_middle()
r3inv = r2inv * rinv;
r6inv = r3inv * r3inv;
forcelj = r6inv * (lj1[itype][jtype] * r3inv - lj2[itype][jtype]);
} else forcelj = 0.0;
} else
forcelj = 0.0;
fpair = (forcecoul + factor_lj * forcelj) * r2inv;
if (rsq < cut_in_on_sq) {
@ -464,12 +466,10 @@ void PairLJClass2CoulLong::compute_outer(int eflag, int vflag)
rsw = (r - cut_in_off) / cut_in_diff;
forcecoul += prefactor * rsw * rsw * (3.0 - 2.0 * rsw);
if (factor_coul < 1.0)
forcecoul -=
(1.0-factor_coul)*prefactor*rsw*rsw*(3.0 - 2.0*rsw);
forcecoul -= (1.0 - factor_coul) * prefactor * rsw * rsw * (3.0 - 2.0 * rsw);
} else {
forcecoul += prefactor;
if (factor_coul < 1.0)
forcecoul -= (1.0-factor_coul)*prefactor;
if (factor_coul < 1.0) forcecoul -= (1.0 - factor_coul) * prefactor;
}
}
} else {
@ -486,7 +486,8 @@ void PairLJClass2CoulLong::compute_outer(int eflag, int vflag)
forcecoul -= (1.0 - factor_coul) * prefactor;
}
}
} else forcecoul = 0.0;
} else
forcecoul = 0.0;
if (rsq < cut_ljsq[itype][jtype] && rsq > cut_in_off_sq) {
rinv = sqrt(r2inv);
@ -497,7 +498,8 @@ void PairLJClass2CoulLong::compute_outer(int eflag, int vflag)
rsw = (sqrt(rsq) - cut_in_off) / cut_in_diff;
forcelj *= rsw * rsw * (3.0 - 2.0 * rsw);
}
} else forcelj = 0.0;
} else
forcelj = 0.0;
fpair = (forcecoul + forcelj) * r2inv;
@ -524,16 +526,17 @@ void PairLJClass2CoulLong::compute_outer(int eflag, int vflag)
ecoul -= (1.0 - factor_coul) * prefactor;
}
}
} else ecoul = 0.0;
} else
ecoul = 0.0;
if (rsq < cut_ljsq[itype][jtype]) {
rinv = sqrt(r2inv);
r3inv = r2inv * rinv;
r6inv = r3inv * r3inv;
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
offset[itype][jtype];
evdwl = r6inv * (lj3[itype][jtype] * r3inv - lj4[itype][jtype]) - offset[itype][jtype];
evdwl *= factor_lj;
} else evdwl = 0.0;
} else
evdwl = 0.0;
}
if (vflag) {
@ -550,7 +553,8 @@ void PairLJClass2CoulLong::compute_outer(int eflag, int vflag)
forcecoul -= (1.0 - factor_coul) * prefactor;
}
}
} else forcecoul = 0.0;
} else
forcecoul = 0.0;
if (rsq <= cut_in_off_sq) {
rinv = sqrt(r2inv);
@ -566,8 +570,7 @@ void PairLJClass2CoulLong::compute_outer(int eflag, int vflag)
fpair = (forcecoul + factor_lj * forcelj) * r2inv;
}
if (evflag) ev_tally(i,j,nlocal,newton_pair,
evdwl,ecoul,fpair,delx,dely,delz);
if (evflag) ev_tally(i, j, nlocal, newton_pair, evdwl, ecoul, fpair, delx, dely, delz);
}
}
}
@ -584,8 +587,7 @@ void PairLJClass2CoulLong::allocate()
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;
for (int j = i; j <= n; j++) setflag[i][j] = 0;
memory->create(cutsq, n + 1, n + 1, "pair:cutsq");
@ -609,8 +611,10 @@ void PairLJClass2CoulLong::settings(int narg, char **arg)
if (narg < 1 || narg > 2) error->all(FLERR, "Illegal pair_style command");
cut_lj_global = utils::numeric(FLERR, arg[0], false, lmp);
if (narg == 1) cut_coul = cut_lj_global;
else cut_coul = utils::numeric(FLERR,arg[1],false,lmp);
if (narg == 1)
cut_coul = cut_lj_global;
else
cut_coul = utils::numeric(FLERR, arg[1], false, lmp);
// reset cutoffs that have been explicitly set
@ -628,8 +632,7 @@ void PairLJClass2CoulLong::settings(int narg, char **arg)
void PairLJClass2CoulLong::coeff(int narg, char **arg)
{
if (narg < 4 || narg > 5)
error->all(FLERR,"Incorrect args for pair coefficients");
if (narg < 4 || narg > 5) error->all(FLERR, "Incorrect args for pair coefficients");
if (!allocated) allocate();
@ -663,27 +666,18 @@ void PairLJClass2CoulLong::coeff(int narg, char **arg)
void PairLJClass2CoulLong::init_style()
{
if (!atom->q_flag)
error->all(FLERR,
"Pair style lj/class2/coul/long requires atom attribute q");
if (!atom->q_flag) error->all(FLERR, "Pair style lj/class2/coul/long requires atom attribute q");
// request regular or rRESPA neighbor list
int irequest;
int respa = 0;
int list_style = NeighConst::REQ_DEFAULT;
if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) {
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
auto respa = (Respa *) update->integrate;
if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT;
if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL;
}
irequest = neighbor->request(this,instance_me);
if (respa >= 1) {
neighbor->requests[irequest]->respaouter = 1;
neighbor->requests[irequest]->respainner = 1;
}
if (respa == 2) neighbor->requests[irequest]->respamiddle = 1;
neighbor->add_request(this, list_style);
cut_coulsq = cut_coul * cut_coul;
@ -692,12 +686,12 @@ void PairLJClass2CoulLong::init_style()
if (utils::strmatch(update->integrate_style, "^respa") &&
((Respa *) update->integrate)->level_inner >= 0)
cut_respa = ((Respa *) update->integrate)->cutoff;
else cut_respa = nullptr;
else
cut_respa = nullptr;
// insure use of KSpace long-range solver, set g_ewald
if (force->kspace == nullptr)
error->all(FLERR,"Pair style requires a KSpace style");
if (force->kspace == nullptr) error->all(FLERR, "Pair style requires a KSpace style");
g_ewald = force->kspace->g_ewald;
// setup force tables
@ -714,11 +708,9 @@ double PairLJClass2CoulLong::init_one(int i, int j)
// mix distance via user-defined rule
if (setflag[i][j] == 0) {
epsilon[i][j] = 2.0 * sqrt(epsilon[i][i]*epsilon[j][j]) *
pow(sigma[i][i],3.0) * pow(sigma[j][j],3.0) /
(pow(sigma[i][i],6.0) + pow(sigma[j][j],6.0));
sigma[i][j] =
pow((0.5 * (pow(sigma[i][i],6.0) + pow(sigma[j][j],6.0))),1.0/6.0);
epsilon[i][j] = 2.0 * sqrt(epsilon[i][i] * epsilon[j][j]) * pow(sigma[i][i], 3.0) *
pow(sigma[j][j], 3.0) / (pow(sigma[i][i], 6.0) + pow(sigma[j][j], 6.0));
sigma[i][j] = pow((0.5 * (pow(sigma[i][i], 6.0) + pow(sigma[j][j], 6.0))), 1.0 / 6.0);
cut_lj[i][j] = mix_distance(cut_lj[i][i], cut_lj[j][j]);
}
@ -733,7 +725,8 @@ double PairLJClass2CoulLong::init_one(int i, int j)
if (offset_flag && (cut_lj[i][j] > 0.0)) {
double ratio = sigma[i][j] / cut_lj[i][j];
offset[i][j] = epsilon[i][j] * (2.0 * pow(ratio, 9.0) - 3.0 * pow(ratio, 6.0));
} else offset[i][j] = 0.0;
} else
offset[i][j] = 0.0;
cut_ljsq[j][i] = cut_ljsq[i][j];
lj1[j][i] = lj1[i][j];
@ -766,10 +759,9 @@ double PairLJClass2CoulLong::init_one(int i, int j)
double sig6 = sig3 * sig3;
double rc3 = cut_lj[i][j] * cut_lj[i][j] * cut_lj[i][j];
double rc6 = rc3 * rc3;
etail_ij = 2.0*MY_PI*all[0]*all[1]*epsilon[i][j] *
sig6 * (sig3 - 3.0*rc3) / (3.0*rc6);
ptail_ij = 2.0*MY_PI*all[0]*all[1]*epsilon[i][j] *
sig6 * (sig3 - 2.0*rc3) / rc6;
etail_ij =
2.0 * MY_PI * all[0] * all[1] * epsilon[i][j] * sig6 * (sig3 - 3.0 * rc3) / (3.0 * rc6);
ptail_ij = 2.0 * MY_PI * all[0] * all[1] * epsilon[i][j] * sig6 * (sig3 - 2.0 * rc3) / rc6;
}
return cut;
@ -868,8 +860,7 @@ void PairLJClass2CoulLong::read_restart_settings(FILE *fp)
void PairLJClass2CoulLong::write_data(FILE *fp)
{
for (int i = 1; i <= atom->ntypes; i++)
fprintf(fp,"%d %g %g\n",i,epsilon[i][i],sigma[i][i]);
for (int i = 1; i <= atom->ntypes; i++) fprintf(fp, "%d %g %g\n", i, epsilon[i][i], sigma[i][i]);
}
/* ----------------------------------------------------------------------
@ -885,10 +876,8 @@ void PairLJClass2CoulLong::write_data_all(FILE *fp)
/* ---------------------------------------------------------------------- */
double PairLJClass2CoulLong::single(int i, int j, int itype, int jtype,
double rsq,
double factor_coul, double factor_lj,
double &fforce)
double PairLJClass2CoulLong::single(int i, int j, int itype, int jtype, double rsq,
double factor_coul, double factor_lj, double &fforce)
{
double r2inv, r, rinv, r3inv, r6inv, grij, expm2, t, erfc, prefactor;
double fraction, table, forcecoul, forcelj, phicoul, philj;
@ -919,13 +908,15 @@ double PairLJClass2CoulLong::single(int i, int j, int itype, int jtype,
forcecoul -= (1.0 - factor_coul) * prefactor;
}
}
} else forcecoul = 0.0;
} else
forcecoul = 0.0;
if (rsq < cut_ljsq[itype][jtype]) {
rinv = sqrt(r2inv);
r3inv = r2inv * rinv;
r6inv = r3inv * r3inv;
forcelj = r6inv * (lj1[itype][jtype] * r3inv - lj2[itype][jtype]);
} else forcelj = 0.0;
} else
forcelj = 0.0;
fforce = (forcecoul + factor_lj * forcelj) * r2inv;
double eng = 0.0;
@ -940,8 +931,7 @@ double PairLJClass2CoulLong::single(int i, int j, int itype, int jtype,
eng += phicoul;
}
if (rsq < cut_ljsq[itype][jtype]) {
philj = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
offset[itype][jtype];
philj = r6inv * (lj3[itype][jtype] * r3inv - lj4[itype][jtype]) - offset[itype][jtype];
eng += factor_lj * philj;
}

View File

@ -1,4 +1,3 @@
// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@ -18,26 +17,26 @@
#include "pair_brownian.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "domain.h"
#include "update.h"
#include "modify.h"
#include "error.h"
#include "fix.h"
#include "fix_wall.h"
#include "force.h"
#include "input.h"
#include "variable.h"
#include "random_mars.h"
#include "math_const.h"
#include "math_special.h"
#include "memory.h"
#include "error.h"
#include "modify.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "random_mars.h"
#include "update.h"
#include "variable.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;
@ -102,8 +101,7 @@ void PairBrownian::compute(int eflag, int vflag)
if (flagVF) // Flag for volume fraction corrections
if (flagdeform || flagwall == 2) { // Possible changes in volume fraction
if (flagdeform && !flagwall)
for (j = 0; j < 3; j++)
dims[j] = domain->prd[j];
for (j = 0; j < 3; j++) dims[j] = domain->prd[j];
else if (flagwall == 2 || (flagdeform && flagwall == 1)) {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++) {
@ -115,13 +113,14 @@ void PairBrownian::compute(int eflag, int vflag)
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE) {
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
} else
wallcoord = wallfix->coord0[m];
if (side == 0)
walllo[dim] = wallcoord;
else
wallhi[dim] = wallcoord;
}
else wallcoord = wallfix->coord0[m];
if (side == 0) walllo[dim] = wallcoord;
else wallhi[dim] = wallcoord;
}
for (int j = 0; j < 3; j++)
dims[j] = wallhi[j] - walllo[j];
for (int j = 0; j < 3; j++) dims[j] = wallhi[j] - walllo[j];
}
double vol_T = dims[0] * dims[1] * dims[2];
double vol_f = vol_P / vol_T;
@ -194,8 +193,7 @@ void PairBrownian::compute(int eflag, int vflag)
// if less than minimum gap, use minimum gap instead
if (r < cut_inner[itype][jtype])
h_sep = cut_inner[itype][jtype] - 2.0*radi;
if (r < cut_inner[itype][jtype]) h_sep = cut_inner[itype][jtype] - 2.0 * radi;
// scale h_sep by radi
@ -230,7 +228,9 @@ void PairBrownian::compute(int eflag, int vflag)
// generate two orthogonal vectors to the line of centers
p1[0] = delx/r; p1[1] = dely/r; p1[2] = delz/r;
p1[0] = delx / r;
p1[1] = dely / r;
p1[2] = delz / r;
set_3_orthogonal_vectors(p1, p2, p3);
// magnitude
@ -330,15 +330,14 @@ void PairBrownian::compute(int eflag, int vflag)
}
}
if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair,
0.0,0.0,-fx,-fy,-fz,delx,dely,delz);
if (evflag)
ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, -fx, -fy, -fz, delx, dely, delz);
}
}
}
int print_overlaps = 0;
if (print_overlaps && overlaps)
printf("Number of overlaps=%d\n",overlaps);
if (print_overlaps && overlaps) printf("Number of overlaps=%d\n", overlaps);
if (vflag_fdotr) virial_fdotr_compute();
}
@ -350,17 +349,16 @@ void PairBrownian::compute(int eflag, int vflag)
void PairBrownian::allocate()
{
allocated = 1;
int n = atom->ntypes;
int np1 = atom->ntypes + 1;
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(setflag, np1, np1, "pair:setflag");
for (int i = 1; i < np1; i++)
for (int j = i; j < np1; j++) setflag[i][j] = 0;
memory->create(cutsq,n+1,n+1,"pair:cutsq");
memory->create(cutsq, np1, np1, "pair:cutsq");
memory->create(cut,n+1,n+1,"pair:cut");
memory->create(cut_inner,n+1,n+1,"pair:cut_inner");
memory->create(cut, np1, np1, "pair:cut");
memory->create(cut_inner, np1, np1, "pair:cut_inner");
}
/* ----------------------------------------------------------------------
@ -386,7 +384,8 @@ void PairBrownian::settings(int narg, char **arg)
}
if (flaglog == 1 && flagHI == 0) {
error->warning(FLERR,"Cannot include log terms without 1/r terms; "
error->warning(FLERR,
"Cannot include log terms without 1/r terms; "
"setting flagHI to 1");
flagHI = 1;
}
@ -414,8 +413,7 @@ void PairBrownian::settings(int narg, char **arg)
void PairBrownian::coeff(int narg, char **arg)
{
if (narg != 2 && narg != 4)
error->all(FLERR,"Incorrect args for pair coefficients");
if (narg != 2 && narg != 4) error->all(FLERR, "Incorrect args for pair coefficients");
if (!allocated) allocate();
@ -449,18 +447,15 @@ void PairBrownian::coeff(int narg, char **arg)
void PairBrownian::init_style()
{
if (!atom->sphere_flag)
error->all(FLERR,"Pair brownian requires atom style sphere");
if (!atom->sphere_flag) error->all(FLERR, "Pair brownian requires atom style sphere");
// if newton off, forces between atoms ij will be double computed
// using different random numbers
if (force->newton_pair == 0 && comm->me == 0)
error->warning(FLERR,
"Pair brownian needs newton pair on for "
"momentum conservation");
error->warning(FLERR, "Pair brownian needs newton pair on for momentum conservation");
neighbor->request(this,instance_me);
neighbor->add_request(this);
// insure all particles are finite-size
// for pair hybrid, should limit test to types using the pair style
@ -469,8 +464,7 @@ void PairBrownian::init_style()
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++)
if (radius[i] == 0.0)
error->one(FLERR,"Pair brownian requires extended particles");
if (radius[i] == 0.0) error->one(FLERR, "Pair brownian requires extended particles");
// require monodisperse system with same radii for all types
@ -478,8 +472,7 @@ void PairBrownian::init_style()
for (int i = 1; i <= atom->ntypes; i++) {
if (!atom->radius_consistency(i, radtype))
error->all(FLERR, "Pair brownian requires monodisperse particles");
if (i > 1 && radtype != rad)
error->all(FLERR,"Pair brownian requires monodisperse particles");
if (i > 1 && radtype != rad) error->all(FLERR, "Pair brownian requires monodisperse particles");
rad = radtype;
}
@ -499,9 +492,7 @@ void PairBrownian::init_style()
if (strcmp(modify->fix[i]->style, "deform") == 0)
flagdeform = 1;
else if (strstr(modify->fix[i]->style, "wall") != nullptr) {
if (flagwall)
error->all(FLERR,
"Cannot use multiple fix wall commands with pair brownian");
if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair brownian");
flagwall = 1; // Walls exist
wallfix = (FixWall *) modify->fix[i];
if (wallfix->xflag) flagwall = 2; // Moving walls exist
@ -512,7 +503,8 @@ void PairBrownian::init_style()
// vol_T = total volumeshearing = flagdeform = flagwall = 0;
double vol_T, wallcoord;
if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd;
if (!flagwall)
vol_T = domain->xprd * domain->yprd * domain->zprd;
else {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++) {
@ -528,13 +520,15 @@ void PairBrownian::init_style()
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
else
wallcoord = wallfix->coord0[m];
if (side == 0) walllo[dim] = wallcoord;
else wallhi[dim] = wallcoord;
if (side == 0)
walllo[dim] = wallcoord;
else
wallhi[dim] = wallcoord;
}
vol_T = (wallhi[0] - walllo[0]) * (wallhi[1] - walllo[1]) *
(wallhi[2] - walllo[2]);
vol_T = (wallhi[0] - walllo[0]) * (wallhi[1] - walllo[1]) * (wallhi[2] - walllo[2]);
}
// vol_P = volume of particles, assuming mono-dispersity
@ -676,8 +670,7 @@ void PairBrownian::read_restart_settings(FILE *fp)
/* ----------------------------------------------------------------------*/
void PairBrownian::set_3_orthogonal_vectors(double p1[3],
double p2[3], double p3[3])
void PairBrownian::set_3_orthogonal_vectors(double p1[3], double p2[3], double p3[3])
{
double norm;
int ix, iy, iz;

View File

@ -19,24 +19,24 @@
#include "pair_brownian_poly.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "domain.h"
#include "update.h"
#include "modify.h"
#include "error.h"
#include "fix.h"
#include "fix_wall.h"
#include "force.h"
#include "input.h"
#include "variable.h"
#include "random_mars.h"
#include "math_const.h"
#include "math_special.h"
#include "error.h"
#include "modify.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "random_mars.h"
#include "update.h"
#include "variable.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;
@ -340,9 +340,7 @@ void PairBrownianPoly::init_style()
if (radius[i] == 0.0)
error->one(FLERR,"Pair brownian/poly requires extended particles");
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
// set the isotropic constants that depend on the volume fraction
// vol_T = total volume

View File

@ -18,7 +18,6 @@
#include "pair_colloid.h"
#include <cmath>
#include "atom.h"
#include "comm.h"
#include "force.h"
@ -27,6 +26,7 @@
#include "memory.h"
#include "error.h"
#include <cmath>
using namespace LAMMPS_NS;
using namespace MathSpecial;

View File

@ -19,24 +19,24 @@
#include "pair_lubricate.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "domain.h"
#include "modify.h"
#include "error.h"
#include "fix.h"
#include "fix_deform.h"
#include "fix_wall.h"
#include "force.h"
#include "input.h"
#include "variable.h"
#include "math_const.h"
#include "memory.h"
#include "error.h"
#include "modify.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "variable.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;
@ -536,7 +536,7 @@ void PairLubricate::init_style()
if (comm->ghost_velocity == 0)
error->all(FLERR,"Pair lubricate requires ghost atoms store velocity");
neighbor->request(this,instance_me);
neighbor->add_request(this);
// require that atom radii are identical within each type
// require monodisperse system with same radii for all types

View File

@ -18,24 +18,24 @@
#include "pair_lubricateU.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "domain.h"
#include "update.h"
#include "math_const.h"
#include "modify.h"
#include "error.h"
#include "fix.h"
#include "fix_wall.h"
#include "force.h"
#include "input.h"
#include "variable.h"
#include "math_const.h"
#include "memory.h"
#include "error.h"
#include "modify.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "update.h"
#include "variable.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;
@ -1769,7 +1769,7 @@ void PairLubricateU::init_style()
if (comm->ghost_velocity == 0)
error->all(FLERR,"Pair lubricateU requires ghost atoms store velocity");
neighbor->request(this,instance_me);
neighbor->add_request(this);
// require that atom radii are identical within each type
// require monodisperse system with same radii for all types

View File

@ -20,23 +20,23 @@
#include "pair_lubricateU_poly.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "domain.h"
#include "modify.h"
#include "error.h"
#include "fix.h"
#include "fix_wall.h"
#include "force.h"
#include "input.h"
#include "variable.h"
#include "math_const.h"
#include "memory.h"
#include "error.h"
#include "modify.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "variable.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;
@ -1235,7 +1235,5 @@ void PairLubricateUPoly::init_style()
RS0 = 20.0/3.0*MY_PI*mu*(1.0 + 3.64*vol_f - 6.95*vol_f*vol_f);
}
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

@ -20,23 +20,23 @@
#include "pair_lubricate_poly.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "domain.h"
#include "modify.h"
#include "error.h"
#include "fix.h"
#include "fix_deform.h"
#include "fix_wall.h"
#include "force.h"
#include "input.h"
#include "variable.h"
#include "math_const.h"
#include "error.h"
#include "modify.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "variable.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;
@ -445,9 +445,7 @@ void PairLubricatePoly::init_style()
if (radius[i] == 0.0)
error->one(FLERR,"Pair lubricate/poly requires extended particles");
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
// set the isotropic constants that depend on the volume fraction
// vol_T = total volume

View File

@ -124,14 +124,13 @@ void PairYukawaColloid::init_style()
if (!atom->sphere_flag)
error->all(FLERR,"Pair yukawa/colloid requires atom style sphere");
neighbor->request(this,instance_me);
neighbor->add_request(this);
// require that atom radii are identical within each type
for (int i = 1; i <= atom->ntypes; i++)
if (!atom->radius_consistency(i,rad[i]))
error->all(FLERR,"Pair yukawa/colloid requires atoms with same type "
"have same radius");
error->all(FLERR,"Pair yukawa/colloid requires atoms with same type have same radius");
}
/* ----------------------------------------------------------------------

View File

@ -40,7 +40,6 @@
#include "memory.h"
#include "msm_dielectric.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "pair_coul_cut_dielectric.h"
#include "pair_coul_long_dielectric.h"
@ -265,12 +264,7 @@ void FixPolarizeFunctional::init()
// need a full neighbor list w/ Newton off and ghost neighbors
// built whenever re-neighboring occurs
int irequest = neighbor->request(this, instance_me);
neighbor->requests[irequest]->pair = 0;
neighbor->requests[irequest]->fix = 1;
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->requests[irequest]->occasional = 0;
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL);
if (force->kspace)
g_ewald = force->kspace->g_ewald;

View File

@ -24,7 +24,6 @@
#include "math_const.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include <cmath>
@ -166,9 +165,7 @@ void PairCoulCutDielectric::init_style()
avec = (AtomVecDielectric *) atom->style_match("dielectric");
if (!avec) error->all(FLERR, "Pair coul/cut/dielectric requires atom style dielectric");
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

@ -25,7 +25,6 @@
#include "math_const.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include <cmath>
@ -211,9 +210,7 @@ void PairCoulLongDielectric::init_style()
avec = (AtomVecDielectric *) atom->style_match("dielectric");
if (!avec) error->all(FLERR, "Pair coul/long/dielectric requires atom style dielectric");
int irequest = neighbor->request(this, instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
cut_coulsq = cut_coul * cut_coul;

View File

@ -24,7 +24,6 @@
#include "math_const.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include <cmath>
@ -194,9 +193,7 @@ void PairLJCutCoulCutDielectric::init_style()
avec = (AtomVecDielectric *) atom->style_match("dielectric");
if (!avec) error->all(FLERR, "Pair lj/cut/coul/cut/dielectric requires atom style dielectric");
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 "math_const.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include <cmath>
@ -198,9 +197,7 @@ void PairLJCutCoulDebyeDielectric::init_style()
avec = (AtomVecDielectric *) atom->style_match("dielectric");
if (!avec) error->all(FLERR, "Pair lj/cut/coul/debye/dielectric requires atom style dielectric");
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

@ -25,7 +25,6 @@
#include "math_const.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include <cmath>
@ -248,9 +247,7 @@ void PairLJCutCoulLongDielectric::init_style()
avec = (AtomVecDielectric *) atom->style_match("dielectric");
if (!avec) error->all(FLERR, "Pair lj/cut/coul/long/dielectric requires atom style dielectric");
int irequest = neighbor->request(this, instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
cut_coulsq = cut_coul * cut_coul;

View File

@ -25,7 +25,6 @@
#include "math_const.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include <cmath>
@ -356,9 +355,7 @@ void PairLJCutCoulMSMDielectric::init_style()
avec = (AtomVecDielectric *) atom->style_match("dielectric");
if (!avec) error->all(FLERR, "Pair lj/cut/coul/msm/dielectric requires atom style dielectric");
int irequest = neighbor->request(this, instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->add_request(this, NeighConst::REQ_FULL);
cut_coulsq = cut_coul * cut_coul;

View File

@ -25,7 +25,6 @@
#include "math_extra.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include <cmath>
@ -75,9 +74,7 @@ void PairLJLongCoulLongDielectric::init_style()
avec = (AtomVecDielectric *) atom->style_match("dielectric");
if (!avec) error->all(FLERR, "Pair lj/long/coul/long/dielectric requires atom style dielectric");
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

@ -14,17 +14,17 @@
#include "pair_lj_cut_dipole_cut.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "comm.h"
#include "error.h"
#include "force.h"
#include "memory.h"
#include "error.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "update.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
@ -362,7 +362,7 @@ void PairLJCutDipoleCut::init_style()
if (!atom->q_flag || !atom->mu_flag || !atom->torque_flag)
error->all(FLERR,"Pair dipole/cut requires atom attributes q, mu, torque");
neighbor->request(this,instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -14,19 +14,19 @@
#include "pair_lj_cut_dipole_long.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "comm.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "error.h"
#include "force.h"
#include "kspace.h"
#include "math_const.h"
#include "memory.h"
#include "error.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "update.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;
@ -454,7 +454,7 @@ void PairLJCutDipoleLong::init_style()
cut_coulsq = cut_coul * cut_coul;
neighbor->request(this,instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -235,7 +235,7 @@ void PairLJLongDipoleLong::init_style()
if (!atom->mu_flag || !atom->torque_flag)
error->all(FLERR,"Pair lj/long/dipole/long requires atom attributes mu, torque");
neighbor->request(this,instance_me);
neighbor->add_request(this);
cut_coulsq = cut_coul * cut_coul;

View File

@ -37,12 +37,6 @@ static int warn_single = 0;
/* ---------------------------------------------------------------------- */
PairLJSFDipoleSF::PairLJSFDipoleSF(LAMMPS *lmp) : Pair(lmp)
{
}
/* ---------------------------------------------------------------------- */
PairLJSFDipoleSF::~PairLJSFDipoleSF()
{
if (allocated) {
@ -418,7 +412,7 @@ void PairLJSFDipoleSF::init_style()
if (!atom->q_flag || !atom->mu_flag || !atom->torque_flag)
error->all(FLERR,"Pair dipole/sf requires atom attributes q, mu, torque");
neighbor->request(this,instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -26,7 +26,7 @@ namespace LAMMPS_NS {
class PairLJSFDipoleSF : public Pair {
public:
PairLJSFDipoleSF(class LAMMPS *);
PairLJSFDipoleSF(class LAMMPS *_lmp) : Pair(_lmp) {};
~PairLJSFDipoleSF() override;
void compute(int, int) override;
void settings(int, char **) override;

View File

@ -18,17 +18,17 @@
#include "pair_dpd.h"
#include <cmath>
#include "atom.h"
#include "comm.h"
#include "update.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "random_mars.h"
#include "memory.h"
#include "error.h"
#include "force.h"
#include "memory.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "random_mars.h"
#include "update.h"
#include <cmath>
using namespace LAMMPS_NS;
@ -257,10 +257,10 @@ void PairDPD::init_style()
// if newton off, forces between atoms ij will be double computed
// using different random numbers
if (force->newton_pair == 0 && comm->me == 0) error->warning(FLERR,
"Pair dpd needs newton pair on for momentum conservation");
if (force->newton_pair == 0 && comm->me == 0)
error->warning(FLERR, "Pair dpd needs newton pair on for momentum conservation");
neighbor->request(this,instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -326,10 +326,10 @@ void PairDPDExt::init_style()
// if newton off, forces between atoms ij will be double computed
// using different random numbers
if (force->newton_pair == 0 && comm->me == 0) error->warning(FLERR,
"Pair dpd needs newton pair on for momentum conservation");
if (force->newton_pair == 0 && comm->me == 0)
error->warning(FLERR, "Pair dpd needs newton pair on for momentum conservation");
neighbor->request(this,instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -14,15 +14,15 @@
#include "pair_dpd_tstat.h"
#include <cmath>
#include "atom.h"
#include "update.h"
#include "comm.h"
#include "error.h"
#include "force.h"
#include "neigh_list.h"
#include "comm.h"
#include "random_mars.h"
#include "error.h"
#include "update.h"
#include <cmath>
using namespace LAMMPS_NS;

View File

@ -375,10 +375,10 @@ void PairEDPD::init_style()
// if newton off, forces between atoms ij will be double computed
// using different random numbers
if (force->newton_pair == 0 && comm->me == 0) error->warning(FLERR,
"Pair tdpd needs newton pair on for momentum conservation");
if (force->newton_pair == 0 && comm->me == 0)
error->warning(FLERR, "Pair tdpd needs newton pair on for momentum conservation");
neighbor->request(this,instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -287,10 +287,10 @@ void PairMDPD::init_style()
// if newton off, forces between atoms ij will be double computed
// using different random numbers
if (force->newton_pair == 0 && comm->me == 0) error->warning(FLERR,
"Pair mdpd needs newton pair on for momentum conservation");
if (force->newton_pair == 0 && comm->me == 0)
error->warning(FLERR, "Pair mdpd needs newton pair on for momentum conservation");
neighbor->request(this,instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------

View File

@ -328,10 +328,9 @@ void PairTDPD::init_style()
// using different random numbers
if (force->newton_pair == 0 && comm->me == 0)
error->warning(FLERR,"Pair tdpd needs newton pair on "
"for momentum conservation");
error->warning(FLERR,"Pair tdpd needs newton pair on for momentum conservation");
neighbor->request(this,instance_me);
neighbor->add_request(this);
}
/* ----------------------------------------------------------------------