convert a few more styles to the new neighbor request API
This commit is contained in:
@ -280,7 +280,7 @@ void PairBornCoulDSF::init_style()
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style born/coul/dsf requires atom attribute q");
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
neighbor->add_request(this);
|
||||
|
||||
cut_coulsq = cut_coul * cut_coul;
|
||||
double erfcc = erfc(alpha*cut_coul);
|
||||
|
||||
@ -283,7 +283,7 @@ void PairBornCoulWolf::init_style()
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style born/coul/wolf requires atom attribute q");
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
neighbor->add_request(this);
|
||||
|
||||
cut_coulsq = cut_coul * cut_coul;
|
||||
}
|
||||
|
||||
@ -175,17 +175,6 @@ void PairCosineSquared::coeff(int narg, char **arg)
|
||||
error->all(FLERR, "Incorrect args for pair coefficients (none set)");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
init specific to this pair style (unnecessary)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
void PairCosineSquared::init_style()
|
||||
{
|
||||
neighbor->request(this,instance_me);
|
||||
}
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
init for one type pair i,j and corresponding j,i
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
@ -17,15 +17,15 @@
|
||||
|
||||
#include "pair_coul_diel.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neighbor.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -218,7 +218,7 @@ void PairCoulDiel::init_style()
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style coul/diel requires atom attribute q");
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
neighbor->add_request(this);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -182,7 +182,7 @@ void PairCoulExclude::init_style()
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style coul/exclude requires atom attribute q");
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
neighbor->add_request(this);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -241,7 +241,7 @@ void PairCoulSlaterLong::init_style()
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style coul/slater/long requires atom attribute q");
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
neighbor->add_request(this);
|
||||
|
||||
cut_coulsq = cut_coul * cut_coul;
|
||||
|
||||
|
||||
@ -458,7 +458,7 @@ void PairE3B::init_style()
|
||||
if (typeO < 1 || typeO > atom->ntypes) error->all(FLERR, "Invalid Otype: out of bounds");
|
||||
|
||||
// need a half neighbor list
|
||||
neighbor->request(this, instance_me);
|
||||
neighbor->add_request(this);
|
||||
|
||||
if (!force->pair_match("tip4p", false, 0))
|
||||
if (comm->me == 0)
|
||||
|
||||
@ -25,7 +25,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"
|
||||
@ -485,21 +484,14 @@ void PairLJ96Cut::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;
|
||||
if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) {
|
||||
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
|
||||
|
||||
|
||||
@ -19,17 +19,17 @@
|
||||
|
||||
#include "pair_lj_cut_coul_dsf.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "memory.h"
|
||||
#include "math_const.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "math_const.h"
|
||||
#include "memory.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neighbor.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
@ -273,7 +273,7 @@ void PairLJCutCoulDSF::init_style()
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style lj/cut/coul/dsf requires atom attribute q");
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
neighbor->add_request(this);
|
||||
|
||||
cut_coulsq = cut_coul * cut_coul;
|
||||
double erfcc = erfc(alpha*cut_coul);
|
||||
|
||||
@ -18,16 +18,16 @@
|
||||
|
||||
#include "pair_lj_cut_coul_wolf.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "math_const.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neighbor.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
@ -270,9 +270,7 @@ void PairLJCutCoulWolf::init_style()
|
||||
|
||||
cut_coulsq = cut_coul * cut_coul;
|
||||
|
||||
// request regular or rRESPA neighbor list
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
neighbor->add_request(this);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -18,21 +18,20 @@
|
||||
|
||||
#include "pair_lj_expand_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;
|
||||
@ -686,21 +685,14 @@ void PairLJExpandCoulLong::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;
|
||||
if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) {
|
||||
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;
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -18,14 +17,14 @@
|
||||
|
||||
#include "pair_lj_gromacs.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "neigh_list.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -67,14 +66,14 @@ PairLJGromacs::~PairLJGromacs()
|
||||
|
||||
void PairLJGromacs::compute(int eflag, int vflag)
|
||||
{
|
||||
int i,j,ii,jj,inum,jnum,itype,jtype;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
|
||||
double rsq,r2inv,r6inv,forcelj,factor_lj;
|
||||
double r,t,fswitch,eswitch;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
int i, j, ii, jj, inum, jnum, itype, jtype;
|
||||
double xtmp, ytmp, ztmp, delx, dely, delz, evdwl, fpair;
|
||||
double rsq, r2inv, r6inv, forcelj, factor_lj;
|
||||
double r, t, fswitch, eswitch;
|
||||
int *ilist, *jlist, *numneigh, **firstneigh;
|
||||
|
||||
evdwl = 0.0;
|
||||
ev_init(eflag,vflag);
|
||||
ev_init(eflag, vflag);
|
||||
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
@ -107,43 +106,42 @@ void PairLJGromacs::compute(int eflag, int vflag)
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
rsq = delx * delx + dely * dely + delz * delz;
|
||||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
r2inv = 1.0 / rsq;
|
||||
r6inv = r2inv * r2inv * r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype] * r6inv - lj2[itype][jtype]);
|
||||
if (rsq > cut_inner_sq[itype][jtype]) {
|
||||
r = sqrt(rsq);
|
||||
t = r - cut_inner[itype][jtype];
|
||||
fswitch = r*t*t*(ljsw1[itype][jtype] + ljsw2[itype][jtype]*t);
|
||||
fswitch = r * t * t * (ljsw1[itype][jtype] + ljsw2[itype][jtype] * t);
|
||||
forcelj += fswitch;
|
||||
}
|
||||
|
||||
fpair = factor_lj*forcelj*r2inv;
|
||||
fpair = factor_lj * forcelj * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
f[i][0] += delx * fpair;
|
||||
f[i][1] += dely * fpair;
|
||||
f[i][2] += delz * fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
f[j][0] -= delx * fpair;
|
||||
f[j][1] -= dely * fpair;
|
||||
f[j][2] -= delz * fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
evdwl = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
||||
evdwl = r6inv * (lj3[itype][jtype] * r6inv - lj4[itype][jtype]);
|
||||
evdwl += ljsw5[itype][jtype];
|
||||
if (rsq > cut_inner_sq[itype][jtype]) {
|
||||
eswitch = t*t*t*(ljsw3[itype][jtype] + ljsw4[itype][jtype]*t);
|
||||
eswitch = t * t * t * (ljsw3[itype][jtype] + ljsw4[itype][jtype] * t);
|
||||
evdwl += eswitch;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -158,29 +156,28 @@ void PairLJGromacs::compute(int eflag, int vflag)
|
||||
void PairLJGromacs::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_inner_sq,n+1,n+1,"pair:cut_inner_sq");
|
||||
memory->create(epsilon,n+1,n+1,"pair:epsilon");
|
||||
memory->create(sigma,n+1,n+1,"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(ljsw1,n+1,n+1,"pair:ljsw1");
|
||||
memory->create(ljsw2,n+1,n+1,"pair:ljsw2");
|
||||
memory->create(ljsw3,n+1,n+1,"pair:ljsw3");
|
||||
memory->create(ljsw4,n+1,n+1,"pair:ljsw4");
|
||||
memory->create(ljsw5,n+1,n+1,"pair:ljsw5");
|
||||
memory->create(cut, np1, np1, "pair:cut");
|
||||
memory->create(cut_inner, np1, np1, "pair:cut_inner");
|
||||
memory->create(cut_inner_sq, np1, np1, "pair:cut_inner_sq");
|
||||
memory->create(epsilon, np1, np1, "pair:epsilon");
|
||||
memory->create(sigma, np1, np1, "pair:sigma");
|
||||
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(ljsw1, np1, np1, "pair:ljsw1");
|
||||
memory->create(ljsw2, np1, np1, "pair:ljsw2");
|
||||
memory->create(ljsw3, np1, np1, "pair:ljsw3");
|
||||
memory->create(ljsw4, np1, np1, "pair:ljsw4");
|
||||
memory->create(ljsw5, np1, np1, "pair:ljsw5");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -189,18 +186,18 @@ void PairLJGromacs::allocate()
|
||||
|
||||
void PairLJGromacs::settings(int narg, char **arg)
|
||||
{
|
||||
if (narg != 2) error->all(FLERR,"Illegal pair_style command");
|
||||
if (narg != 2) error->all(FLERR, "Illegal pair_style command");
|
||||
|
||||
cut_inner_global = utils::numeric(FLERR,arg[0],false,lmp);
|
||||
cut_global = utils::numeric(FLERR,arg[1],false,lmp);
|
||||
cut_inner_global = utils::numeric(FLERR, arg[0], false, lmp);
|
||||
cut_global = utils::numeric(FLERR, arg[1], false, lmp);
|
||||
|
||||
if (cut_inner_global <= 0.0 || cut_inner_global > cut_global)
|
||||
error->all(FLERR,"Illegal pair_style command");
|
||||
error->all(FLERR, "Illegal pair_style command");
|
||||
|
||||
// reset cutoffs that have been explicitly set
|
||||
|
||||
if (allocated) {
|
||||
int i,j;
|
||||
int i, j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i; j <= atom->ntypes; j++)
|
||||
if (setflag[i][j]) {
|
||||
@ -216,30 +213,29 @@ void PairLJGromacs::settings(int narg, char **arg)
|
||||
|
||||
void PairLJGromacs::coeff(int narg, char **arg)
|
||||
{
|
||||
if (narg != 4 && narg != 6)
|
||||
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
if (narg != 4 && narg != 6) error->all(FLERR, "Incorrect args for pair coefficients");
|
||||
if (!allocated) allocate();
|
||||
|
||||
int ilo,ihi,jlo,jhi;
|
||||
utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error);
|
||||
utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error);
|
||||
int ilo, ihi, jlo, jhi;
|
||||
utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error);
|
||||
utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error);
|
||||
|
||||
double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp);
|
||||
double sigma_one = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
double epsilon_one = utils::numeric(FLERR, arg[2], false, lmp);
|
||||
double sigma_one = utils::numeric(FLERR, arg[3], false, lmp);
|
||||
|
||||
double cut_inner_one = cut_inner_global;
|
||||
double cut_one = cut_global;
|
||||
if (narg == 6) {
|
||||
cut_inner_one = utils::numeric(FLERR,arg[4],false,lmp);
|
||||
cut_one = utils::numeric(FLERR,arg[5],false,lmp);
|
||||
cut_inner_one = utils::numeric(FLERR, arg[4], false, lmp);
|
||||
cut_one = utils::numeric(FLERR, arg[5], false, lmp);
|
||||
}
|
||||
|
||||
if (cut_inner_one <= 0.0 || cut_inner_one > cut_one)
|
||||
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
error->all(FLERR, "Incorrect args for pair coefficients");
|
||||
|
||||
int count = 0;
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
for (int j = MAX(jlo,i); j <= jhi; j++) {
|
||||
for (int j = MAX(jlo, i); j <= jhi; j++) {
|
||||
epsilon[i][j] = epsilon_one;
|
||||
sigma[i][j] = sigma_one;
|
||||
cut_inner[i][j] = cut_inner_one;
|
||||
@ -249,7 +245,7 @@ void PairLJGromacs::coeff(int narg, char **arg)
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -259,37 +255,36 @@ void PairLJGromacs::coeff(int narg, char **arg)
|
||||
double PairLJGromacs::init_one(int i, int j)
|
||||
{
|
||||
if (setflag[i][j] == 0) {
|
||||
epsilon[i][j] = mix_energy(epsilon[i][i],epsilon[j][j],
|
||||
sigma[i][i],sigma[j][j]);
|
||||
sigma[i][j] = mix_distance(sigma[i][i],sigma[j][j]);
|
||||
cut_inner[i][j] = mix_distance(cut_inner[i][i],cut_inner[j][j]);
|
||||
cut[i][j] = mix_distance(cut[i][i],cut[j][j]);
|
||||
epsilon[i][j] = mix_energy(epsilon[i][i], epsilon[j][j], sigma[i][i], sigma[j][j]);
|
||||
sigma[i][j] = mix_distance(sigma[i][i], sigma[j][j]);
|
||||
cut_inner[i][j] = mix_distance(cut_inner[i][i], cut_inner[j][j]);
|
||||
cut[i][j] = mix_distance(cut[i][i], cut[j][j]);
|
||||
}
|
||||
|
||||
cut_inner_sq[i][j] = cut_inner[i][j]*cut_inner[i][j];
|
||||
lj1[i][j] = 48.0 * epsilon[i][j] * pow(sigma[i][j],12.0);
|
||||
lj2[i][j] = 24.0 * epsilon[i][j] * pow(sigma[i][j],6.0);
|
||||
lj3[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],12.0);
|
||||
lj4[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],6.0);
|
||||
cut_inner_sq[i][j] = cut_inner[i][j] * cut_inner[i][j];
|
||||
lj1[i][j] = 48.0 * epsilon[i][j] * pow(sigma[i][j], 12.0);
|
||||
lj2[i][j] = 24.0 * epsilon[i][j] * pow(sigma[i][j], 6.0);
|
||||
lj3[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j], 12.0);
|
||||
lj4[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j], 6.0);
|
||||
|
||||
double r6inv = 1.0/pow(cut[i][j],6.0);
|
||||
double r8inv = 1.0/pow(cut[i][j],8.0);
|
||||
double r6inv = 1.0 / pow(cut[i][j], 6.0);
|
||||
double r8inv = 1.0 / pow(cut[i][j], 8.0);
|
||||
double t = cut[i][j] - cut_inner[i][j];
|
||||
double t2inv = 1.0/(t*t);
|
||||
double t3inv = t2inv/t;
|
||||
double t3 = 1.0/t3inv;
|
||||
double a6 = (7.0*cut_inner[i][j] - 10.0*cut[i][j])*r8inv*t2inv;
|
||||
double b6 = (9.0*cut[i][j] - 7.0*cut_inner[i][j])*r8inv*t3inv;
|
||||
double a12 = (13.0*cut_inner[i][j] - 16.0*cut[i][j])*r6inv*r8inv*t2inv;
|
||||
double b12 = (15.0*cut[i][j] - 13.0*cut_inner[i][j])*r6inv*r8inv*t3inv;
|
||||
double c6 = r6inv - t3*(6.0*a6/3.0 + 6.0*b6*t/4.0);
|
||||
double c12 = r6inv*r6inv - t3*(12.0*a12/3.0 + 12.0*b12*t/4.0);
|
||||
double t2inv = 1.0 / (t * t);
|
||||
double t3inv = t2inv / t;
|
||||
double t3 = 1.0 / t3inv;
|
||||
double a6 = (7.0 * cut_inner[i][j] - 10.0 * cut[i][j]) * r8inv * t2inv;
|
||||
double b6 = (9.0 * cut[i][j] - 7.0 * cut_inner[i][j]) * r8inv * t3inv;
|
||||
double a12 = (13.0 * cut_inner[i][j] - 16.0 * cut[i][j]) * r6inv * r8inv * t2inv;
|
||||
double b12 = (15.0 * cut[i][j] - 13.0 * cut_inner[i][j]) * r6inv * r8inv * t3inv;
|
||||
double c6 = r6inv - t3 * (6.0 * a6 / 3.0 + 6.0 * b6 * t / 4.0);
|
||||
double c12 = r6inv * r6inv - t3 * (12.0 * a12 / 3.0 + 12.0 * b12 * t / 4.0);
|
||||
|
||||
ljsw1[i][j] = lj1[i][j]*a12 - lj2[i][j]*a6;
|
||||
ljsw2[i][j] = lj1[i][j]*b12 - lj2[i][j]*b6;
|
||||
ljsw3[i][j] = -lj3[i][j]*12.0*a12/3.0 + lj4[i][j]*6.0*a6/3.0;
|
||||
ljsw4[i][j] = -lj3[i][j]*12.0*b12/4.0 + lj4[i][j]*6.0*b6/4.0;
|
||||
ljsw5[i][j] = -lj3[i][j]*c12 + lj4[i][j]*c6;
|
||||
ljsw1[i][j] = lj1[i][j] * a12 - lj2[i][j] * a6;
|
||||
ljsw2[i][j] = lj1[i][j] * b12 - lj2[i][j] * b6;
|
||||
ljsw3[i][j] = -lj3[i][j] * 12.0 * a12 / 3.0 + lj4[i][j] * 6.0 * a6 / 3.0;
|
||||
ljsw4[i][j] = -lj3[i][j] * 12.0 * b12 / 4.0 + lj4[i][j] * 6.0 * b6 / 4.0;
|
||||
ljsw5[i][j] = -lj3[i][j] * c12 + lj4[i][j] * c6;
|
||||
|
||||
cut_inner[j][i] = cut_inner[i][j];
|
||||
cut_inner_sq[j][i] = cut_inner_sq[i][j];
|
||||
@ -314,15 +309,15 @@ void PairLJGromacs::write_restart(FILE *fp)
|
||||
{
|
||||
write_restart_settings(fp);
|
||||
|
||||
int i,j;
|
||||
int i, j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i; j <= atom->ntypes; j++) {
|
||||
fwrite(&setflag[i][j],sizeof(int),1,fp);
|
||||
fwrite(&setflag[i][j], sizeof(int), 1, fp);
|
||||
if (setflag[i][j]) {
|
||||
fwrite(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fwrite(&sigma[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut_inner[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut[i][j],sizeof(double),1,fp);
|
||||
fwrite(&epsilon[i][j], sizeof(double), 1, fp);
|
||||
fwrite(&sigma[i][j], sizeof(double), 1, fp);
|
||||
fwrite(&cut_inner[i][j], sizeof(double), 1, fp);
|
||||
fwrite(&cut[i][j], sizeof(double), 1, fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -336,23 +331,23 @@ void PairLJGromacs::read_restart(FILE *fp)
|
||||
read_restart_settings(fp);
|
||||
allocate();
|
||||
|
||||
int i,j;
|
||||
int i, j;
|
||||
int me = comm->me;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i; j <= atom->ntypes; j++) {
|
||||
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (me == 0) utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr, error);
|
||||
MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world);
|
||||
if (setflag[i][j]) {
|
||||
if (me == 0) {
|
||||
utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR, &epsilon[i][j], sizeof(double), 1, fp, nullptr, error);
|
||||
utils::sfread(FLERR, &sigma[i][j], sizeof(double), 1, fp, nullptr, error);
|
||||
utils::sfread(FLERR, &cut_inner[i][j], sizeof(double), 1, fp, nullptr, error);
|
||||
utils::sfread(FLERR, &cut[i][j], sizeof(double), 1, fp, nullptr, error);
|
||||
}
|
||||
MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&epsilon[i][j], 1, MPI_DOUBLE, 0, world);
|
||||
MPI_Bcast(&sigma[i][j], 1, MPI_DOUBLE, 0, world);
|
||||
MPI_Bcast(&cut_inner[i][j], 1, MPI_DOUBLE, 0, world);
|
||||
MPI_Bcast(&cut[i][j], 1, MPI_DOUBLE, 0, world);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -363,10 +358,10 @@ void PairLJGromacs::read_restart(FILE *fp)
|
||||
|
||||
void PairLJGromacs::write_restart_settings(FILE *fp)
|
||||
{
|
||||
fwrite(&cut_inner_global,sizeof(double),1,fp);
|
||||
fwrite(&cut_global,sizeof(double),1,fp);
|
||||
fwrite(&offset_flag,sizeof(int),1,fp);
|
||||
fwrite(&mix_flag,sizeof(int),1,fp);
|
||||
fwrite(&cut_inner_global, sizeof(double), 1, fp);
|
||||
fwrite(&cut_global, sizeof(double), 1, fp);
|
||||
fwrite(&offset_flag, sizeof(int), 1, fp);
|
||||
fwrite(&mix_flag, sizeof(int), 1, fp);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -377,15 +372,15 @@ void PairLJGromacs::read_restart_settings(FILE *fp)
|
||||
{
|
||||
int me = comm->me;
|
||||
if (me == 0) {
|
||||
utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR, &cut_inner_global, sizeof(double), 1, fp, nullptr, error);
|
||||
utils::sfread(FLERR, &cut_global, sizeof(double), 1, fp, nullptr, error);
|
||||
utils::sfread(FLERR, &offset_flag, sizeof(int), 1, fp, nullptr, error);
|
||||
utils::sfread(FLERR, &mix_flag, sizeof(int), 1, fp, nullptr, error);
|
||||
}
|
||||
MPI_Bcast(&cut_inner_global,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&offset_flag,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&mix_flag,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&cut_inner_global, 1, MPI_DOUBLE, 0, world);
|
||||
MPI_Bcast(&cut_global, 1, MPI_DOUBLE, 0, world);
|
||||
MPI_Bcast(&offset_flag, 1, MPI_INT, 0, world);
|
||||
MPI_Bcast(&mix_flag, 1, MPI_INT, 0, world);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -394,8 +389,7 @@ void PairLJGromacs::read_restart_settings(FILE *fp)
|
||||
|
||||
void PairLJGromacs::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]);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -406,37 +400,35 @@ void PairLJGromacs::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 %g %g %g %g\n",i,j,
|
||||
epsilon[i][j],sigma[i][j],cut_inner[i][j],cut[i][j]);
|
||||
fprintf(fp, "%d %d %g %g %g %g\n", i, j, epsilon[i][j], sigma[i][j], cut_inner[i][j],
|
||||
cut[i][j]);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJGromacs::single(int /*i*/, int /*j*/, int itype, int jtype,
|
||||
double rsq,
|
||||
double /*factor_coul*/, double factor_lj,
|
||||
double &fforce)
|
||||
double PairLJGromacs::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq,
|
||||
double /*factor_coul*/, double factor_lj, double &fforce)
|
||||
{
|
||||
double r2inv,r6inv,forcelj,philj;
|
||||
double r,t,fswitch,phiswitch;
|
||||
double r2inv, r6inv, forcelj, philj;
|
||||
double r, t, fswitch, phiswitch;
|
||||
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
r2inv = 1.0 / rsq;
|
||||
r6inv = r2inv * r2inv * r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype] * r6inv - lj2[itype][jtype]);
|
||||
if (rsq > cut_inner_sq[itype][jtype]) {
|
||||
r = sqrt(rsq);
|
||||
t = r - cut_inner[itype][jtype];
|
||||
fswitch = r*t*t*(ljsw1[itype][jtype] + ljsw2[itype][jtype]*t);
|
||||
fswitch = r * t * t * (ljsw1[itype][jtype] + ljsw2[itype][jtype] * t);
|
||||
forcelj += fswitch;
|
||||
}
|
||||
fforce = factor_lj*forcelj*r2inv;
|
||||
fforce = factor_lj * forcelj * r2inv;
|
||||
|
||||
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
||||
philj = r6inv * (lj3[itype][jtype] * r6inv - lj4[itype][jtype]);
|
||||
philj += ljsw5[itype][jtype];
|
||||
if (rsq > cut_inner_sq[itype][jtype]) {
|
||||
phiswitch = t*t*t*(ljsw3[itype][jtype] + ljsw4[itype][jtype]*t);
|
||||
phiswitch = t * t * t * (ljsw3[itype][jtype] + ljsw4[itype][jtype] * t);
|
||||
philj += phiswitch;
|
||||
}
|
||||
|
||||
return factor_lj*philj;
|
||||
return factor_lj * philj;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -18,14 +17,15 @@
|
||||
|
||||
#include "pair_lj_gromacs_coul_gromacs.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neighbor.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -64,14 +64,14 @@ PairLJGromacsCoulGromacs::~PairLJGromacsCoulGromacs()
|
||||
|
||||
void PairLJGromacsCoulGromacs::compute(int eflag, int vflag)
|
||||
{
|
||||
int i,j,ii,jj,inum,jnum,itype,jtype;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
double rsq,r2inv,r6inv,forcecoul,forcelj,factor_coul,factor_lj;
|
||||
double r,tlj,tc,fswitch,fswitchcoul,eswitch,ecoulswitch;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
int i, j, ii, jj, inum, jnum, itype, jtype;
|
||||
double qtmp, xtmp, ytmp, ztmp, delx, dely, delz, evdwl, ecoul, fpair;
|
||||
double rsq, r2inv, r6inv, forcecoul, forcelj, factor_coul, factor_lj;
|
||||
double r, tlj, tc, fswitch, fswitchcoul, eswitch, ecoulswitch;
|
||||
int *ilist, *jlist, *numneigh, **firstneigh;
|
||||
|
||||
evdwl = ecoul = 0.0;
|
||||
ev_init(eflag,vflag);
|
||||
ev_init(eflag, vflag);
|
||||
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
@ -109,69 +109,72 @@ void PairLJGromacsCoulGromacs::compute(int eflag, int vflag)
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
rsq = delx * delx + dely * dely + delz * delz;
|
||||
|
||||
if (rsq < cut_bothsq) {
|
||||
r2inv = 1.0/rsq;
|
||||
r2inv = 1.0 / rsq;
|
||||
|
||||
// skip if qi or qj = 0.0 since this potential may be used as
|
||||
// coarse-grain model with many uncharged atoms
|
||||
|
||||
if (rsq < cut_coulsq && qtmp != 0.0 && q[j] != 0.0) {
|
||||
forcecoul = qqrd2e * qtmp*q[j]*sqrt(r2inv);
|
||||
forcecoul = qqrd2e * qtmp * q[j] * sqrt(r2inv);
|
||||
if (rsq > cut_coul_innersq) {
|
||||
r = sqrt(rsq);
|
||||
tc = r - cut_coul_inner;
|
||||
fswitchcoul = qqrd2e * qtmp*q[j]*r*tc*tc*(coulsw1 + coulsw2*tc);
|
||||
fswitchcoul = qqrd2e * qtmp * q[j] * r * tc * tc * (coulsw1 + coulsw2 * tc);
|
||||
forcecoul += fswitchcoul;
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
} else
|
||||
forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
r6inv = r2inv * r2inv * r2inv;
|
||||
jtype = type[j];
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
forcelj = r6inv * (lj1[itype][jtype] * r6inv - lj2[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
r = sqrt(rsq);
|
||||
tlj = r - cut_lj_inner;
|
||||
fswitch = r*tlj*tlj*(ljsw1[itype][jtype] +
|
||||
ljsw2[itype][jtype]*tlj);
|
||||
fswitch = r * tlj * tlj * (ljsw1[itype][jtype] + ljsw2[itype][jtype] * tlj);
|
||||
forcelj += fswitch;
|
||||
}
|
||||
} else forcelj = 0.0;
|
||||
} else
|
||||
forcelj = 0.0;
|
||||
|
||||
fpair = (factor_coul*forcecoul + factor_lj*forcelj) * r2inv;
|
||||
fpair = (factor_coul * forcecoul + factor_lj * forcelj) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
f[i][0] += delx * fpair;
|
||||
f[i][1] += dely * fpair;
|
||||
f[i][2] += delz * fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
f[j][0] -= delx * fpair;
|
||||
f[j][1] -= dely * fpair;
|
||||
f[j][2] -= delz * fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
ecoul = qqrd2e * qtmp*q[j] * (sqrt(r2inv) - coulsw5);
|
||||
ecoul = qqrd2e * qtmp * q[j] * (sqrt(r2inv) - coulsw5);
|
||||
if (rsq > cut_coul_innersq) {
|
||||
ecoulswitch = tc*tc*tc * (coulsw3 + coulsw4*tc);
|
||||
ecoul += qqrd2e*qtmp*q[j]*ecoulswitch;
|
||||
ecoulswitch = tc * tc * tc * (coulsw3 + coulsw4 * tc);
|
||||
ecoul += qqrd2e * qtmp * q[j] * ecoulswitch;
|
||||
}
|
||||
ecoul *= factor_coul;
|
||||
} else ecoul = 0.0;
|
||||
} else
|
||||
ecoul = 0.0;
|
||||
if (rsq < cut_ljsq) {
|
||||
evdwl = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
||||
evdwl = r6inv * (lj3[itype][jtype] * r6inv - lj4[itype][jtype]);
|
||||
evdwl += ljsw5[itype][jtype];
|
||||
if (rsq > cut_lj_innersq) {
|
||||
eswitch = tlj*tlj*tlj * (ljsw3[itype][jtype] + ljsw4[itype][jtype]*tlj);
|
||||
eswitch = tlj * tlj * tlj * (ljsw3[itype][jtype] + ljsw4[itype][jtype] * tlj);
|
||||
evdwl += eswitch;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -186,26 +189,25 @@ void PairLJGromacsCoulGromacs::compute(int eflag, int vflag)
|
||||
void PairLJGromacsCoulGromacs::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(epsilon,n+1,n+1,"pair:epsilon");
|
||||
memory->create(sigma,n+1,n+1,"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(ljsw1,n+1,n+1,"pair:ljsw1");
|
||||
memory->create(ljsw2,n+1,n+1,"pair:ljsw2");
|
||||
memory->create(ljsw3,n+1,n+1,"pair:ljsw3");
|
||||
memory->create(ljsw4,n+1,n+1,"pair:ljsw4");
|
||||
memory->create(ljsw5,n+1,n+1,"pair:ljsw5");
|
||||
memory->create(epsilon, np1, np1, "pair:epsilon");
|
||||
memory->create(sigma, np1, np1, "pair:sigma");
|
||||
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(ljsw1, np1, np1, "pair:ljsw1");
|
||||
memory->create(ljsw2, np1, np1, "pair:ljsw2");
|
||||
memory->create(ljsw3, np1, np1, "pair:ljsw3");
|
||||
memory->create(ljsw4, np1, np1, "pair:ljsw4");
|
||||
memory->create(ljsw5, np1, np1, "pair:ljsw5");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -214,23 +216,21 @@ void PairLJGromacsCoulGromacs::allocate()
|
||||
|
||||
void PairLJGromacsCoulGromacs::settings(int narg, char **arg)
|
||||
{
|
||||
if (narg != 2 && narg != 4)
|
||||
error->all(FLERR,"Illegal pair_style command");
|
||||
if (narg != 2 && narg != 4) error->all(FLERR, "Illegal pair_style command");
|
||||
|
||||
cut_lj_inner = utils::numeric(FLERR,arg[0],false,lmp);
|
||||
cut_lj = utils::numeric(FLERR,arg[1],false,lmp);
|
||||
cut_lj_inner = utils::numeric(FLERR, arg[0], false, lmp);
|
||||
cut_lj = utils::numeric(FLERR, arg[1], false, lmp);
|
||||
if (narg == 2) {
|
||||
cut_coul_inner = cut_lj_inner;
|
||||
cut_coul = cut_lj;
|
||||
} else {
|
||||
cut_coul_inner = utils::numeric(FLERR,arg[2],false,lmp);
|
||||
cut_coul = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
cut_coul_inner = utils::numeric(FLERR, arg[2], false, lmp);
|
||||
cut_coul = utils::numeric(FLERR, arg[3], false, lmp);
|
||||
}
|
||||
|
||||
if (cut_lj_inner <= 0.0 || cut_coul_inner < 0.0)
|
||||
error->all(FLERR,"Illegal pair_style command");
|
||||
if (cut_lj_inner <= 0.0 || cut_coul_inner < 0.0) error->all(FLERR, "Illegal pair_style command");
|
||||
if (cut_lj_inner > cut_lj || cut_coul_inner > cut_coul)
|
||||
error->all(FLERR,"Illegal pair_style command");
|
||||
error->all(FLERR, "Illegal pair_style command");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -239,19 +239,19 @@ void PairLJGromacsCoulGromacs::settings(int narg, char **arg)
|
||||
|
||||
void PairLJGromacsCoulGromacs::coeff(int narg, char **arg)
|
||||
{
|
||||
if (narg != 4) error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
if (narg != 4) error->all(FLERR, "Incorrect args for pair coefficients");
|
||||
if (!allocated) allocate();
|
||||
|
||||
int ilo,ihi,jlo,jhi;
|
||||
utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error);
|
||||
utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error);
|
||||
int ilo, ihi, jlo, jhi;
|
||||
utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error);
|
||||
utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error);
|
||||
|
||||
double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp);
|
||||
double sigma_one = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
double epsilon_one = utils::numeric(FLERR, arg[2], false, lmp);
|
||||
double sigma_one = utils::numeric(FLERR, arg[3], false, lmp);
|
||||
|
||||
int count = 0;
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
for (int j = MAX(jlo,i); j <= jhi; j++) {
|
||||
for (int j = MAX(jlo, i); j <= jhi; j++) {
|
||||
epsilon[i][j] = epsilon_one;
|
||||
sigma[i][j] = sigma_one;
|
||||
setflag[i][j] = 1;
|
||||
@ -259,7 +259,7 @@ void PairLJGromacsCoulGromacs::coeff(int narg, char **arg)
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -269,16 +269,15 @@ void PairLJGromacsCoulGromacs::coeff(int narg, char **arg)
|
||||
void PairLJGromacsCoulGromacs::init_style()
|
||||
{
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,
|
||||
"Pair style lj/gromacs/coul/gromacs requires atom attribute q");
|
||||
error->all(FLERR, "Pair style lj/gromacs/coul/gromacs requires atom attribute q");
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
neighbor->add_request(this);
|
||||
|
||||
cut_lj_innersq = cut_lj_inner * cut_lj_inner;
|
||||
cut_ljsq = cut_lj * cut_lj;
|
||||
cut_coul_innersq = cut_coul_inner * cut_coul_inner;
|
||||
cut_coulsq = cut_coul * cut_coul;
|
||||
cut_bothsq = MAX(cut_ljsq,cut_coulsq);
|
||||
cut_bothsq = MAX(cut_ljsq, cut_coulsq);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -288,48 +287,47 @@ void PairLJGromacsCoulGromacs::init_style()
|
||||
double PairLJGromacsCoulGromacs::init_one(int i, int j)
|
||||
{
|
||||
if (setflag[i][j] == 0) {
|
||||
epsilon[i][j] = mix_energy(epsilon[i][i],epsilon[j][j],
|
||||
sigma[i][i],sigma[j][j]);
|
||||
sigma[i][j] = mix_distance(sigma[i][i],sigma[j][j]);
|
||||
epsilon[i][j] = mix_energy(epsilon[i][i], epsilon[j][j], sigma[i][i], sigma[j][j]);
|
||||
sigma[i][j] = mix_distance(sigma[i][i], sigma[j][j]);
|
||||
}
|
||||
|
||||
double cut = MAX(cut_lj,cut_coul);
|
||||
double cut = MAX(cut_lj, cut_coul);
|
||||
|
||||
lj1[i][j] = 48.0 * epsilon[i][j] * pow(sigma[i][j],12.0);
|
||||
lj2[i][j] = 24.0 * epsilon[i][j] * pow(sigma[i][j],6.0);
|
||||
lj3[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],12.0);
|
||||
lj4[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],6.0);
|
||||
lj1[i][j] = 48.0 * epsilon[i][j] * pow(sigma[i][j], 12.0);
|
||||
lj2[i][j] = 24.0 * epsilon[i][j] * pow(sigma[i][j], 6.0);
|
||||
lj3[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j], 12.0);
|
||||
lj4[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j], 6.0);
|
||||
|
||||
double r6inv = 1.0/pow(cut_lj,6.0);
|
||||
double r8inv = 1.0/pow(cut_lj,8.0);
|
||||
double r6inv = 1.0 / pow(cut_lj, 6.0);
|
||||
double r8inv = 1.0 / pow(cut_lj, 8.0);
|
||||
double t = cut_lj - cut_lj_inner;
|
||||
double t2inv = 1.0/(t*t);
|
||||
double t3inv = t2inv/t;
|
||||
double t3 = 1.0/t3inv;
|
||||
double a6 = (7.0*cut_lj_inner - 10.0*cut_lj)*r8inv*t2inv;
|
||||
double b6 = (9.0*cut_lj - 7.0*cut_lj_inner)*r8inv*t3inv;
|
||||
double a12 = (13.0*cut_lj_inner - 16.0*cut_lj)*r6inv*r8inv*t2inv;
|
||||
double b12 = (15.0*cut_lj - 13.0*cut_lj_inner)*r6inv*r8inv*t3inv;
|
||||
double c6 = r6inv - t3*(6.0*a6/3.0 + 6.0*b6*t/4.0);
|
||||
double c12 = r6inv*r6inv - t3*(12.0*a12/3.0 + 12.0*b12*t/4.0);
|
||||
double t2inv = 1.0 / (t * t);
|
||||
double t3inv = t2inv / t;
|
||||
double t3 = 1.0 / t3inv;
|
||||
double a6 = (7.0 * cut_lj_inner - 10.0 * cut_lj) * r8inv * t2inv;
|
||||
double b6 = (9.0 * cut_lj - 7.0 * cut_lj_inner) * r8inv * t3inv;
|
||||
double a12 = (13.0 * cut_lj_inner - 16.0 * cut_lj) * r6inv * r8inv * t2inv;
|
||||
double b12 = (15.0 * cut_lj - 13.0 * cut_lj_inner) * r6inv * r8inv * t3inv;
|
||||
double c6 = r6inv - t3 * (6.0 * a6 / 3.0 + 6.0 * b6 * t / 4.0);
|
||||
double c12 = r6inv * r6inv - t3 * (12.0 * a12 / 3.0 + 12.0 * b12 * t / 4.0);
|
||||
|
||||
ljsw1[i][j] = lj1[i][j]*a12 - lj2[i][j]*a6;
|
||||
ljsw2[i][j] = lj1[i][j]*b12 - lj2[i][j]*b6;
|
||||
ljsw3[i][j] = -lj3[i][j]*12.0*a12/3.0 + lj4[i][j]*6.0*a6/3.0;
|
||||
ljsw4[i][j] = -lj3[i][j]*12.0*b12/4.0 + lj4[i][j]*6.0*b6/4.0;
|
||||
ljsw5[i][j] = -lj3[i][j]*c12 + lj4[i][j]*c6;
|
||||
ljsw1[i][j] = lj1[i][j] * a12 - lj2[i][j] * a6;
|
||||
ljsw2[i][j] = lj1[i][j] * b12 - lj2[i][j] * b6;
|
||||
ljsw3[i][j] = -lj3[i][j] * 12.0 * a12 / 3.0 + lj4[i][j] * 6.0 * a6 / 3.0;
|
||||
ljsw4[i][j] = -lj3[i][j] * 12.0 * b12 / 4.0 + lj4[i][j] * 6.0 * b6 / 4.0;
|
||||
ljsw5[i][j] = -lj3[i][j] * c12 + lj4[i][j] * c6;
|
||||
|
||||
double r3inv = 1.0/pow(cut_coul,3.0);
|
||||
double r3inv = 1.0 / pow(cut_coul, 3.0);
|
||||
t = cut_coul - cut_coul_inner;
|
||||
t2inv = 1.0/(t*t);
|
||||
t3inv = t2inv/t;
|
||||
double a1 = (2.0*cut_coul_inner - 5.0*cut_coul) * r3inv*t2inv;
|
||||
double b1 = (4.0*cut_coul - 2.0*cut_coul_inner) * r3inv*t3inv;
|
||||
t2inv = 1.0 / (t * t);
|
||||
t3inv = t2inv / t;
|
||||
double a1 = (2.0 * cut_coul_inner - 5.0 * cut_coul) * r3inv * t2inv;
|
||||
double b1 = (4.0 * cut_coul - 2.0 * cut_coul_inner) * r3inv * t3inv;
|
||||
coulsw1 = a1;
|
||||
coulsw2 = b1;
|
||||
coulsw3 = -a1/3.0;
|
||||
coulsw4 = -b1/4.0;
|
||||
coulsw5 = 1.0/cut_coul - t*t*t*(a1/3.0 + b1*t/4.0);
|
||||
coulsw3 = -a1 / 3.0;
|
||||
coulsw4 = -b1 / 4.0;
|
||||
coulsw5 = 1.0 / cut_coul - t * t * t * (a1 / 3.0 + b1 * t / 4.0);
|
||||
|
||||
lj1[j][i] = lj1[i][j];
|
||||
lj2[j][i] = lj2[i][j];
|
||||
@ -352,13 +350,13 @@ void PairLJGromacsCoulGromacs::write_restart(FILE *fp)
|
||||
{
|
||||
write_restart_settings(fp);
|
||||
|
||||
int i,j;
|
||||
int i, j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i; j <= atom->ntypes; j++) {
|
||||
fwrite(&setflag[i][j],sizeof(int),1,fp);
|
||||
fwrite(&setflag[i][j], sizeof(int), 1, fp);
|
||||
if (setflag[i][j]) {
|
||||
fwrite(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fwrite(&sigma[i][j],sizeof(double),1,fp);
|
||||
fwrite(&epsilon[i][j], sizeof(double), 1, fp);
|
||||
fwrite(&sigma[i][j], sizeof(double), 1, fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -372,19 +370,19 @@ void PairLJGromacsCoulGromacs::read_restart(FILE *fp)
|
||||
read_restart_settings(fp);
|
||||
allocate();
|
||||
|
||||
int i,j;
|
||||
int i, j;
|
||||
int me = comm->me;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i; j <= atom->ntypes; j++) {
|
||||
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (me == 0) utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr, error);
|
||||
MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world);
|
||||
if (setflag[i][j]) {
|
||||
if (me == 0) {
|
||||
utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR, &epsilon[i][j], sizeof(double), 1, fp, nullptr, error);
|
||||
utils::sfread(FLERR, &sigma[i][j], sizeof(double), 1, fp, nullptr, error);
|
||||
}
|
||||
MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&epsilon[i][j], 1, MPI_DOUBLE, 0, world);
|
||||
MPI_Bcast(&sigma[i][j], 1, MPI_DOUBLE, 0, world);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -395,12 +393,12 @@ void PairLJGromacsCoulGromacs::read_restart(FILE *fp)
|
||||
|
||||
void PairLJGromacsCoulGromacs::write_restart_settings(FILE *fp)
|
||||
{
|
||||
fwrite(&cut_lj_inner,sizeof(double),1,fp);
|
||||
fwrite(&cut_lj,sizeof(double),1,fp);
|
||||
fwrite(&cut_coul_inner,sizeof(double),1,fp);
|
||||
fwrite(&cut_coul,sizeof(double),1,fp);
|
||||
fwrite(&offset_flag,sizeof(int),1,fp);
|
||||
fwrite(&mix_flag,sizeof(int),1,fp);
|
||||
fwrite(&cut_lj_inner, sizeof(double), 1, fp);
|
||||
fwrite(&cut_lj, sizeof(double), 1, fp);
|
||||
fwrite(&cut_coul_inner, sizeof(double), 1, fp);
|
||||
fwrite(&cut_coul, sizeof(double), 1, fp);
|
||||
fwrite(&offset_flag, sizeof(int), 1, fp);
|
||||
fwrite(&mix_flag, sizeof(int), 1, fp);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -410,19 +408,19 @@ void PairLJGromacsCoulGromacs::write_restart_settings(FILE *fp)
|
||||
void PairLJGromacsCoulGromacs::read_restart_settings(FILE *fp)
|
||||
{
|
||||
if (comm->me == 0) {
|
||||
utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&cut_coul_inner,sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR, &cut_lj_inner, sizeof(double), 1, fp, nullptr, error);
|
||||
utils::sfread(FLERR, &cut_lj, sizeof(double), 1, fp, nullptr, error);
|
||||
utils::sfread(FLERR, &cut_coul_inner, sizeof(double), 1, fp, nullptr, error);
|
||||
utils::sfread(FLERR, &cut_coul, sizeof(double), 1, fp, nullptr, error);
|
||||
utils::sfread(FLERR, &offset_flag, sizeof(int), 1, fp, nullptr, error);
|
||||
utils::sfread(FLERR, &mix_flag, sizeof(int), 1, fp, nullptr, error);
|
||||
}
|
||||
MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_coul_inner,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&offset_flag,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&mix_flag,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&cut_lj_inner, 1, MPI_DOUBLE, 0, world);
|
||||
MPI_Bcast(&cut_lj, 1, MPI_DOUBLE, 0, world);
|
||||
MPI_Bcast(&cut_coul_inner, 1, MPI_DOUBLE, 0, world);
|
||||
MPI_Bcast(&cut_coul, 1, MPI_DOUBLE, 0, world);
|
||||
MPI_Bcast(&offset_flag, 1, MPI_INT, 0, world);
|
||||
MPI_Bcast(&mix_flag, 1, MPI_INT, 0, world);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -431,8 +429,7 @@ void PairLJGromacsCoulGromacs::read_restart_settings(FILE *fp)
|
||||
|
||||
void PairLJGromacsCoulGromacs::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]);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -443,62 +440,63 @@ void PairLJGromacsCoulGromacs::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 %g %g\n",i,j,epsilon[i][j],sigma[i][j]);
|
||||
fprintf(fp, "%d %d %g %g\n", i, j, epsilon[i][j], sigma[i][j]);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJGromacsCoulGromacs::single(int i, int j, int itype, int jtype,
|
||||
double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
double PairLJGromacsCoulGromacs::single(int i, int j, int itype, int jtype, double rsq,
|
||||
double factor_coul, double factor_lj, double &fforce)
|
||||
{
|
||||
double r2inv,r6inv,forcecoul,forcelj,phicoul,philj;
|
||||
double r,tlj,tc,fswitch,phiswitch,fswitchcoul,phiswitchcoul;
|
||||
double r2inv, r6inv, forcecoul, forcelj, phicoul, philj;
|
||||
double r, tlj, tc, fswitch, phiswitch, fswitchcoul, phiswitchcoul;
|
||||
|
||||
r2inv = 1.0/rsq;
|
||||
r2inv = 1.0 / rsq;
|
||||
if (rsq < cut_coulsq) {
|
||||
forcecoul = force->qqrd2e * atom->q[i]*atom->q[j]*sqrt(r2inv);
|
||||
forcecoul = force->qqrd2e * atom->q[i] * atom->q[j] * sqrt(r2inv);
|
||||
if (rsq > cut_coul_innersq) {
|
||||
r = sqrt(rsq);
|
||||
tc = r - cut_coul_inner;
|
||||
fswitchcoul = force->qqrd2e *
|
||||
atom->q[i]*atom->q[j] * r*tc*tc * (coulsw1 + coulsw2*tc);
|
||||
fswitchcoul =
|
||||
force->qqrd2e * atom->q[i] * atom->q[j] * r * tc * tc * (coulsw1 + coulsw2 * tc);
|
||||
forcecoul += fswitchcoul;
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
} else
|
||||
forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
r6inv = r2inv * r2inv * r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype] * r6inv - lj2[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
r = sqrt(rsq);
|
||||
tlj = r - cut_lj_inner;
|
||||
fswitch = r*tlj*tlj*(ljsw1[itype][jtype] + ljsw2[itype][jtype]*tlj);
|
||||
fswitch = r * tlj * tlj * (ljsw1[itype][jtype] + ljsw2[itype][jtype] * tlj);
|
||||
forcelj += fswitch;
|
||||
}
|
||||
} else forcelj = 0.0;
|
||||
} else
|
||||
forcelj = 0.0;
|
||||
|
||||
fforce = (factor_coul*forcecoul + factor_lj*forcelj) * r2inv;
|
||||
fforce = (factor_coul * forcecoul + factor_lj * forcelj) * r2inv;
|
||||
|
||||
double eng = 0.0;
|
||||
if (rsq < cut_coulsq) {
|
||||
phicoul = force->qqrd2e * atom->q[i]*atom->q[j] * (sqrt(r2inv)-coulsw5);
|
||||
phicoul = force->qqrd2e * atom->q[i] * atom->q[j] * (sqrt(r2inv) - coulsw5);
|
||||
if (rsq > cut_coul_innersq) {
|
||||
phiswitchcoul = force->qqrd2e * atom->q[i]*atom->q[j] * tc*tc*tc * (coulsw3 + coulsw4*tc);
|
||||
phiswitchcoul =
|
||||
force->qqrd2e * atom->q[i] * atom->q[j] * tc * tc * tc * (coulsw3 + coulsw4 * tc);
|
||||
phicoul += phiswitchcoul;
|
||||
}
|
||||
eng += factor_coul*phicoul;
|
||||
eng += factor_coul * phicoul;
|
||||
}
|
||||
|
||||
if (rsq < cut_ljsq) {
|
||||
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
||||
philj = r6inv * (lj3[itype][jtype] * r6inv - lj4[itype][jtype]);
|
||||
philj += ljsw5[itype][jtype];
|
||||
if (rsq > cut_lj_innersq) {
|
||||
phiswitch = tlj*tlj*tlj * (ljsw3[itype][jtype] + ljsw4[itype][jtype]*tlj);
|
||||
phiswitch = tlj * tlj * tlj * (ljsw3[itype][jtype] + ljsw4[itype][jtype] * tlj);
|
||||
philj += phiswitch;
|
||||
}
|
||||
eng += factor_lj*philj;
|
||||
eng += factor_lj * philj;
|
||||
}
|
||||
|
||||
return eng;
|
||||
|
||||
@ -18,20 +18,19 @@
|
||||
|
||||
#include "pair_mie_cut.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "update.h"
|
||||
#include "respa.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;
|
||||
@ -497,21 +496,14 @@ void PairMIECut::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;
|
||||
if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) {
|
||||
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
|
||||
|
||||
|
||||
@ -18,17 +18,17 @@
|
||||
|
||||
#include "pair_nm_cut_coul_cut.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "math_const.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neighbor.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
@ -18,18 +18,18 @@
|
||||
|
||||
#include "pair_nm_cut_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 "math_const.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neighbor.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
@ -304,7 +304,7 @@ void PairNMCutCoulLong::init_style()
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style nm/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
|
||||
|
||||
@ -20,19 +20,21 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_buck6d_coul_gauss_dsf.h"
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "memory.h"
|
||||
#include "math_const.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "math_const.h"
|
||||
#include "memory.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neighbor.h"
|
||||
|
||||
#include "math_special.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
@ -314,7 +316,7 @@ void PairBuck6dCoulGaussDSF::init_style()
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style buck6d/coul/dsf requires atom attribute q");
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
neighbor->add_request(this);
|
||||
|
||||
cut_coulsq = cut_coul * cut_coul;
|
||||
}
|
||||
|
||||
@ -20,19 +20,20 @@
|
||||
|
||||
#include "pair_buck6d_coul_gauss_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 "math_special.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define EWALD_F 1.12837917
|
||||
@ -336,7 +337,7 @@ void PairBuck6dCoulGaussLong::init_style()
|
||||
error->all(FLERR,"Pair style requires a KSpace style");
|
||||
g_ewald = force->kspace->g_ewald;
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
neighbor->add_request(this);
|
||||
|
||||
cut_coulsq = cut_coul * cut_coul;
|
||||
|
||||
|
||||
@ -17,21 +17,21 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_hbond_dreiding_lj.h"
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_request.h"
|
||||
#include "neigh_list.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "math_const.h"
|
||||
#include "math_special.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neighbor.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
@ -441,9 +441,7 @@ void PairHbondDreidingLJ::init_style()
|
||||
|
||||
// full neighbor list request
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -17,21 +17,21 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_hbond_dreiding_morse.h"
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_request.h"
|
||||
#include "neigh_list.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "math_const.h"
|
||||
#include "math_special.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neighbor.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
@ -365,9 +365,7 @@ void PairHbondDreidingMorse::init_style()
|
||||
|
||||
// full neighbor list request
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -18,16 +18,16 @@
|
||||
|
||||
#include "pair_lj_charmm_coul_charmm.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "memory.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;
|
||||
|
||||
@ -281,15 +281,14 @@ void PairLJCharmmCoulCharmm::coeff(int narg, char **arg)
|
||||
void PairLJCharmmCoulCharmm::init_style()
|
||||
{
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,
|
||||
"Pair style lj/charmm/coul/charmm requires atom attribute q");
|
||||
error->all(FLERR, "Pair style lj/charmm/coul/charmm requires atom attribute q");
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
neighbor->add_request(this);
|
||||
|
||||
// require cut_lj_inner < cut_lj, cut_coul_inner < cut_coul
|
||||
|
||||
if (cut_lj_inner >= cut_lj || cut_coul_inner >= cut_coul)
|
||||
error->all(FLERR,"Pair inner cutoff >= Pair outer cutoff");
|
||||
error->all(FLERR, "Pair inner cutoff >= Pair outer cutoff");
|
||||
|
||||
cut_lj_innersq = cut_lj_inner * cut_lj_inner;
|
||||
cut_ljsq = cut_lj * cut_lj;
|
||||
|
||||
@ -22,17 +22,17 @@
|
||||
|
||||
#include "pair_lj_charmmfsw_coul_charmmfsh.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neighbor.h"
|
||||
#include "update.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "update.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -305,10 +305,9 @@ void PairLJCharmmfswCoulCharmmfsh::coeff(int narg, char **arg)
|
||||
void PairLJCharmmfswCoulCharmmfsh::init_style()
|
||||
{
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style lj/charmmfsw/coul/charmmfsh "
|
||||
"requires atom attribute q");
|
||||
error->all(FLERR,"Pair style lj/charmmfsw/coul/charmmfsh requires atom attribute q");
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
neighbor->add_request(this);
|
||||
|
||||
// require cut_lj_inner < cut_lj
|
||||
|
||||
|
||||
@ -18,18 +18,18 @@
|
||||
|
||||
#include "pair_tip4p_cut.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "domain.h"
|
||||
#include "angle.h"
|
||||
#include "atom.h"
|
||||
#include "bond.h"
|
||||
#include "comm.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>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -427,7 +427,7 @@ void PairTIP4PCut::init_style()
|
||||
if (force->angle == nullptr)
|
||||
error->all(FLERR,"Must use an angle style with TIP4P potential");
|
||||
|
||||
neighbor->request(this);
|
||||
neighbor->add_request(this);
|
||||
|
||||
// set alpha parameter
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ void PairPeri::init_style()
|
||||
if (!fix_peri_neigh)
|
||||
fix_peri_neigh = (FixPeriNeigh *) modify->add_fix("PERI_NEIGH all PERI_NEIGH");
|
||||
|
||||
neighbor->request(this, instance_me);
|
||||
neighbor->add_request(this);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -159,12 +159,7 @@ void ComputePTMAtom::init() {
|
||||
|
||||
// need an occasional full neighbor list
|
||||
|
||||
int irequest = neighbor->request(this, instance_me);
|
||||
neighbor->requests[irequest]->pair = 0;
|
||||
neighbor->requests[irequest]->compute = 1;
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->requests[irequest]->occasional = 1;
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -802,10 +802,7 @@ void FixBondReact::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;
|
||||
}
|
||||
|
||||
@ -14,8 +14,6 @@
|
||||
|
||||
#include "fix_hyper_global.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "update.h"
|
||||
#include "group.h"
|
||||
@ -23,12 +21,14 @@
|
||||
#include "domain.h"
|
||||
#include "comm.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_request.h"
|
||||
#include "neigh_list.h"
|
||||
#include "math_extra.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
|
||||
@ -138,10 +138,7 @@ void FixHyperGlobal::init()
|
||||
|
||||
// need an occasional half neighbor list
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -14,9 +14,6 @@
|
||||
|
||||
#include "fix_hyper_local.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
#include "atom.h"
|
||||
#include "update.h"
|
||||
#include "group.h"
|
||||
@ -32,6 +29,9 @@
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
|
||||
@ -310,15 +310,9 @@ void FixHyperLocal::init()
|
||||
// NOTE: what if pair style list cutoff > Dcut
|
||||
// or what if neigh skin is huge?
|
||||
|
||||
int irequest_full = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest_full]->id = 1;
|
||||
neighbor->requests[irequest_full]->pair = 0;
|
||||
neighbor->requests[irequest_full]->fix = 1;
|
||||
neighbor->requests[irequest_full]->half = 0;
|
||||
neighbor->requests[irequest_full]->full = 1;
|
||||
neighbor->requests[irequest_full]->cut = 1;
|
||||
neighbor->requests[irequest_full]->cutoff = dcut;
|
||||
neighbor->requests[irequest_full]->occasional = 1;
|
||||
auto req = neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL);
|
||||
req->set_id(1);
|
||||
req->set_cutoff(dcut);
|
||||
|
||||
// also need occasional half neighbor list derived from pair style
|
||||
// used for building local bond list
|
||||
@ -326,11 +320,8 @@ void FixHyperLocal::init()
|
||||
// this list will also be built (or derived/copied)
|
||||
// every time build_bond() is called
|
||||
|
||||
int irequest_half = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest_half]->id = 2;
|
||||
neighbor->requests[irequest_half]->pair = 0;
|
||||
neighbor->requests[irequest_half]->fix = 1;
|
||||
neighbor->requests[irequest_half]->occasional = 1;
|
||||
req = neighbor->add_request(this, NeighConst::REQ_OCCASIONAL);
|
||||
req->set_id(2);
|
||||
|
||||
// extra timing output
|
||||
|
||||
|
||||
@ -50,7 +50,6 @@
|
||||
#include "math_special.h"
|
||||
#include "memory.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "neighbor.h"
|
||||
#include "update.h"
|
||||
|
||||
@ -286,9 +285,7 @@ void PairSMTBQ::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);
|
||||
|
||||
pgsize = neighbor->pgsize;
|
||||
oneatom = neighbor->oneatom;
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
#include "error.h"
|
||||
#include "memory.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "neighbor.h"
|
||||
#include "update.h"
|
||||
|
||||
@ -55,9 +54,7 @@ PairSPHRhoSum::~PairSPHRhoSum() {
|
||||
|
||||
void PairSPHRhoSum::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);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -90,9 +90,7 @@ void PairSpin::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);
|
||||
|
||||
// get the lattice_flag from nve/spin
|
||||
|
||||
|
||||
Reference in New Issue
Block a user