apply clang-format to packages

This commit is contained in:
Axel Kohlmeyer
2021-08-23 21:05:48 -04:00
parent 686f41731f
commit 9a19a814e4
97 changed files with 2029 additions and 2038 deletions

View File

@ -49,7 +49,8 @@ AtomVecOxdna::AtomVecOxdna(LAMMPS *lmp) : AtomVec(lmp)
setup_fields();
if(!force->newton_bond) error->warning(FLERR,"Write_data command requires newton on to preserve 3'->5' bond polarity");
if (!force->newton_bond)
error->warning(FLERR, "Write_data command requires newton on to preserve 3'->5' bond polarity");
}
/* ---------------------------------------------------------------------- */

View File

@ -17,12 +17,12 @@
#include "bond_oxdna_fene.h"
#include "atom.h"
#include "neighbor.h"
#include "comm.h"
#include "update.h"
#include "error.h"
#include "force.h"
#include "memory.h"
#include "error.h"
#include "neighbor.h"
#include "update.h"
#include "atom_vec_ellipsoid.h"
#include "math_extra.h"
@ -43,54 +43,52 @@ BondOxdnaFene::~BondOxdnaFene()
}
}
/* ----------------------------------------------------------------------
compute vector COM-sugar-phosphate backbone interaction site in oxDNA
------------------------------------------------------------------------- */
void BondOxdnaFene::compute_interaction_sites(double e1[3], double /*e2*/[3],
double /*e3*/[3], double r[3]) const
void BondOxdnaFene::compute_interaction_sites(double e1[3], double /*e2*/[3], double /*e3*/[3],
double r[3]) const
{
constexpr double d_cs=-0.4;
constexpr double d_cs = -0.4;
r[0] = d_cs*e1[0];
r[1] = d_cs*e1[1];
r[2] = d_cs*e1[2];
r[0] = d_cs * e1[0];
r[1] = d_cs * e1[1];
r[2] = d_cs * e1[2];
}
/* ----------------------------------------------------------------------
tally energy and virial into global and per-atom accumulators
------------------------------------------------------------------------- */
void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond,
double ebond,
double fx, double fy, double fz,
double delx, double dely, double delz)
void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, double ebond, double fx,
double fy, double fz, double delx, double dely, double delz)
{
double ebondhalf,v[6];
double ebondhalf, v[6];
if (eflag_either) {
if (eflag_global) {
if (newton_bond) energy += ebond;
if (newton_bond)
energy += ebond;
else {
ebondhalf = 0.5*ebond;
ebondhalf = 0.5 * ebond;
if (i < nlocal) energy += ebondhalf;
if (j < nlocal) energy += ebondhalf;
}
}
if (eflag_atom) {
ebondhalf = 0.5*ebond;
ebondhalf = 0.5 * ebond;
if (newton_bond || i < nlocal) eatom[i] += ebondhalf;
if (newton_bond || j < nlocal) eatom[j] += ebondhalf;
}
}
if (vflag_either) {
v[0] = delx*fx;
v[1] = dely*fy;
v[2] = delz*fz;
v[3] = delx*fy;
v[4] = delx*fz;
v[5] = dely*fz;
v[0] = delx * fx;
v[1] = dely * fy;
v[2] = delz * fz;
v[3] = delx * fy;
v[4] = delx * fz;
v[5] = dely * fz;
if (vflag_global) {
if (newton_bond) {
@ -102,40 +100,40 @@ void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond,
virial[5] += v[5];
} else {
if (i < nlocal) {
virial[0] += 0.5*v[0];
virial[1] += 0.5*v[1];
virial[2] += 0.5*v[2];
virial[3] += 0.5*v[3];
virial[4] += 0.5*v[4];
virial[5] += 0.5*v[5];
virial[0] += 0.5 * v[0];
virial[1] += 0.5 * v[1];
virial[2] += 0.5 * v[2];
virial[3] += 0.5 * v[3];
virial[4] += 0.5 * v[4];
virial[5] += 0.5 * v[5];
}
if (j < nlocal) {
virial[0] += 0.5*v[0];
virial[1] += 0.5*v[1];
virial[2] += 0.5*v[2];
virial[3] += 0.5*v[3];
virial[4] += 0.5*v[4];
virial[5] += 0.5*v[5];
virial[0] += 0.5 * v[0];
virial[1] += 0.5 * v[1];
virial[2] += 0.5 * v[2];
virial[3] += 0.5 * v[3];
virial[4] += 0.5 * v[4];
virial[5] += 0.5 * v[5];
}
}
}
if (vflag_atom) {
if (newton_bond || i < nlocal) {
vatom[i][0] += 0.5*v[0];
vatom[i][1] += 0.5*v[1];
vatom[i][2] += 0.5*v[2];
vatom[i][3] += 0.5*v[3];
vatom[i][4] += 0.5*v[4];
vatom[i][5] += 0.5*v[5];
vatom[i][0] += 0.5 * v[0];
vatom[i][1] += 0.5 * v[1];
vatom[i][2] += 0.5 * v[2];
vatom[i][3] += 0.5 * v[3];
vatom[i][4] += 0.5 * v[4];
vatom[i][5] += 0.5 * v[5];
}
if (newton_bond || j < nlocal) {
vatom[j][0] += 0.5*v[0];
vatom[j][1] += 0.5*v[1];
vatom[j][2] += 0.5*v[2];
vatom[j][3] += 0.5*v[3];
vatom[j][4] += 0.5*v[4];
vatom[j][5] += 0.5*v[5];
vatom[j][0] += 0.5 * v[0];
vatom[j][1] += 0.5 * v[1];
vatom[j][2] += 0.5 * v[2];
vatom[j][3] += 0.5 * v[3];
vatom[j][4] += 0.5 * v[4];
vatom[j][5] += 0.5 * v[5];
}
}
}
@ -147,16 +145,16 @@ void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond,
------------------------------------------------------------------------- */
void BondOxdnaFene::compute(int eflag, int vflag)
{
int a,b,in,type;
double delf[3],delta[3],deltb[3]; // force, torque increment;;
double delr[3],ebond,fbond;
double rsq,Deltasq,rlogarg;
double r,rr0,rr0sq;
int a, b, in, type;
double delf[3], delta[3], deltb[3]; // force, torque increment;;
double delr[3], ebond, fbond;
double rsq, Deltasq, rlogarg;
double r, rr0, rr0sq;
// vectors COM-backbone site in lab frame
double ra_cs[3],rb_cs[3];
double ra_cs[3], rb_cs[3];
double *qa,ax[3],ay[3],az[3];
double *qb,bx[3],by[3],bz[3];
double *qa, ax[3], ay[3], az[3];
double *qb, bx[3], by[3], bz[3];
double **x = atom->x;
double **f = atom->f;
@ -172,7 +170,7 @@ void BondOxdnaFene::compute(int eflag, int vflag)
int newton_bond = force->newton_bond;
ebond = 0.0;
ev_init(eflag,vflag);
ev_init(eflag, vflag);
// loop over FENE bonds
@ -182,47 +180,45 @@ void BondOxdnaFene::compute(int eflag, int vflag)
b = bondlist[in][0];
type = bondlist[in][2];
qa=bonus[ellipsoid[a]].quat;
MathExtra::q_to_exyz(qa,ax,ay,az);
qb=bonus[ellipsoid[b]].quat;
MathExtra::q_to_exyz(qb,bx,by,bz);
qa = bonus[ellipsoid[a]].quat;
MathExtra::q_to_exyz(qa, ax, ay, az);
qb = bonus[ellipsoid[b]].quat;
MathExtra::q_to_exyz(qb, bx, by, bz);
// vector COM-backbone site a and b
compute_interaction_sites(ax,ay,az,ra_cs);
compute_interaction_sites(bx,by,bz,rb_cs);
compute_interaction_sites(ax, ay, az, ra_cs);
compute_interaction_sites(bx, by, bz, rb_cs);
// vector backbone site b to a
delr[0] = x[a][0] + ra_cs[0] - x[b][0] - rb_cs[0];
delr[1] = x[a][1] + ra_cs[1] - x[b][1] - rb_cs[1];
delr[2] = x[a][2] + ra_cs[2] - x[b][2] - rb_cs[2];
rsq = delr[0]*delr[0] + delr[1]*delr[1] + delr[2]*delr[2];
rsq = delr[0] * delr[0] + delr[1] * delr[1] + delr[2] * delr[2];
r = sqrt(rsq);
rr0 = r - r0[type];
rr0sq = rr0*rr0;
rr0sq = rr0 * rr0;
Deltasq = Delta[type] * Delta[type];
rlogarg = 1.0 - rr0sq/Deltasq;
rlogarg = 1.0 - rr0sq / Deltasq;
// if r -> Delta, then rlogarg < 0.0 which is an error
// issue a warning and reset rlogarg = epsilon
// if r > 2*Delta something serious is wrong, abort
if (rlogarg < 0.1) {
error->warning(FLERR,"FENE bond too long: {} {} {} {}",
update->ntimestep,atom->tag[a],atom->tag[b],r);
error->warning(FLERR, "FENE bond too long: {} {} {} {}", update->ntimestep, atom->tag[a],
atom->tag[b], r);
rlogarg = 0.1;
}
fbond = -k[type]*rr0/rlogarg/Deltasq/r;
delf[0] = delr[0]*fbond;
delf[1] = delr[1]*fbond;
delf[2] = delr[2]*fbond;
fbond = -k[type] * rr0 / rlogarg / Deltasq / r;
delf[0] = delr[0] * fbond;
delf[1] = delr[1] * fbond;
delf[2] = delr[2] * fbond;
// energy
if (eflag) {
ebond = -0.5 * k[type]*log(rlogarg);
}
if (eflag) { ebond = -0.5 * k[type] * log(rlogarg); }
// apply force and torque to each of 2 atoms
@ -232,12 +228,11 @@ void BondOxdnaFene::compute(int eflag, int vflag)
f[a][1] += delf[1];
f[a][2] += delf[2];
MathExtra::cross3(ra_cs,delf,delta);
MathExtra::cross3(ra_cs, delf, delta);
torque[a][0] += delta[0];
torque[a][1] += delta[1];
torque[a][2] += delta[2];
}
if (newton_bond || b < nlocal) {
@ -246,23 +241,21 @@ void BondOxdnaFene::compute(int eflag, int vflag)
f[b][1] -= delf[1];
f[b][2] -= delf[2];
MathExtra::cross3(rb_cs,delf,deltb);
MathExtra::cross3(rb_cs, delf, deltb);
torque[b][0] -= deltb[0];
torque[b][1] -= deltb[1];
torque[b][2] -= deltb[2];
}
// increment energy and virial
// NOTE: The virial is calculated on the 'molecular' basis.
// (see G. Ciccotti and J.P. Ryckaert, Comp. Phys. Rep. 4, 345-392 (1986))
if (evflag) ev_tally_xyz(a,b,nlocal,newton_bond,ebond,
delf[0],delf[1],delf[2],x[a][0]-x[b][0],x[a][1]-x[b][1],x[a][2]-x[b][2]);
if (evflag)
ev_tally_xyz(a, b, nlocal, newton_bond, ebond, delf[0], delf[1], delf[2], x[a][0] - x[b][0],
x[a][1] - x[b][1], x[a][2] - x[b][2]);
}
}
/* ---------------------------------------------------------------------- */
@ -272,13 +265,12 @@ void BondOxdnaFene::allocate()
allocated = 1;
int n = atom->nbondtypes;
memory->create(k,n+1,"bond:k");
memory->create(Delta,n+1,"bond:Delta");
memory->create(r0,n+1,"bond:r0");
memory->create(setflag,n+1,"bond:setflag");
memory->create(k, n + 1, "bond:k");
memory->create(Delta, n + 1, "bond:Delta");
memory->create(r0, n + 1, "bond:r0");
memory->create(setflag, n + 1, "bond:setflag");
for (int i = 1; i <= n; i++) setflag[i] = 0;
}
/* ----------------------------------------------------------------------
@ -287,15 +279,15 @@ void BondOxdnaFene::allocate()
void BondOxdnaFene::coeff(int narg, char **arg)
{
if (narg != 4) error->all(FLERR,"Incorrect args for bond coefficients in oxdna/fene");
if (narg != 4) error->all(FLERR, "Incorrect args for bond coefficients in oxdna/fene");
if (!allocated) allocate();
int ilo,ihi;
utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error);
int ilo, ihi;
utils::bounds(FLERR, arg[0], 1, atom->nbondtypes, ilo, ihi, error);
double k_one = utils::numeric(FLERR,arg[1],false,lmp);
double Delta_one = utils::numeric(FLERR,arg[2],false,lmp);
double r0_one = utils::numeric(FLERR,arg[3],false,lmp);
double k_one = utils::numeric(FLERR, arg[1], false, lmp);
double Delta_one = utils::numeric(FLERR, arg[2], false, lmp);
double r0_one = utils::numeric(FLERR, arg[3], false, lmp);
int count = 0;
@ -307,8 +299,7 @@ void BondOxdnaFene::coeff(int narg, char **arg)
count++;
}
if (count == 0) error->all(FLERR,"Incorrect args for bond coefficients in oxdna/fene");
if (count == 0) error->all(FLERR, "Incorrect args for bond coefficients in oxdna/fene");
}
/* ----------------------------------------------------------------------
@ -318,7 +309,9 @@ void BondOxdnaFene::coeff(int narg, char **arg)
void BondOxdnaFene::init_style()
{
if (force->special_lj[1] != 0.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0)
error->all(FLERR,"Must use 'special_bonds lj 0 1 1' with bond style oxdna/fene, oxdna2/fene or oxrna2/fene");
error->all(
FLERR,
"Must use 'special_bonds lj 0 1 1' with bond style oxdna/fene, oxdna2/fene or oxrna2/fene");
}
/* ---------------------------------------------------------------------- */
@ -334,9 +327,9 @@ double BondOxdnaFene::equilibrium_distance(int i)
void BondOxdnaFene::write_restart(FILE *fp)
{
fwrite(&k[1],sizeof(double),atom->nbondtypes,fp);
fwrite(&Delta[1],sizeof(double),atom->nbondtypes,fp);
fwrite(&r0[1],sizeof(double),atom->nbondtypes,fp);
fwrite(&k[1], sizeof(double), atom->nbondtypes, fp);
fwrite(&Delta[1], sizeof(double), atom->nbondtypes, fp);
fwrite(&r0[1], sizeof(double), atom->nbondtypes, fp);
}
/* ----------------------------------------------------------------------
@ -348,13 +341,13 @@ void BondOxdnaFene::read_restart(FILE *fp)
allocate();
if (comm->me == 0) {
utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error);
utils::sfread(FLERR,&Delta[1],sizeof(double),atom->nbondtypes,fp,nullptr,error);
utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error);
utils::sfread(FLERR, &k[1], sizeof(double), atom->nbondtypes, fp, nullptr, error);
utils::sfread(FLERR, &Delta[1], sizeof(double), atom->nbondtypes, fp, nullptr, error);
utils::sfread(FLERR, &r0[1], sizeof(double), atom->nbondtypes, fp, nullptr, error);
}
MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world);
MPI_Bcast(&Delta[1],atom->nbondtypes,MPI_DOUBLE,0,world);
MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world);
MPI_Bcast(&k[1], atom->nbondtypes, MPI_DOUBLE, 0, world);
MPI_Bcast(&Delta[1], atom->nbondtypes, MPI_DOUBLE, 0, world);
MPI_Bcast(&r0[1], atom->nbondtypes, MPI_DOUBLE, 0, world);
for (int i = 1; i <= atom->nbondtypes; i++) setflag[i] = 1;
}
@ -366,32 +359,30 @@ void BondOxdnaFene::read_restart(FILE *fp)
void BondOxdnaFene::write_data(FILE *fp)
{
for (int i = 1; i <= atom->nbondtypes; i++)
fprintf(fp,"%d %g %g %g\n",i,k[i],r0[i],Delta[i]);
fprintf(fp, "%d %g %g %g\n", i, k[i], r0[i], Delta[i]);
}
/* ---------------------------------------------------------------------- */
double BondOxdnaFene::single(int type, double rsq, int /*i*/, int /*j*/,
double &fforce)
double BondOxdnaFene::single(int type, double rsq, int /*i*/, int /*j*/, double &fforce)
{
double r = sqrt(rsq);
double rr0 = r - r0[type];
double rr0sq = rr0*rr0;
double rr0sq = rr0 * rr0;
double Deltasq = Delta[type] * Delta[type];
double rlogarg = 1.0 - rr0sq/Deltasq;
double rlogarg = 1.0 - rr0sq / Deltasq;
// if r -> Delta, then rlogarg < 0.0 which is an error
// issue a warning and reset rlogarg = epsilon
// if r > 2*Delta something serious is wrong, abort
if (rlogarg < 0.1) {
error->warning(FLERR,"FENE bond too long: {} {:.8}",
update->ntimestep,sqrt(rsq));
error->warning(FLERR, "FENE bond too long: {} {:.8}", update->ntimestep, sqrt(rsq));
rlogarg = 0.1;
}
double eng = -0.5 * k[type]*log(rlogarg);
fforce = -k[type]*rr0/rlogarg/Deltasq/r;
double eng = -0.5 * k[type] * log(rlogarg);
fforce = -k[type] * rr0 / rlogarg / Deltasq / r;
return eng;
}

View File

@ -29,7 +29,6 @@
#error must have at least zstd version 1.4 to compile with -DLAMMPS_ZSTD
#endif
namespace LAMMPS_NS {
class ZstdFileWriter : public FileWriter {

View File

@ -431,7 +431,7 @@ void FixPolarizeBEMGMRES::gmres_solve(double *x, double *r)
// fill up h with zero
memset(h, 0, (size_t)(mr + 1) * mr * sizeof(double));
memset(h, 0, (size_t) (mr + 1) * mr * sizeof(double));
// the inner loop k = 1..(n-1)
// build up the k-th Krylov space,
@ -524,7 +524,7 @@ void FixPolarizeBEMGMRES::gmres_solve(double *x, double *r)
#ifdef _POLARIZE_DEBUG
if (comm->me == 0)
error->warning(FLERR,"itr = {}: k = {}, norm(r) = {} norm(b) = {}", itr, k, rho, normb);
error->warning(FLERR, "itr = {}: k = {}, norm(r) = {} norm(b) = {}", itr, k, rho, normb);
#endif
if (rho <= rho_tol && rho <= tol_abs) break;
}
@ -868,7 +868,8 @@ void FixPolarizeBEMGMRES::set_arrays(int i)
/* ---------------------------------------------------------------------- */
int FixPolarizeBEMGMRES::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/)
int FixPolarizeBEMGMRES::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/,
int * /*pbc*/)
{
int m;
for (m = 0; m < n; m++) buf[m] = atom->q[list[m]];

View File

@ -396,7 +396,8 @@ int FixPolarizeBEMICC::modify_param(int narg, char **arg)
/* ---------------------------------------------------------------------- */
int FixPolarizeBEMICC::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/)
int FixPolarizeBEMICC::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/,
int * /*pbc*/)
{
int m;
for (m = 0; m < n; m++) buf[m] = atom->q[list[m]];

View File

@ -538,7 +538,8 @@ int FixPolarizeFunctional::unpack_exchange(int nlocal, double *buf)
/* ---------------------------------------------------------------------- */
int FixPolarizeFunctional::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/)
int FixPolarizeFunctional::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/,
int * /*pbc*/)
{
int m;
for (m = 0; m < n; m++) buf[m] = atom->q[list[m]];
@ -602,7 +603,7 @@ double FixPolarizeFunctional::memory_usage()
bytes += num_induced_charges * sizeof(double); // sum1G2qw
bytes += num_induced_charges * sizeof(double); // sum1G1qw_epsilon
bytes += num_induced_charges * sizeof(double); // sum2ndotGwq_epsilon
bytes += (double)num_ions * num_induced_charges * sizeof(double); // G1qw_real
bytes += (double) num_ions * num_induced_charges * sizeof(double); // G1qw_real
bytes += nmax * sizeof(int); // induced_charge_idx
bytes += nmax * sizeof(int); // ion_idx
bytes += num_induced_charges * sizeof(double); // induced_charges

View File

@ -22,11 +22,11 @@
#include "comm.h"
#include "error.h"
#include "force.h"
#include "neighbor.h"
#include "math_const.h"
#include "memory.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "memory.h"
#include "math_const.h"
#include "neighbor.h"
#include <cmath>
#include <cstring>
@ -55,28 +55,28 @@ PairCoulCutDielectric::~PairCoulCutDielectric()
void PairCoulCutDielectric::compute(int eflag, int vflag)
{
int i,j,ii,jj,inum,jnum,itype,jtype;
double qtmp,etmp,xtmp,ytmp,ztmp,delx,dely,delz,ecoul;
double fpair_i,fpair_j;
double rsq,r2inv,rinv,forcecoul,factor_coul,efield_i;
int *ilist,*jlist,*numneigh,**firstneigh;
int i, j, ii, jj, inum, jnum, itype, jtype;
double qtmp, etmp, xtmp, ytmp, ztmp, delx, dely, delz, ecoul;
double fpair_i, fpair_j;
double rsq, r2inv, rinv, forcecoul, factor_coul, efield_i;
int *ilist, *jlist, *numneigh, **firstneigh;
if (atom->nmax > nmax) {
memory->destroy(efield);
nmax = atom->nmax;
memory->create(efield,nmax,3,"pair:efield");
memory->create(efield, nmax, 3, "pair:efield");
}
ecoul = 0.0;
ev_init(eflag,vflag);
ev_init(eflag, vflag);
double **x = atom->x;
double **f = atom->f;
double *q = atom->q;
double* eps = atom->epsilon;
double** norm = atom->mu;
double* curvature = atom->curvature;
double* area = atom->area;
double *eps = atom->epsilon;
double **norm = atom->mu;
double *curvature = atom->curvature;
double *area = atom->area;
int *type = atom->type;
int nlocal = atom->nlocal;
double *special_coul = force->special_coul;
@ -105,10 +105,10 @@ void PairCoulCutDielectric::compute(int eflag, int vflag)
double curvature_threshold = sqrt(area[i]);
if (curvature[i] < curvature_threshold) {
double sf = curvature[i]/(4.0*MY_PIS*curvature_threshold) * area[i]*q[i];
efield[i][0] = sf*norm[i][0];
efield[i][1] = sf*norm[i][1];
efield[i][2] = sf*norm[i][2];
double sf = curvature[i] / (4.0 * MY_PIS * curvature_threshold) * area[i] * q[i];
efield[i][0] = sf * norm[i][0];
efield[i][1] = sf * norm[i][1];
efield[i][2] = sf * norm[i][2];
} else {
efield[i][0] = efield[i][1] = efield[i][2] = 0;
}
@ -121,37 +121,37 @@ void PairCoulCutDielectric::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] && rsq > EPSILON) {
r2inv = 1.0/rsq;
r2inv = 1.0 / rsq;
rinv = sqrt(r2inv);
efield_i = scale[itype][jtype] * q[j]*rinv;
forcecoul = qtmp*efield_i;
efield_i = scale[itype][jtype] * q[j] * rinv;
forcecoul = qtmp * efield_i;
fpair_i = factor_coul*etmp*forcecoul*r2inv;
f[i][0] += delx*fpair_i;
f[i][1] += dely*fpair_i;
f[i][2] += delz*fpair_i;
fpair_i = factor_coul * etmp * forcecoul * r2inv;
f[i][0] += delx * fpair_i;
f[i][1] += dely * fpair_i;
f[i][2] += delz * fpair_i;
efield_i *= (factor_coul*etmp*r2inv);
efield[i][0] += delx*efield_i;
efield[i][1] += dely*efield_i;
efield[i][2] += delz*efield_i;
efield_i *= (factor_coul * etmp * r2inv);
efield[i][0] += delx * efield_i;
efield[i][1] += dely * efield_i;
efield[i][2] += delz * efield_i;
if (newton_pair && j >= nlocal) {
fpair_j = factor_coul*eps[j]*forcecoul*r2inv;
f[j][0] -= delx*fpair_j;
f[j][1] -= dely*fpair_j;
f[j][2] -= delz*fpair_j;
fpair_j = factor_coul * eps[j] * forcecoul * r2inv;
f[j][0] -= delx * fpair_j;
f[j][1] -= dely * fpair_j;
f[j][2] -= delz * fpair_j;
}
if (eflag) {
ecoul = factor_coul * qqrd2e * scale[itype][jtype] * qtmp*q[j]*(etmp+eps[j])*rinv;
ecoul = factor_coul * qqrd2e * scale[itype][jtype] * qtmp * q[j] * (etmp + eps[j]) * rinv;
ecoul *= 0.5;
}
if (evflag) ev_tally_full(i,0.0,ecoul,fpair_i,delx,dely,delz);
if (evflag) ev_tally_full(i, 0.0, ecoul, fpair_i, delx, dely, delz);
}
}
}
@ -159,7 +159,6 @@ void PairCoulCutDielectric::compute(int eflag, int vflag)
if (vflag_fdotr) virial_fdotr_compute();
}
/* ----------------------------------------------------------------------
init specific to this pair style
------------------------------------------------------------------------- */
@ -167,34 +166,36 @@ void PairCoulCutDielectric::compute(int eflag, int vflag)
void PairCoulCutDielectric::init_style()
{
avec = (AtomVecDielectric *) atom->style_match("dielectric");
if (!avec) error->all(FLERR,"Pair coul/cut/dielectric requires atom style dielectric");
if (!avec) error->all(FLERR, "Pair coul/cut/dielectric requires atom style dielectric");
int irequest = neighbor->request(this,instance_me);
int irequest = neighbor->request(this, instance_me);
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
}
/* ---------------------------------------------------------------------- */
double PairCoulCutDielectric::single(int i, int j, int /*itype*/, int /*jtype*/,
double rsq,
double factor_coul, double /*factor_lj*/,
double &fforce)
double PairCoulCutDielectric::single(int i, int j, int /*itype*/, int /*jtype*/, double rsq,
double factor_coul, double /*factor_lj*/, double &fforce)
{
double r2inv,phicoul,ei,ej;
double* eps = atom->epsilon;
double r2inv, phicoul, ei, ej;
double *eps = atom->epsilon;
r2inv = 1.0/rsq;
fforce = force->qqrd2e * atom->q[i]*atom->q[j]*sqrt(r2inv)*eps[i];
r2inv = 1.0 / rsq;
fforce = force->qqrd2e * atom->q[i] * atom->q[j] * sqrt(r2inv) * eps[i];
double eng = 0.0;
if (eps[i] == 1) ei = 0;
else ei = eps[i];
if (eps[j] == 1) ej = 0;
else ej = eps[j];
phicoul = force->qqrd2e * atom->q[i]*atom->q[j]*sqrt(r2inv);
phicoul *= 0.5*(ei+ej);
eng += factor_coul*phicoul;
if (eps[i] == 1)
ei = 0;
else
ei = eps[i];
if (eps[j] == 1)
ej = 0;
else
ej = eps[j];
phicoul = force->qqrd2e * atom->q[i] * atom->q[j] * sqrt(r2inv);
phicoul *= 0.5 * (ei + ej);
eng += factor_coul * phicoul;
return eng;
}

View File

@ -267,7 +267,8 @@ void PairLJLongCoulLongDielectric::compute(int eflag, int vflag)
if (eflag) evdwl = f * (rn * (rn * lj3i[jtype] - lj4i[jtype]) - offseti[jtype]);
}
}
} else force_lj = evdwl = 0.0;
} else
force_lj = evdwl = 0.0;
fpair_i = (force_coul * etmp + force_lj) * r2inv;
f[i][0] += delx * fpair_i;

View File

@ -184,7 +184,7 @@ void AngleDipole::coeff(int narg, char **arg)
void AngleDipole::init_style()
{
if (!atom->mu_flag || !atom->torque_flag)
error->all(FLERR,"Angle style dipole requires atom attributes mu and torque");
error->all(FLERR, "Angle style dipole requires atom attributes mu and torque");
}
/* ----------------------------------------------------------------------

View File

@ -15,11 +15,11 @@
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neigh_list.h"
#include "memory.h"
#include "math_special.h"
#include "error.h"
#include "force.h"
#include "math_special.h"
#include "memory.h"
#include "neigh_list.h"
#include <cmath>
#include <cstring>
@ -35,25 +35,23 @@ using namespace MathSpecial;
PairMorseSoft::~PairMorseSoft()
{
if (allocated) {
memory->destroy(lambda);
}
if (allocated) { memory->destroy(lambda); }
}
/* ---------------------------------------------------------------------- */
void PairMorseSoft::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,r,dr,dexp,dexp2,dexp3,factor_lj;
double ea,phi,V0,iea2;
int i, j, ii, jj, inum, jnum, itype, jtype;
double xtmp, ytmp, ztmp, delx, dely, delz, evdwl, fpair;
double rsq, r, dr, dexp, dexp2, dexp3, factor_lj;
double ea, phi, V0, iea2;
double D, a, x0, l, B, s1, llf;
int *ilist,*jlist,*numneigh,**firstneigh;
int *ilist, *jlist, *numneigh, **firstneigh;
evdwl = 0.0;
ev_init(eflag,vflag);
ev_init(eflag, vflag);
double **x = atom->x;
double **f = atom->f;
@ -86,7 +84,7 @@ void PairMorseSoft::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]) {
@ -96,58 +94,54 @@ void PairMorseSoft::compute(int eflag, int vflag)
D = d0[itype][jtype];
a = alpha[itype][jtype];
x0 = r0[itype][jtype];
dexp = exp( -a * dr );
dexp2 = dexp*dexp;
dexp3 = dexp2*dexp;
dexp = exp(-a * dr);
dexp2 = dexp * dexp;
dexp3 = dexp2 * dexp;
l = lambda[itype][jtype];
ea = exp( a * x0 );
iea2 = exp( -2.*a*x0 );
ea = exp(a * x0);
iea2 = exp(-2. * a * x0);
V0 = D * dexp * ( dexp - 2.0 );
B = -2.0 * D * iea2 * ( ea - 1.0 ) / 3.0;
V0 = D * dexp * (dexp - 2.0);
B = -2.0 * D * iea2 * (ea - 1.0) / 3.0;
if (l >= shift_range) {
s1 = (l - 1.0) / (shift_range - 1.0);
phi = V0 + B*dexp3 * s1;
phi = V0 + B * dexp3 * s1;
// Force computation:
fpair = 3.0*a*B*dexp3*s1 + 2.0*a*D*(dexp2 - dexp);
fpair = 3.0 * a * B * dexp3 * s1 + 2.0 * a * D * (dexp2 - dexp);
fpair /= r;
} else {
llf = MathSpecial::powint( l / shift_range, nlambda );
phi = V0 + B*dexp3;
llf = MathSpecial::powint(l / shift_range, nlambda);
phi = V0 + B * dexp3;
phi *= llf;
// Force computation:
if (r == 0.0) {
fpair = 0.0;
} else {
fpair = 3.0*a*B*dexp3 + 2.0*a*D*(dexp2 - dexp);
fpair = 3.0 * a * B * dexp3 + 2.0 * a * D * (dexp2 - dexp);
fpair *= llf / r;
}
}
fpair *= factor_lj;
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 = phi*factor_lj;
}
if (eflag) { evdwl = phi * 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);
}
}
}
@ -163,7 +157,7 @@ void PairMorseSoft::allocate()
{
PairMorse::allocate();
int n = atom->ntypes;
memory->create(lambda,n+1,n+1,"pair:lambda");
memory->create(lambda, n + 1, n + 1, "pair:lambda");
}
/* ----------------------------------------------------------------------
@ -172,24 +166,24 @@ void PairMorseSoft::allocate()
void PairMorseSoft::coeff(int narg, char **arg)
{
if (narg < 6 || narg > 7) error->all(FLERR,"Incorrect args for pair coefficients");
if (narg < 6 || narg > 7) 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 d0_one = utils::numeric(FLERR,arg[2],false,lmp);
double alpha_one = utils::numeric(FLERR,arg[3],false,lmp);
double r0_one = utils::numeric(FLERR,arg[4],false,lmp);
double lambda_one = utils::numeric(FLERR,arg[5],false,lmp);
double d0_one = utils::numeric(FLERR, arg[2], false, lmp);
double alpha_one = utils::numeric(FLERR, arg[3], false, lmp);
double r0_one = utils::numeric(FLERR, arg[4], false, lmp);
double lambda_one = utils::numeric(FLERR, arg[5], false, lmp);
double cut_one = cut_global;
if (narg == 7) cut_one = utils::numeric(FLERR,arg[6],false,lmp);
if (narg == 7) cut_one = utils::numeric(FLERR, arg[6], 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++) {
d0[i][j] = d0_one;
alpha[i][j] = alpha_one;
r0[i][j] = r0_one;
@ -200,7 +194,7 @@ void PairMorseSoft::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");
}
/* ----------------------------------------------------------------------
@ -209,33 +203,31 @@ void PairMorseSoft::coeff(int narg, char **arg)
void PairMorseSoft::settings(int narg, char **arg)
{
if (narg != 3) error->all(FLERR,"Illegal pair_style command");
if (narg != 3) error->all(FLERR, "Illegal pair_style command");
nlambda = utils::inumeric(FLERR,arg[0],false,lmp);
shift_range = utils::numeric(FLERR,arg[1],false,lmp);
cut_global = utils::numeric(FLERR,arg[2],false,lmp);
nlambda = utils::inumeric(FLERR, arg[0], false, lmp);
shift_range = utils::numeric(FLERR, arg[1], false, lmp);
cut_global = utils::numeric(FLERR, arg[2], false, lmp);
// 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]) cut[i][j] = cut_global;
}
}
/* ----------------------------------------------------------------------
init for one type pair i,j and corresponding j,i
------------------------------------------------------------------------- */
double PairMorseSoft::init_one(int i, int j)
{
if (setflag[i][j] == 0)
error->all(FLERR,"All pair coeffs are not set");
if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set");
morse1[i][j] = 2.0*d0[i][j]*alpha[i][j];
morse1[i][j] = 2.0 * d0[i][j] * alpha[i][j];
if (offset_flag) {
double l, s1, V0, B, llf;
@ -243,27 +235,28 @@ double PairMorseSoft::init_one(int i, int j)
double D = d0[i][j];
double a = alpha[i][j];
double x0 = r0[i][j];
double dexp = exp( alpha_dr );
double dexp2 = dexp*dexp;
double dexp3 = dexp2*dexp;
double dexp = exp(alpha_dr);
double dexp2 = dexp * dexp;
double dexp3 = dexp2 * dexp;
l = lambda[i][j];
double ea = exp( a*x0 );
double iea2 = exp( -2.*a*x0 );
double ea = exp(a * x0);
double iea2 = exp(-2. * a * x0);
V0 = D * dexp * ( dexp - 2.0 );
B = -2.0 * D * iea2 * ( ea - 1.0 ) / 3.0;
V0 = D * dexp * (dexp - 2.0);
B = -2.0 * D * iea2 * (ea - 1.0) / 3.0;
if (l >= shift_range) {
s1 = (l - 1.0) / (shift_range - 1.0);
offset[i][j] = V0 + B*dexp3 * s1;
offset[i][j] = V0 + B * dexp3 * s1;
} else {
llf = MathSpecial::powint( l / shift_range, nlambda );
offset[i][j] = V0 + B*dexp3;
llf = MathSpecial::powint(l / shift_range, nlambda);
offset[i][j] = V0 + B * dexp3;
offset[i][j] *= llf;
}
} else offset[i][j] = 0.0;
} else
offset[i][j] = 0.0;
d0[j][i] = d0[i][j];
alpha[j][i] = alpha[i][j];
@ -283,16 +276,16 @@ void PairMorseSoft::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(&d0[i][j],sizeof(double),1,fp);
fwrite(&alpha[i][j],sizeof(double),1,fp);
fwrite(&r0[i][j],sizeof(double),1,fp);
fwrite(&lambda[i][j],sizeof(double),1,fp);
fwrite(&cut[i][j],sizeof(double),1,fp);
fwrite(&d0[i][j], sizeof(double), 1, fp);
fwrite(&alpha[i][j], sizeof(double), 1, fp);
fwrite(&r0[i][j], sizeof(double), 1, fp);
fwrite(&lambda[i][j], sizeof(double), 1, fp);
fwrite(&cut[i][j], sizeof(double), 1, fp);
}
}
}
@ -308,25 +301,25 @@ void PairMorseSoft::read_restart(FILE *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,&d0[i][j],sizeof(double),1,fp,nullptr,error);
utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error);
utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error);
utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error);
utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error);
utils::sfread(FLERR, &d0[i][j], sizeof(double), 1, fp, nullptr, error);
utils::sfread(FLERR, &alpha[i][j], sizeof(double), 1, fp, nullptr, error);
utils::sfread(FLERR, &r0[i][j], sizeof(double), 1, fp, nullptr, error);
utils::sfread(FLERR, &lambda[i][j], sizeof(double), 1, fp, nullptr, error);
utils::sfread(FLERR, &cut[i][j], sizeof(double), 1, fp, nullptr, error);
}
MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world);
MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world);
MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world);
MPI_Bcast(&lambda[i][j],1,MPI_DOUBLE,0,world);
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
MPI_Bcast(&d0[i][j], 1, MPI_DOUBLE, 0, world);
MPI_Bcast(&alpha[i][j], 1, MPI_DOUBLE, 0, world);
MPI_Bcast(&r0[i][j], 1, MPI_DOUBLE, 0, world);
MPI_Bcast(&lambda[i][j], 1, MPI_DOUBLE, 0, world);
MPI_Bcast(&cut[i][j], 1, MPI_DOUBLE, 0, world);
}
}
}
@ -338,11 +331,11 @@ void PairMorseSoft::read_restart(FILE *fp)
void PairMorseSoft::write_restart_settings(FILE *fp)
{
fwrite(&nlambda,sizeof(double),1,fp);
fwrite(&shift_range,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(&nlambda, sizeof(double), 1, fp);
fwrite(&shift_range, 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);
}
/* ----------------------------------------------------------------------
@ -353,20 +346,19 @@ void PairMorseSoft::read_restart_settings(FILE *fp)
{
int me = comm->me;
if (me == 0) {
utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error);
utils::sfread(FLERR,&shift_range,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, &nlambda, sizeof(double), 1, fp, nullptr, error);
utils::sfread(FLERR, &shift_range, 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(&nlambda,1,MPI_DOUBLE,0,world);
MPI_Bcast(&shift_range,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(&nlambda, 1, MPI_DOUBLE, 0, world);
MPI_Bcast(&shift_range, 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);
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
@ -374,8 +366,7 @@ void PairMorseSoft::read_restart_settings(FILE *fp)
void PairMorseSoft::write_data(FILE *fp)
{
for (int i = 1; i <= atom->ntypes; i++)
fprintf(fp,"%d %g %g %g %g\n",i,d0[i][i],alpha[i][i],r0[i][i],
lambda[i][i]);
fprintf(fp, "%d %g %g %g %g\n", i, d0[i][i], alpha[i][i], r0[i][i], lambda[i][i]);
}
/* ----------------------------------------------------------------------
@ -386,15 +377,14 @@ void PairMorseSoft::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 %g\n",i,j,d0[i][j],alpha[i][j],r0[i][j],
lambda[i][j],cut[i][j]);
fprintf(fp, "%d %d %g %g %g %g %g\n", i, j, d0[i][j], alpha[i][j], r0[i][j], lambda[i][j],
cut[i][j]);
}
/* ---------------------------------------------------------------------- */
double PairMorseSoft::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 r, dr, dexp, dexp2, dexp3, phi;
double B, D, a, ea, iea2;
@ -405,42 +395,42 @@ double PairMorseSoft::single(int /*i*/, int /*j*/, int itype, int jtype, double
x0 = r0[itype][jtype];
r = sqrt(rsq);
dr = r - r0[itype][jtype];
dexp = exp( -a * dr );
dexp2 = dexp*dexp;
dexp3 = dexp2*dexp;
dexp = exp(-a * dr);
dexp2 = dexp * dexp;
dexp3 = dexp2 * dexp;
l = lambda[itype][jtype];
ea = exp( a * x0 );
iea2 = exp( -2.*a*x0 );
ea = exp(a * x0);
iea2 = exp(-2. * a * x0);
V0 = D * dexp * ( dexp - 2.0 );
B = -2.0 * D * iea2 * ( ea - 1.0 ) / 3.0;
V0 = D * dexp * (dexp - 2.0);
B = -2.0 * D * iea2 * (ea - 1.0) / 3.0;
if (l >= shift_range) {
s1 = (l - 1.0) / (shift_range - 1.0);
phi = V0 + B*dexp3 * s1;
phi = V0 + B * dexp3 * s1;
// Force computation:
fforce = 3.0*a*B*dexp3*s1 + 2.0*a*D*(dexp2 - dexp);
fforce = 3.0 * a * B * dexp3 * s1 + 2.0 * a * D * (dexp2 - dexp);
fforce /= r;
} else {
llf = MathSpecial::powint( l / shift_range, nlambda );
phi = V0 + B*dexp3;
llf = MathSpecial::powint(l / shift_range, nlambda);
phi = V0 + B * dexp3;
phi *= llf;
// Force computation:
if (r == 0.0) {
fforce = 0.0;
} else {
fforce = 3.0*a*B*dexp3 + 2.0*a*D*(dexp2 - dexp);
fforce = 3.0 * a * B * dexp3 + 2.0 * a * D * (dexp2 - dexp);
fforce *= llf / r;
}
}
fforce *= factor_lj;
phi -= offset[itype][jtype];
return factor_lj*phi;
return factor_lj * phi;
}
/* ---------------------------------------------------------------------- */
@ -448,9 +438,9 @@ double PairMorseSoft::single(int /*i*/, int /*j*/, int itype, int jtype, double
void *PairMorseSoft::extract(const char *str, int &dim)
{
dim = 2;
if (strcmp(str,"d0") == 0) return (void *) d0;
if (strcmp(str,"r0") == 0) return (void *) r0;
if (strcmp(str,"alpha") == 0) return (void *) alpha;
if (strcmp(str,"lambda") == 0) return (void *) lambda;
if (strcmp(str, "d0") == 0) return (void *) d0;
if (strcmp(str, "r0") == 0) return (void *) r0;
if (strcmp(str, "alpha") == 0) return (void *) alpha;
if (strcmp(str, "lambda") == 0) return (void *) lambda;
return nullptr;
}

View File

@ -592,4 +592,3 @@ double ComputeFabric::compute_scalar()
scalar = nc;
return nc;
}

View File

@ -67,8 +67,8 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp)
// this is so final order of Modify:fix will conform to input script
fix_history = nullptr;
fix_dummy = (FixDummy *) modify->add_fix("NEIGH_HISTORY_HH_DUMMY"
+ std::to_string(instance_me) + " all DUMMY");
fix_dummy = (FixDummy *) modify->add_fix("NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me) +
" all DUMMY");
}
/* ---------------------------------------------------------------------- */
@ -77,19 +77,21 @@ PairGranHookeHistory::~PairGranHookeHistory()
{
if (copymode) return;
delete [] svector;
delete[] svector;
if (!fix_history) modify->delete_fix("NEIGH_HISTORY_HH_DUMMY"+std::to_string(instance_me));
else modify->delete_fix("NEIGH_HISTORY_HH"+std::to_string(instance_me));
if (!fix_history)
modify->delete_fix("NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me));
else
modify->delete_fix("NEIGH_HISTORY_HH" + std::to_string(instance_me));
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
delete [] onerad_dynamic;
delete [] onerad_frozen;
delete [] maxrad_dynamic;
delete [] maxrad_frozen;
delete[] onerad_dynamic;
delete[] onerad_frozen;
delete[] maxrad_dynamic;
delete[] maxrad_frozen;
}
memory->destroy(mass_rigid);
@ -99,20 +101,20 @@ PairGranHookeHistory::~PairGranHookeHistory()
void PairGranHookeHistory::compute(int eflag, int vflag)
{
int i,j,ii,jj,inum,jnum;
double xtmp,ytmp,ztmp,delx,dely,delz,fx,fy,fz;
double radi,radj,radsum,rsq,r,rinv,rsqinv;
double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3;
double wr1,wr2,wr3;
double vtr1,vtr2,vtr3,vrel;
double mi,mj,meff,damp,ccel,tor1,tor2,tor3;
double fn,fs,fs1,fs2,fs3;
double shrmag,rsht;
int *ilist,*jlist,*numneigh,**firstneigh;
int *touch,**firsttouch;
double *shear,*allshear,**firstshear;
int i, j, ii, jj, inum, jnum;
double xtmp, ytmp, ztmp, delx, dely, delz, fx, fy, fz;
double radi, radj, radsum, rsq, r, rinv, rsqinv;
double vr1, vr2, vr3, vnnr, vn1, vn2, vn3, vt1, vt2, vt3;
double wr1, wr2, wr3;
double vtr1, vtr2, vtr3, vrel;
double mi, mj, meff, damp, ccel, tor1, tor2, tor3;
double fn, fs, fs1, fs2, fs3;
double shrmag, rsht;
int *ilist, *jlist, *numneigh, **firstneigh;
int *touch, **firsttouch;
double *shear, *allshear, **firstshear;
ev_init(eflag,vflag);
ev_init(eflag, vflag);
int shearupdate = 1;
if (update->setupflag) shearupdate = 0;
@ -123,17 +125,19 @@ void PairGranHookeHistory::compute(int eflag, int vflag)
if (fix_rigid && neighbor->ago == 0) {
int tmp;
int *body = (int *) fix_rigid->extract("body",tmp);
double *mass_body = (double *) fix_rigid->extract("masstotal",tmp);
int *body = (int *) fix_rigid->extract("body", tmp);
double *mass_body = (double *) fix_rigid->extract("masstotal", tmp);
if (atom->nmax > nmax) {
memory->destroy(mass_rigid);
nmax = atom->nmax;
memory->create(mass_rigid,nmax,"pair:mass_rigid");
memory->create(mass_rigid, nmax, "pair:mass_rigid");
}
int nlocal = atom->nlocal;
for (i = 0; i < nlocal; i++)
if (body[i] >= 0) mass_rigid[i] = mass_body[body[i]];
else mass_rigid[i] = 0.0;
if (body[i] >= 0)
mass_rigid[i] = mass_body[body[i]];
else
mass_rigid[i] = 0.0;
comm->forward_comm_pair(this);
}
@ -175,24 +179,24 @@ void PairGranHookeHistory::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;
radj = radius[j];
radsum = radi + radj;
if (rsq >= radsum*radsum) {
if (rsq >= radsum * radsum) {
// unset non-touching neighbors
touch[jj] = 0;
shear = &allshear[3*jj];
shear = &allshear[3 * jj];
shear[0] = 0.0;
shear[1] = 0.0;
shear[2] = 0.0;
} else {
r = sqrt(rsq);
rinv = 1.0/r;
rsqinv = 1.0/rsq;
rinv = 1.0 / r;
rsqinv = 1.0 / rsq;
// relative translational velocity
@ -202,10 +206,10 @@ void PairGranHookeHistory::compute(int eflag, int vflag)
// normal component
vnnr = vr1*delx + vr2*dely + vr3*delz;
vn1 = delx*vnnr * rsqinv;
vn2 = dely*vnnr * rsqinv;
vn3 = delz*vnnr * rsqinv;
vnnr = vr1 * delx + vr2 * dely + vr3 * delz;
vn1 = delx * vnnr * rsqinv;
vn2 = dely * vnnr * rsqinv;
vn3 = delz * vnnr * rsqinv;
// tangential component
@ -215,9 +219,9 @@ void PairGranHookeHistory::compute(int eflag, int vflag)
// relative rotational velocity
wr1 = (radi*omega[i][0] + radj*omega[j][0]) * rinv;
wr2 = (radi*omega[i][1] + radj*omega[j][1]) * rinv;
wr3 = (radi*omega[i][2] + radj*omega[j][2]) * rinv;
wr1 = (radi * omega[i][0] + radj * omega[j][0]) * rinv;
wr2 = (radi * omega[i][1] + radj * omega[j][1]) * rinv;
wr3 = (radi * omega[i][2] + radj * omega[j][2]) * rinv;
// meff = effective mass of pair of particles
// if I or J part of rigid body, use body mass
@ -230,99 +234,98 @@ void PairGranHookeHistory::compute(int eflag, int vflag)
if (mass_rigid[j] > 0.0) mj = mass_rigid[j];
}
meff = mi*mj / (mi+mj);
meff = mi * mj / (mi + mj);
if (mask[i] & freeze_group_bit) meff = mj;
if (mask[j] & freeze_group_bit) meff = mi;
// normal forces = Hookian contact + normal velocity damping
damp = meff*gamman*vnnr*rsqinv;
ccel = kn*(radsum-r)*rinv - damp;
damp = meff * gamman * vnnr * rsqinv;
ccel = kn * (radsum - r) * rinv - damp;
if (limit_damping && (ccel < 0.0)) ccel = 0.0;
// relative velocities
vtr1 = vt1 - (delz*wr2-dely*wr3);
vtr2 = vt2 - (delx*wr3-delz*wr1);
vtr3 = vt3 - (dely*wr1-delx*wr2);
vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3;
vtr1 = vt1 - (delz * wr2 - dely * wr3);
vtr2 = vt2 - (delx * wr3 - delz * wr1);
vtr3 = vt3 - (dely * wr1 - delx * wr2);
vrel = vtr1 * vtr1 + vtr2 * vtr2 + vtr3 * vtr3;
vrel = sqrt(vrel);
// shear history effects
touch[jj] = 1;
shear = &allshear[3*jj];
shear = &allshear[3 * jj];
if (shearupdate) {
shear[0] += vtr1*dt;
shear[1] += vtr2*dt;
shear[2] += vtr3*dt;
shear[0] += vtr1 * dt;
shear[1] += vtr2 * dt;
shear[2] += vtr3 * dt;
}
shrmag = sqrt(shear[0]*shear[0] + shear[1]*shear[1] +
shear[2]*shear[2]);
shrmag = sqrt(shear[0] * shear[0] + shear[1] * shear[1] + shear[2] * shear[2]);
// rotate shear displacements
rsht = shear[0]*delx + shear[1]*dely + shear[2]*delz;
rsht = shear[0] * delx + shear[1] * dely + shear[2] * delz;
rsht *= rsqinv;
if (shearupdate) {
shear[0] -= rsht*delx;
shear[1] -= rsht*dely;
shear[2] -= rsht*delz;
shear[0] -= rsht * delx;
shear[1] -= rsht * dely;
shear[2] -= rsht * delz;
}
// tangential forces = shear + tangential velocity damping
fs1 = - (kt*shear[0] + meff*gammat*vtr1);
fs2 = - (kt*shear[1] + meff*gammat*vtr2);
fs3 = - (kt*shear[2] + meff*gammat*vtr3);
fs1 = -(kt * shear[0] + meff * gammat * vtr1);
fs2 = -(kt * shear[1] + meff * gammat * vtr2);
fs3 = -(kt * shear[2] + meff * gammat * vtr3);
// rescale frictional displacements and forces if needed
fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3);
fn = xmu * fabs(ccel*r);
fs = sqrt(fs1 * fs1 + fs2 * fs2 + fs3 * fs3);
fn = xmu * fabs(ccel * r);
if (fs > fn) {
if (shrmag != 0.0) {
shear[0] = (fn/fs) * (shear[0] + meff*gammat*vtr1/kt) -
meff*gammat*vtr1/kt;
shear[1] = (fn/fs) * (shear[1] + meff*gammat*vtr2/kt) -
meff*gammat*vtr2/kt;
shear[2] = (fn/fs) * (shear[2] + meff*gammat*vtr3/kt) -
meff*gammat*vtr3/kt;
fs1 *= fn/fs;
fs2 *= fn/fs;
fs3 *= fn/fs;
} else fs1 = fs2 = fs3 = 0.0;
shear[0] =
(fn / fs) * (shear[0] + meff * gammat * vtr1 / kt) - meff * gammat * vtr1 / kt;
shear[1] =
(fn / fs) * (shear[1] + meff * gammat * vtr2 / kt) - meff * gammat * vtr2 / kt;
shear[2] =
(fn / fs) * (shear[2] + meff * gammat * vtr3 / kt) - meff * gammat * vtr3 / kt;
fs1 *= fn / fs;
fs2 *= fn / fs;
fs3 *= fn / fs;
} else
fs1 = fs2 = fs3 = 0.0;
}
// forces & torques
fx = delx*ccel + fs1;
fy = dely*ccel + fs2;
fz = delz*ccel + fs3;
fx = delx * ccel + fs1;
fy = dely * ccel + fs2;
fz = delz * ccel + fs3;
f[i][0] += fx;
f[i][1] += fy;
f[i][2] += fz;
tor1 = rinv * (dely*fs3 - delz*fs2);
tor2 = rinv * (delz*fs1 - delx*fs3);
tor3 = rinv * (delx*fs2 - dely*fs1);
torque[i][0] -= radi*tor1;
torque[i][1] -= radi*tor2;
torque[i][2] -= radi*tor3;
tor1 = rinv * (dely * fs3 - delz * fs2);
tor2 = rinv * (delz * fs1 - delx * fs3);
tor3 = rinv * (delx * fs2 - dely * fs1);
torque[i][0] -= radi * tor1;
torque[i][1] -= radi * tor2;
torque[i][2] -= radi * tor3;
if (newton_pair || j < nlocal) {
f[j][0] -= fx;
f[j][1] -= fy;
f[j][2] -= fz;
torque[j][0] -= radj*tor1;
torque[j][1] -= radj*tor2;
torque[j][2] -= radj*tor3;
torque[j][0] -= radj * tor1;
torque[j][1] -= radj * tor2;
torque[j][2] -= radj * tor3;
}
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);
}
}
}
@ -339,17 +342,16 @@ void PairGranHookeHistory::allocate()
allocated = 1;
int n = atom->ntypes;
memory->create(setflag,n+1,n+1,"pair:setflag");
memory->create(setflag, n + 1, n + 1, "pair:setflag");
for (int i = 1; i <= n; i++)
for (int j = i; j <= n; j++)
setflag[i][j] = 0;
for (int j = i; j <= n; j++) setflag[i][j] = 0;
memory->create(cutsq,n+1,n+1,"pair:cutsq");
memory->create(cutsq, n + 1, n + 1, "pair:cutsq");
onerad_dynamic = new double[n+1];
onerad_frozen = new double[n+1];
maxrad_dynamic = new double[n+1];
maxrad_frozen = new double[n+1];
onerad_dynamic = new double[n + 1];
onerad_frozen = new double[n + 1];
maxrad_dynamic = new double[n + 1];
maxrad_frozen = new double[n + 1];
}
/* ----------------------------------------------------------------------
@ -358,29 +360,35 @@ void PairGranHookeHistory::allocate()
void PairGranHookeHistory::settings(int narg, char **arg)
{
if (narg != 6 && narg != 7) error->all(FLERR,"Illegal pair_style command");
if (narg != 6 && narg != 7) error->all(FLERR, "Illegal pair_style command");
kn = utils::numeric(FLERR,arg[0],false,lmp);
if (strcmp(arg[1],"NULL") == 0) kt = kn * 2.0/7.0;
else kt = utils::numeric(FLERR,arg[1],false,lmp);
kn = utils::numeric(FLERR, arg[0], false, lmp);
if (strcmp(arg[1], "NULL") == 0)
kt = kn * 2.0 / 7.0;
else
kt = utils::numeric(FLERR, arg[1], false, lmp);
gamman = utils::numeric(FLERR,arg[2],false,lmp);
if (strcmp(arg[3],"NULL") == 0) gammat = 0.5 * gamman;
else gammat = utils::numeric(FLERR,arg[3],false,lmp);
gamman = utils::numeric(FLERR, arg[2], false, lmp);
if (strcmp(arg[3], "NULL") == 0)
gammat = 0.5 * gamman;
else
gammat = utils::numeric(FLERR, arg[3], false, lmp);
xmu = utils::numeric(FLERR,arg[4],false,lmp);
dampflag = utils::inumeric(FLERR,arg[5],false,lmp);
xmu = utils::numeric(FLERR, arg[4], false, lmp);
dampflag = utils::inumeric(FLERR, arg[5], false, lmp);
if (dampflag == 0) gammat = 0.0;
limit_damping = 0;
if (narg == 7) {
if (strcmp(arg[6], "limit_damping") == 0) limit_damping = 1;
else error->all(FLERR,"Illegal pair_style command");
if (strcmp(arg[6], "limit_damping") == 0)
limit_damping = 1;
else
error->all(FLERR, "Illegal pair_style command");
}
if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 ||
xmu < 0.0 || xmu > 10000.0 || dampflag < 0 || dampflag > 1)
error->all(FLERR,"Illegal pair_style command");
if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || xmu < 0.0 || xmu > 10000.0 ||
dampflag < 0 || dampflag > 1)
error->all(FLERR, "Illegal pair_style command");
}
/* ----------------------------------------------------------------------
@ -389,22 +397,22 @@ void PairGranHookeHistory::settings(int narg, char **arg)
void PairGranHookeHistory::coeff(int narg, char **arg)
{
if (narg > 2) error->all(FLERR,"Incorrect args for pair coefficients");
if (narg > 2) 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);
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++) {
setflag[i][j] = 1;
count++;
}
}
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients");
}
/* ----------------------------------------------------------------------
@ -418,13 +426,13 @@ void PairGranHookeHistory::init_style()
// error and warning checks
if (!atom->radius_flag || !atom->rmass_flag)
error->all(FLERR,"Pair granular requires atom attributes radius, rmass");
error->all(FLERR, "Pair granular requires atom attributes radius, rmass");
if (comm->ghost_velocity == 0)
error->all(FLERR,"Pair granular requires ghost atoms store velocity");
error->all(FLERR, "Pair granular requires ghost atoms store velocity");
// need a granular neigh list
int irequest = neighbor->request(this,instance_me);
int irequest = neighbor->request(this, instance_me);
neighbor->requests[irequest]->size = 1;
if (history) neighbor->requests[irequest]->history = 1;
@ -436,16 +444,18 @@ void PairGranHookeHistory::init_style()
if (history && (fix_history == nullptr)) {
auto cmd = fmt::format("NEIGH_HISTORY_HH{} all NEIGH_HISTORY {}", instance_me, size_history);
fix_history = (FixNeighHistory *) modify->replace_fix("NEIGH_HISTORY_HH_DUMMY"
+ std::to_string(instance_me),cmd,1);
fix_history = (FixNeighHistory *) modify->replace_fix(
"NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me), cmd, 1);
fix_history->pair = this;
}
// check for FixFreeze and set freeze_group_bit
int ifreeze = modify->find_fix_by_style("^freeze");
if (ifreeze < 0) freeze_group_bit = 0;
else freeze_group_bit = modify->fix[ifreeze]->groupbit;
if (ifreeze < 0)
freeze_group_bit = 0;
else
freeze_group_bit = modify->fix[ifreeze]->groupbit;
// check for FixRigid so can extract rigid body masses
// FIXME: this only catches the first rigid fix, there may be multiple.
@ -468,13 +478,11 @@ void PairGranHookeHistory::init_style()
onerad_dynamic[i] = onerad_frozen[i] = 0.0;
if (ipour >= 0) {
itype = i;
onerad_dynamic[i] =
*((double *) modify->fix[ipour]->extract("radius",itype));
onerad_dynamic[i] = *((double *) modify->fix[ipour]->extract("radius", itype));
}
if (idep >= 0) {
itype = i;
onerad_dynamic[i] =
*((double *) modify->fix[idep]->extract("radius",itype));
onerad_dynamic[i] = *((double *) modify->fix[idep]->extract("radius", itype));
}
}
@ -485,18 +493,18 @@ void PairGranHookeHistory::init_style()
for (i = 0; i < nlocal; i++)
if (mask[i] & freeze_group_bit)
onerad_frozen[type[i]] = MAX(onerad_frozen[type[i]],radius[i]);
onerad_frozen[type[i]] = MAX(onerad_frozen[type[i]], radius[i]);
else
onerad_dynamic[type[i]] = MAX(onerad_dynamic[type[i]],radius[i]);
onerad_dynamic[type[i]] = MAX(onerad_dynamic[type[i]], radius[i]);
MPI_Allreduce(&onerad_dynamic[1],&maxrad_dynamic[1],atom->ntypes,MPI_DOUBLE,MPI_MAX,world);
MPI_Allreduce(&onerad_frozen[1],&maxrad_frozen[1],atom->ntypes,MPI_DOUBLE,MPI_MAX,world);
MPI_Allreduce(&onerad_dynamic[1], &maxrad_dynamic[1], atom->ntypes, MPI_DOUBLE, MPI_MAX, world);
MPI_Allreduce(&onerad_frozen[1], &maxrad_frozen[1], atom->ntypes, MPI_DOUBLE, MPI_MAX, world);
// set fix which stores history info
if (history) {
int ifix = modify->find_fix("NEIGH_HISTORY_HH"+std::to_string(instance_me));
if (ifix < 0) error->all(FLERR,"Could not find pair fix neigh history ID");
int ifix = modify->find_fix("NEIGH_HISTORY_HH" + std::to_string(instance_me));
if (ifix < 0) error->all(FLERR, "Could not find pair fix neigh history ID");
fix_history = (FixNeighHistory *) modify->fix[ifix];
}
}
@ -512,9 +520,9 @@ double PairGranHookeHistory::init_one(int i, int j)
// cutoff = sum of max I,J radii for
// dynamic/dynamic & dynamic/frozen interactions, but not frozen/frozen
double cutoff = maxrad_dynamic[i]+maxrad_dynamic[j];
cutoff = MAX(cutoff,maxrad_frozen[i]+maxrad_dynamic[j]);
cutoff = MAX(cutoff,maxrad_dynamic[i]+maxrad_frozen[j]);
double cutoff = maxrad_dynamic[i] + maxrad_dynamic[j];
cutoff = MAX(cutoff, maxrad_frozen[i] + maxrad_dynamic[j]);
cutoff = MAX(cutoff, maxrad_dynamic[i] + maxrad_frozen[j]);
return cutoff;
}
@ -526,10 +534,9 @@ void PairGranHookeHistory::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);
for (j = i; j <= atom->ntypes; j++) fwrite(&setflag[i][j], sizeof(int), 1, fp);
}
/* ----------------------------------------------------------------------
@ -541,12 +548,12 @@ void PairGranHookeHistory::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);
}
}
@ -556,12 +563,12 @@ void PairGranHookeHistory::read_restart(FILE *fp)
void PairGranHookeHistory::write_restart_settings(FILE *fp)
{
fwrite(&kn,sizeof(double),1,fp);
fwrite(&kt,sizeof(double),1,fp);
fwrite(&gamman,sizeof(double),1,fp);
fwrite(&gammat,sizeof(double),1,fp);
fwrite(&xmu,sizeof(double),1,fp);
fwrite(&dampflag,sizeof(int),1,fp);
fwrite(&kn, sizeof(double), 1, fp);
fwrite(&kt, sizeof(double), 1, fp);
fwrite(&gamman, sizeof(double), 1, fp);
fwrite(&gammat, sizeof(double), 1, fp);
fwrite(&xmu, sizeof(double), 1, fp);
fwrite(&dampflag, sizeof(int), 1, fp);
}
/* ----------------------------------------------------------------------
@ -571,19 +578,19 @@ void PairGranHookeHistory::write_restart_settings(FILE *fp)
void PairGranHookeHistory::read_restart_settings(FILE *fp)
{
if (comm->me == 0) {
utils::sfread(FLERR,&kn,sizeof(double),1,fp,nullptr,error);
utils::sfread(FLERR,&kt,sizeof(double),1,fp,nullptr,error);
utils::sfread(FLERR,&gamman,sizeof(double),1,fp,nullptr,error);
utils::sfread(FLERR,&gammat,sizeof(double),1,fp,nullptr,error);
utils::sfread(FLERR,&xmu,sizeof(double),1,fp,nullptr,error);
utils::sfread(FLERR,&dampflag,sizeof(int),1,fp,nullptr,error);
utils::sfread(FLERR, &kn, sizeof(double), 1, fp, nullptr, error);
utils::sfread(FLERR, &kt, sizeof(double), 1, fp, nullptr, error);
utils::sfread(FLERR, &gamman, sizeof(double), 1, fp, nullptr, error);
utils::sfread(FLERR, &gammat, sizeof(double), 1, fp, nullptr, error);
utils::sfread(FLERR, &xmu, sizeof(double), 1, fp, nullptr, error);
utils::sfread(FLERR, &dampflag, sizeof(int), 1, fp, nullptr, error);
}
MPI_Bcast(&kn,1,MPI_DOUBLE,0,world);
MPI_Bcast(&kt,1,MPI_DOUBLE,0,world);
MPI_Bcast(&gamman,1,MPI_DOUBLE,0,world);
MPI_Bcast(&gammat,1,MPI_DOUBLE,0,world);
MPI_Bcast(&xmu,1,MPI_DOUBLE,0,world);
MPI_Bcast(&dampflag,1,MPI_INT,0,world);
MPI_Bcast(&kn, 1, MPI_DOUBLE, 0, world);
MPI_Bcast(&kt, 1, MPI_DOUBLE, 0, world);
MPI_Bcast(&gamman, 1, MPI_DOUBLE, 0, world);
MPI_Bcast(&gammat, 1, MPI_DOUBLE, 0, world);
MPI_Bcast(&xmu, 1, MPI_DOUBLE, 0, world);
MPI_Bcast(&dampflag, 1, MPI_INT, 0, world);
}
/* ---------------------------------------------------------------------- */
@ -595,32 +602,30 @@ void PairGranHookeHistory::reset_dt()
/* ---------------------------------------------------------------------- */
double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/,
double rsq,
double /*factor_coul*/, double /*factor_lj*/,
double &fforce)
double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, double rsq,
double /*factor_coul*/, double /*factor_lj*/, double &fforce)
{
double radi,radj,radsum;
double r,rinv,rsqinv,delx,dely,delz;
double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3,wr1,wr2,wr3;
double mi,mj,meff,damp,ccel;
double vtr1,vtr2,vtr3,vrel,shrmag,rsht;
double fs1,fs2,fs3,fs,fn;
double radi, radj, radsum;
double r, rinv, rsqinv, delx, dely, delz;
double vr1, vr2, vr3, vnnr, vn1, vn2, vn3, vt1, vt2, vt3, wr1, wr2, wr3;
double mi, mj, meff, damp, ccel;
double vtr1, vtr2, vtr3, vrel, shrmag, rsht;
double fs1, fs2, fs3, fs, fn;
double *radius = atom->radius;
radi = radius[i];
radj = radius[j];
radsum = radi + radj;
if (rsq >= radsum*radsum) {
if (rsq >= radsum * radsum) {
fforce = 0.0;
for (int m = 0; m < single_extra; m++) svector[m] = 0.0;
return 0.0;
}
r = sqrt(rsq);
rinv = 1.0/r;
rsqinv = 1.0/rsq;
rinv = 1.0 / r;
rsqinv = 1.0 / rsq;
// relative translational velocity
@ -636,10 +641,10 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/,
dely = x[i][1] - x[j][1];
delz = x[i][2] - x[j][2];
vnnr = vr1*delx + vr2*dely + vr3*delz;
vn1 = delx*vnnr * rsqinv;
vn2 = dely*vnnr * rsqinv;
vn3 = delz*vnnr * rsqinv;
vnnr = vr1 * delx + vr2 * dely + vr3 * delz;
vn1 = delx * vnnr * rsqinv;
vn2 = dely * vnnr * rsqinv;
vn3 = delz * vnnr * rsqinv;
// tangential component
@ -650,9 +655,9 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/,
// relative rotational velocity
double **omega = atom->omega;
wr1 = (radi*omega[i][0] + radj*omega[j][0]) * rinv;
wr2 = (radi*omega[i][1] + radj*omega[j][1]) * rinv;
wr3 = (radi*omega[i][2] + radj*omega[j][2]) * rinv;
wr1 = (radi * omega[i][0] + radj * omega[j][0]) * rinv;
wr2 = (radi * omega[i][1] + radj * omega[j][1]) * rinv;
wr3 = (radi * omega[i][2] + radj * omega[j][2]) * rinv;
// meff = effective mass of pair of particles
// if I or J part of rigid body, use body mass
@ -669,22 +674,22 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/,
if (mass_rigid[j] > 0.0) mj = mass_rigid[j];
}
meff = mi*mj / (mi+mj);
meff = mi * mj / (mi + mj);
if (mask[i] & freeze_group_bit) meff = mj;
if (mask[j] & freeze_group_bit) meff = mi;
// normal forces = Hookian contact + normal velocity damping
damp = meff*gamman*vnnr*rsqinv;
ccel = kn*(radsum-r)*rinv - damp;
if(limit_damping && (ccel < 0.0)) ccel = 0.0;
damp = meff * gamman * vnnr * rsqinv;
ccel = kn * (radsum - r) * rinv - damp;
if (limit_damping && (ccel < 0.0)) ccel = 0.0;
// relative velocities
vtr1 = vt1 - (delz*wr2-dely*wr3);
vtr2 = vt2 - (delx*wr3-delz*wr1);
vtr3 = vt3 - (dely*wr1-delx*wr2);
vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3;
vtr1 = vt1 - (delz * wr2 - dely * wr3);
vtr2 = vt2 - (delx * wr3 - delz * wr1);
vtr3 = vt3 - (dely * wr1 - delx * wr2);
vrel = vtr1 * vtr1 + vtr2 * vtr2 + vtr3 * vtr3;
vrel = sqrt(vrel);
// shear history effects
@ -703,33 +708,33 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/,
if (jlist[neighprev] == j) break;
}
double *shear = &allshear[3*neighprev];
shrmag = sqrt(shear[0]*shear[0] + shear[1]*shear[1] +
shear[2]*shear[2]);
double *shear = &allshear[3 * neighprev];
shrmag = sqrt(shear[0] * shear[0] + shear[1] * shear[1] + shear[2] * shear[2]);
// rotate shear displacements
rsht = shear[0]*delx + shear[1]*dely + shear[2]*delz;
rsht = shear[0] * delx + shear[1] * dely + shear[2] * delz;
rsht *= rsqinv;
// tangential forces = shear + tangential velocity damping
fs1 = - (kt*shear[0] + meff*gammat*vtr1);
fs2 = - (kt*shear[1] + meff*gammat*vtr2);
fs3 = - (kt*shear[2] + meff*gammat*vtr3);
fs1 = -(kt * shear[0] + meff * gammat * vtr1);
fs2 = -(kt * shear[1] + meff * gammat * vtr2);
fs3 = -(kt * shear[2] + meff * gammat * vtr3);
// rescale frictional displacements and forces if needed
fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3);
fn = xmu * fabs(ccel*r);
fs = sqrt(fs1 * fs1 + fs2 * fs2 + fs3 * fs3);
fn = xmu * fabs(ccel * r);
if (fs > fn) {
if (shrmag != 0.0) {
fs1 *= fn/fs;
fs2 *= fn/fs;
fs3 *= fn/fs;
fs *= fn/fs;
} else fs1 = fs2 = fs3 = fs = 0.0;
fs1 *= fn / fs;
fs2 *= fn / fs;
fs3 *= fn / fs;
fs *= fn / fs;
} else
fs1 = fs2 = fs3 = fs = 0.0;
}
// set force and return no energy
@ -754,10 +759,10 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/,
/* ---------------------------------------------------------------------- */
int PairGranHookeHistory::pack_forward_comm(int n, int *list, double *buf,
int /*pbc_flag*/, int * /*pbc*/)
int PairGranHookeHistory::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/,
int * /*pbc*/)
{
int i,j,m;
int i, j, m;
m = 0;
for (i = 0; i < n; i++) {
@ -771,12 +776,11 @@ int PairGranHookeHistory::pack_forward_comm(int n, int *list, double *buf,
void PairGranHookeHistory::unpack_forward_comm(int n, int first, double *buf)
{
int i,m,last;
int i, m, last;
m = 0;
last = first + n;
for (i = first; i < last; i++)
mass_rigid[i] = buf[m++];
for (i = first; i < last; i++) mass_rigid[i] = buf[m++];
}
/* ----------------------------------------------------------------------
@ -785,7 +789,7 @@ void PairGranHookeHistory::unpack_forward_comm(int n, int first, double *buf)
double PairGranHookeHistory::memory_usage()
{
double bytes = (double)nmax * sizeof(double);
double bytes = (double) nmax * sizeof(double);
return bytes;
}
@ -795,7 +799,7 @@ double PairGranHookeHistory::memory_usage()
double PairGranHookeHistory::atom2cut(int i)
{
double cut = atom->radius[i]*2;
double cut = atom->radius[i] * 2;
return cut;
}
@ -805,6 +809,6 @@ double PairGranHookeHistory::atom2cut(int i)
double PairGranHookeHistory::radii2cut(double r1, double r2)
{
double cut = r1+r2;
double cut = r1 + r2;
return cut;
}

View File

@ -42,23 +42,22 @@ class AngleCharmmIntel : public AngleCharmm {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc);
void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _use_base;
#endif
#endif
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t k, theta0, k_ub, r_ub; } fc_packed1;
typedef struct {
flt_t k, theta0, k_ub, r_ub;
} fc_packed1;
fc_packed1 *fc;
ForceConst() : _nangletypes(0) {}
@ -74,7 +73,7 @@ class AngleCharmmIntel : public AngleCharmm {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -42,23 +42,22 @@ class AngleHarmonicIntel : public AngleHarmonic {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc);
void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _use_base;
#endif
#endif
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t k, theta0; } fc_packed1;
typedef struct {
flt_t k, theta0;
} fc_packed1;
fc_packed1 *fc;
ForceConst() : _nangletypes(0) {}
@ -74,7 +73,7 @@ class AngleHarmonicIntel : public AngleHarmonic {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -42,23 +42,22 @@ class BondFENEIntel : public BondFENE {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc);
void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _use_base;
#endif
#endif
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t k, ir0sq, sigma, epsilon; } fc_packed1;
typedef struct {
flt_t k, ir0sq, sigma, epsilon;
} fc_packed1;
fc_packed1 *fc;
ForceConst() : _nbondtypes(0) {}
@ -74,7 +73,7 @@ class BondFENEIntel : public BondFENE {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -42,23 +42,22 @@ class BondHarmonicIntel : public BondHarmonic {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc);
void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _use_base;
#endif
#endif
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t k, r0; } fc_packed1;
typedef struct {
flt_t k, r0;
} fc_packed1;
fc_packed1 *fc;
ForceConst() : _nbondtypes(0) {}
@ -74,7 +73,7 @@ class BondHarmonicIntel : public BondHarmonic {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -42,25 +42,26 @@ class DihedralCharmmIntel : public DihedralCharmm {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc);
void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _use_base;
#endif
#endif
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t lj1, lj2, lj3, lj4; } fc_packed1;
typedef struct { flt_t cos_shift, sin_shift, k;
int multiplicity; } fc_packed3;
typedef struct {
flt_t lj1, lj2, lj3, lj4;
} fc_packed1;
typedef struct {
flt_t cos_shift, sin_shift, k;
int multiplicity;
} fc_packed3;
fc_packed1 **ljp;
fc_packed3 *bp;
@ -79,7 +80,7 @@ class DihedralCharmmIntel : public DihedralCharmm {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -42,32 +42,30 @@ class DihedralFourierIntel : public DihedralFourier {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc);
void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _use_base;
#endif
#endif
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t cos_shift, sin_shift, k;
int multiplicity; } fc_packed1;
typedef struct {
flt_t cos_shift, sin_shift, k;
int multiplicity;
} fc_packed1;
fc_packed1 **bp;
ForceConst() : _nbondtypes(0) {}
~ForceConst() { set_ntypes(0, nullptr, nullptr, nullptr); }
void set_ntypes(const int nbondtypes, int *setflag, int *nterms,
Memory *memory);
void set_ntypes(const int nbondtypes, int *setflag, int *nterms, Memory *memory);
private:
int _nbondtypes, _maxnterms;
@ -77,7 +75,7 @@ class DihedralFourierIntel : public DihedralFourier {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -42,24 +42,23 @@ class DihedralHarmonicIntel : public DihedralHarmonic {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc);
void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _use_base;
#endif
#endif
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t cos_shift, sin_shift, k;
int multiplicity; } fc_packed1;
typedef struct {
flt_t cos_shift, sin_shift, k;
int multiplicity;
} fc_packed1;
fc_packed1 *bp;
@ -76,7 +75,7 @@ class DihedralHarmonicIntel : public DihedralHarmonic {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -42,23 +42,22 @@ class DihedralOPLSIntel : public DihedralOPLS {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc);
void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _use_base;
#endif
#endif
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t k1, k2, k3, k4; } fc_packed1;
typedef struct {
flt_t k1, k2, k3, k4;
} fc_packed1;
fc_packed1 *bp;
@ -75,7 +74,7 @@ class DihedralOPLSIntel : public DihedralOPLS {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -25,11 +25,11 @@ FixStyle(INTEL,FixIntel);
#ifndef LMP_FIX_INTEL_H
#define LMP_FIX_INTEL_H
#include "fix.h"
#include "intel_buffers.h"
#include "force.h"
#include "pair.h"
#include "error.h"
#include "fix.h"
#include "force.h"
#include "intel_buffers.h"
#include "pair.h"
#include "update.h"
namespace LAMMPS_NS {
@ -48,13 +48,12 @@ class FixIntel : public Fix {
void setup_pre_reverse(int eflag = 0, int vflag = 0);
bool pair_hybrid_check();
void pair_init_check(const bool cdmessage=false);
void pair_init_check(const bool cdmessage = false);
void bond_init_check();
void kspace_init_check();
void pre_reverse(int eflag = 0, int vflag = 0);
inline void min_pre_reverse(int eflag = 0, int vflag = 0)
{ pre_reverse(eflag, vflag); }
inline void min_pre_reverse(int eflag = 0, int vflag = 0) { pre_reverse(eflag, vflag); }
void post_run() { _print_pkg_info = 1; }
@ -63,45 +62,55 @@ class FixIntel : public Fix {
double memory_usage();
typedef struct { double x,y,z; } lmp_ft;
typedef struct {
double x, y, z;
} lmp_ft;
enum {PREC_MODE_SINGLE, PREC_MODE_MIXED, PREC_MODE_DOUBLE};
enum { PREC_MODE_SINGLE, PREC_MODE_MIXED, PREC_MODE_DOUBLE };
inline int precision() { return _precision_mode; }
inline IntelBuffers<float,float> * get_single_buffers()
{ return _single_buffers; }
inline IntelBuffers<float,double> * get_mixed_buffers()
{ return _mixed_buffers; }
inline IntelBuffers<double,double> * get_double_buffers()
{ return _double_buffers; }
inline IntelBuffers<float, float> *get_single_buffers() { return _single_buffers; }
inline IntelBuffers<float, double> *get_mixed_buffers() { return _mixed_buffers; }
inline IntelBuffers<double, double> *get_double_buffers() { return _double_buffers; }
inline int nbor_pack_width() const { return _nbor_pack_width; }
inline void nbor_pack_width(const int w) { _nbor_pack_width = w; }
inline int three_body_neighbor() { return _three_body_neighbor; }
inline void three_body_neighbor(const int i) { _three_body_neighbor = i; }
inline int need_zero(const int tid) {
if (_need_reduce == 0 && tid > 0) return 1;
else if (_zero_master && tid == 0) { _zero_master = 0; return 1; }
else return 0;
inline int need_zero(const int tid)
{
if (_need_reduce == 0 && tid > 0)
return 1;
else if (_zero_master && tid == 0) {
_zero_master = 0;
return 1;
} else
return 0;
}
inline void set_reduce_flag() { if (_nthreads > 1) _need_reduce = 1; }
inline int lrt() {
inline void set_reduce_flag()
{
if (_nthreads > 1) _need_reduce = 1;
}
inline int lrt()
{
if (force->kspace_match("^pppm/.*intel$", 0) && update->whichflag == 1)
return _lrt;
else return 0;
else
return 0;
}
inline int pppm_table() {
inline int pppm_table()
{
if (force->kspace_match("^pppm/.*intel$", 0))
return INTEL_P3M_TABLE;
else return 0;
else
return 0;
}
protected:
IntelBuffers<float,float> *_single_buffers;
IntelBuffers<float,double> *_mixed_buffers;
IntelBuffers<double,double> *_double_buffers;
IntelBuffers<float, float> *_single_buffers;
IntelBuffers<float, double> *_mixed_buffers;
IntelBuffers<double, double> *_double_buffers;
int _precision_mode, _nthreads, _nbor_pack_width, _three_body_neighbor;
int _pair_intel_count, _pair_hybrid_flag, _print_pkg_info;
@ -109,24 +118,20 @@ class FixIntel : public Fix {
int _pair_hybrid_zero, _hybrid_nonpair, _zero_master;
public:
inline int* get_overflow_flag() { return _overflow_flag; }
inline int* get_off_overflow_flag() { return _off_overflow_flag; }
inline void add_result_array(IntelBuffers<double,double>::vec3_acc_t *f_in,
double *ev_in, const int offload,
const int eatom = 0, const int vatom = 0,
inline int *get_overflow_flag() { return _overflow_flag; }
inline int *get_off_overflow_flag() { return _off_overflow_flag; }
inline void add_result_array(IntelBuffers<double, double>::vec3_acc_t *f_in, double *ev_in,
const int offload, const int eatom = 0, const int vatom = 0,
const int rflag = 0);
inline void add_result_array(IntelBuffers<float,double>::vec3_acc_t *f_in,
double *ev_in, const int offload,
const int eatom = 0, const int vatom = 0,
inline void add_result_array(IntelBuffers<float, double>::vec3_acc_t *f_in, double *ev_in,
const int offload, const int eatom = 0, const int vatom = 0,
const int rflag = 0);
inline void add_result_array(IntelBuffers<float,float>::vec3_acc_t *f_in,
float *ev_in, const int offload,
const int eatom = 0, const int vatom = 0,
inline void add_result_array(IntelBuffers<float, float>::vec3_acc_t *f_in, float *ev_in,
const int offload, const int eatom = 0, const int vatom = 0,
const int rflag = 0);
inline void get_buffern(const int offload, int &nlocal, int &nall,
int &minlocal);
inline void get_buffern(const int offload, int &nlocal, int &nall, int &minlocal);
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
void post_force(int vflag);
inline int coprocessor_number() { return _cop; }
inline int full_host_list() { return _full_host_list; }
@ -135,9 +140,19 @@ class FixIntel : public Fix {
inline int offload_end_neighbor();
inline int offload_end_pair();
inline int host_start_neighbor()
{ if (_offload_noghost) return 0; else return offload_end_neighbor(); }
{
if (_offload_noghost)
return 0;
else
return offload_end_neighbor();
}
inline int host_start_pair()
{ if (_offload_noghost) return 0; else return offload_end_pair(); }
{
if (_offload_noghost)
return 0;
else
return offload_end_pair();
}
inline int offload_nlocal() { return _offload_nlocal; }
inline int offload_nall() { return _offload_nall; }
inline int offload_min_ghost() { return _offload_min_ghost; }
@ -149,18 +164,19 @@ class FixIntel : public Fix {
inline int separate_buffers() { return _separate_buffers; }
inline int offload_noghost() { return _offload_noghost; }
inline void set_offload_noghost(const int v)
{ if (_offload_ghost < 0) _offload_noghost = v; }
{
if (_offload_ghost < 0) _offload_noghost = v;
}
inline void set_neighbor_host_sizes();
inline void zero_timers()
{ memset(_timers, 0, sizeof(double) * NUM_ITIMERS); }
inline void zero_timers() { memset(_timers, 0, sizeof(double) * NUM_ITIMERS); }
inline void start_watch(const int which) { _stopwatch[which] = MPI_Wtime(); }
inline double stop_watch(const int which);
inline double * off_watch_pair() { return _stopwatch_offload_pair; }
inline double * off_watch_neighbor() { return _stopwatch_offload_neighbor; }
inline double *off_watch_pair() { return _stopwatch_offload_pair; }
inline double *off_watch_neighbor() { return _stopwatch_offload_neighbor; }
inline void balance_stamp();
inline void acc_timers();
#else
#else
inline int offload_end_neighbor() { return 0; }
inline int offload_end_pair() { return 0; }
inline int host_start_neighbor() { return 0; }
@ -168,27 +184,27 @@ class FixIntel : public Fix {
inline void zero_timers() {}
inline void start_watch(const int /*which*/) {}
inline double stop_watch(const int /*which*/) { return 0.0; }
double * off_watch_pair() { return nullptr; }
double * off_watch_neighbor() { return nullptr; }
double *off_watch_pair() { return nullptr; }
double *off_watch_neighbor() { return nullptr; }
inline void balance_stamp() {}
inline void acc_timers() {}
inline int separate_buffers() { return 0; }
#endif
#endif
protected:
int _overflow_flag[5];
_alignvar(int _off_overflow_flag[5],64);
_alignvar(int _off_overflow_flag[5], 64);
int _allow_separate_buffers, _offload_ghost, _lrt;
IntelBuffers<float,float>::vec3_acc_t *_force_array_s;
IntelBuffers<float,double>::vec3_acc_t *_force_array_m;
IntelBuffers<double,double>::vec3_acc_t *_force_array_d;
IntelBuffers<float, float>::vec3_acc_t *_force_array_s;
IntelBuffers<float, double>::vec3_acc_t *_force_array_m;
IntelBuffers<double, double>::vec3_acc_t *_force_array_d;
float *_ev_array_s;
double *_ev_array_d;
int _results_eatom, _results_vatom;
int _need_reduce;
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
double _balance_pair_time, _balance_other_time;
int _offload_nlocal, _offload_nall, _offload_min_ghost, _offload_nghost;
int _host_min_local, _host_min_ghost, _host_nall;
@ -198,9 +214,9 @@ class FixIntel : public Fix {
void output_timing_data();
FILE *_tscreen;
IntelBuffers<float,float>::vec3_acc_t *_off_force_array_s;
IntelBuffers<float,double>::vec3_acc_t *_off_force_array_m;
IntelBuffers<double,double>::vec3_acc_t *_off_force_array_d;
IntelBuffers<float, float>::vec3_acc_t *_off_force_array_s;
IntelBuffers<float, double>::vec3_acc_t *_off_force_array_m;
IntelBuffers<double, double>::vec3_acc_t *_off_force_array_d;
float *_off_ev_array_s;
double *_off_ev_array_d;
int _off_results_eatom, _off_results_vatom;
@ -208,48 +224,42 @@ class FixIntel : public Fix {
int get_ppn(int &);
int set_host_affinity(const int);
#endif
#endif
void check_neighbor_intel();
double _offload_balance, _balance_neighbor, _balance_pair, _balance_fixed;
double _timers[NUM_ITIMERS];
double _stopwatch[NUM_ITIMERS];
_alignvar(double _stopwatch_offload_neighbor[1],64);
_alignvar(double _stopwatch_offload_pair[1],64);
_alignvar(double _stopwatch_offload_neighbor[1], 64);
_alignvar(double _stopwatch_offload_pair[1], 64);
void _sync_main_arrays(const int prereverse);
template <class ft>
void reduce_results(ft * _noalias const f_in);
template <class ft> void reduce_results(ft *_noalias const f_in);
template <class ft, class acc_t>
inline void add_results(const ft * _noalias const f_in,
const acc_t * _noalias const ev_global,
const int eatom, const int vatom,
const int offload);
inline void add_results(const ft *_noalias const f_in, const acc_t *_noalias const ev_global,
const int eatom, const int vatom, const int offload);
template <class ft, class acc_t>
inline void add_oresults(const ft * _noalias const f_in,
const acc_t * _noalias const ev_global,
const int eatom, const int vatom,
const int out_offset, const int nall);
inline void add_oresults(const ft *_noalias const f_in, const acc_t *_noalias const ev_global,
const int eatom, const int vatom, const int out_offset, const int nall);
int _offload_affinity_balanced, _offload_threads, _offload_tpc;
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _max_offload_threads, _offload_cores, _offload_affinity_set;
int _im_real_space_task;
MPI_Comm _real_space_comm;
template <class ft, class acc_t>
inline void add_off_results(const ft * _noalias const f_in,
const acc_t * _noalias const ev_global);
#endif
inline void add_off_results(const ft *_noalias const f_in, const acc_t *_noalias const ev_global);
#endif
};
/* ---------------------------------------------------------------------- */
void FixIntel::get_buffern(const int offload, int &nlocal, int &nall,
int &minlocal) {
#ifdef _LMP_INTEL_OFFLOAD
void FixIntel::get_buffern(const int offload, int &nlocal, int &nall, int &minlocal)
{
#ifdef _LMP_INTEL_OFFLOAD
if (_separate_buffers) {
if (offload) {
if (neighbor->ago != 0) {
@ -273,7 +283,7 @@ void FixIntel::get_buffern(const int offload, int &nlocal, int &nall,
if (_offload_noghost && offload)
nall = atom->nlocal;
else
#endif
#endif
nall = atom->nlocal + atom->nghost;
nlocal = atom->nlocal;
minlocal = 0;
@ -281,102 +291,97 @@ void FixIntel::get_buffern(const int offload, int &nlocal, int &nall,
/* ---------------------------------------------------------------------- */
void FixIntel::add_result_array(IntelBuffers<double,double>::vec3_acc_t *f_in,
double *ev_in, const int offload,
const int eatom, const int vatom,
const int rflag) {
#ifdef _LMP_INTEL_OFFLOAD
void FixIntel::add_result_array(IntelBuffers<double, double>::vec3_acc_t *f_in, double *ev_in,
const int offload, const int eatom, const int vatom,
const int rflag)
{
#ifdef _LMP_INTEL_OFFLOAD
if (offload) {
_off_results_eatom = eatom;
_off_results_vatom = vatom;
_off_force_array_d = f_in;
_off_ev_array_d = ev_in;
if (_pair_hybrid_flag && force->pair->fdotr_is_set())
_sync_main_arrays(1);
if (_pair_hybrid_flag && force->pair->fdotr_is_set()) _sync_main_arrays(1);
return;
}
#endif
#endif
_force_array_d = f_in;
_ev_array_d = ev_in;
_results_eatom = eatom;
_results_vatom = vatom;
#ifndef _LMP_INTEL_OFFLOAD
#ifndef _LMP_INTEL_OFFLOAD
if (rflag != 2 && _nthreads > 1 && force->newton) _need_reduce = 1;
#endif
#endif
if (_overflow_flag[LMP_OVERFLOW])
error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
if (_pair_hybrid_flag > 1 ||
(_pair_hybrid_flag && force->pair->fdotr_is_set())) _sync_main_arrays(0);
}
/* ---------------------------------------------------------------------- */
void FixIntel::add_result_array(IntelBuffers<float,double>::vec3_acc_t *f_in,
double *ev_in, const int offload,
const int eatom, const int vatom,
const int rflag) {
#ifdef _LMP_INTEL_OFFLOAD
if (offload) {
_off_results_eatom = eatom;
_off_results_vatom = vatom;
_off_force_array_m = f_in;
_off_ev_array_d = ev_in;
if (_pair_hybrid_flag && force->pair->fdotr_is_set())
_sync_main_arrays(1);
return;
}
#endif
_force_array_m = f_in;
_ev_array_d = ev_in;
_results_eatom = eatom;
_results_vatom = vatom;
#ifndef _LMP_INTEL_OFFLOAD
if (rflag != 2 && _nthreads > 1 && force->newton) _need_reduce = 1;
#endif
if (_overflow_flag[LMP_OVERFLOW])
error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
if (_pair_hybrid_flag > 1 ||
(_pair_hybrid_flag && force->pair->fdotr_is_set()))
if (_pair_hybrid_flag > 1 || (_pair_hybrid_flag && force->pair->fdotr_is_set()))
_sync_main_arrays(0);
}
/* ---------------------------------------------------------------------- */
void FixIntel::add_result_array(IntelBuffers<float,float>::vec3_acc_t *f_in,
float *ev_in, const int offload,
const int eatom, const int vatom,
const int rflag) {
#ifdef _LMP_INTEL_OFFLOAD
void FixIntel::add_result_array(IntelBuffers<float, double>::vec3_acc_t *f_in, double *ev_in,
const int offload, const int eatom, const int vatom,
const int rflag)
{
#ifdef _LMP_INTEL_OFFLOAD
if (offload) {
_off_results_eatom = eatom;
_off_results_vatom = vatom;
_off_force_array_m = f_in;
_off_ev_array_d = ev_in;
if (_pair_hybrid_flag && force->pair->fdotr_is_set()) _sync_main_arrays(1);
return;
}
#endif
_force_array_m = f_in;
_ev_array_d = ev_in;
_results_eatom = eatom;
_results_vatom = vatom;
#ifndef _LMP_INTEL_OFFLOAD
if (rflag != 2 && _nthreads > 1 && force->newton) _need_reduce = 1;
#endif
if (_overflow_flag[LMP_OVERFLOW])
error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
if (_pair_hybrid_flag > 1 || (_pair_hybrid_flag && force->pair->fdotr_is_set()))
_sync_main_arrays(0);
}
/* ---------------------------------------------------------------------- */
void FixIntel::add_result_array(IntelBuffers<float, float>::vec3_acc_t *f_in, float *ev_in,
const int offload, const int eatom, const int vatom,
const int rflag)
{
#ifdef _LMP_INTEL_OFFLOAD
if (offload) {
_off_results_eatom = eatom;
_off_results_vatom = vatom;
_off_force_array_s = f_in;
_off_ev_array_s = ev_in;
if (_pair_hybrid_flag && force->pair->fdotr_is_set())
_sync_main_arrays(1);
if (_pair_hybrid_flag && force->pair->fdotr_is_set()) _sync_main_arrays(1);
return;
}
#endif
#endif
_force_array_s = f_in;
_ev_array_s = ev_in;
_results_eatom = eatom;
_results_vatom = vatom;
#ifndef _LMP_INTEL_OFFLOAD
#ifndef _LMP_INTEL_OFFLOAD
if (rflag != 2 && _nthreads > 1 && force->newton) _need_reduce = 1;
#endif
#endif
if (_overflow_flag[LMP_OVERFLOW])
error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
if (_pair_hybrid_flag > 1 ||
(_pair_hybrid_flag && force->pair->fdotr_is_set()))
if (_pair_hybrid_flag > 1 || (_pair_hybrid_flag && force->pair->fdotr_is_set()))
_sync_main_arrays(0);
}
@ -386,10 +391,10 @@ void FixIntel::add_result_array(IntelBuffers<float,float>::vec3_acc_t *f_in,
/* ---------------------------------------------------------------------- */
int FixIntel::offload_end_neighbor() {
int FixIntel::offload_end_neighbor()
{
if (_offload_balance < 0.0) {
if (atom->nlocal < 2)
error->one(FLERR,"Too few atoms for load balancing offload");
if (atom->nlocal < 2) error->one(FLERR, "Too few atoms for load balancing offload");
double granularity = 1.0 / atom->nlocal;
if (_balance_neighbor < granularity)
_balance_neighbor = granularity + 1e-10;
@ -399,14 +404,18 @@ int FixIntel::offload_end_neighbor() {
return _balance_neighbor * atom->nlocal;
}
int FixIntel::offload_end_pair() {
if (neighbor->ago == 0) return _balance_neighbor * atom->nlocal;
else return _balance_pair * atom->nlocal;
int FixIntel::offload_end_pair()
{
if (neighbor->ago == 0)
return _balance_neighbor * atom->nlocal;
else
return _balance_pair * atom->nlocal;
}
/* ---------------------------------------------------------------------- */
double FixIntel::stop_watch(const int which) {
double FixIntel::stop_watch(const int which)
{
double elapsed = MPI_Wtime() - _stopwatch[which];
_timers[which] += elapsed;
return elapsed;
@ -414,7 +423,8 @@ double FixIntel::stop_watch(const int which) {
/* ---------------------------------------------------------------------- */
void FixIntel::balance_stamp() {
void FixIntel::balance_stamp()
{
if (_offload_balance < 0.0) {
double ct = MPI_Wtime();
_balance_other_time = ct;
@ -424,7 +434,8 @@ void FixIntel::balance_stamp() {
/* ---------------------------------------------------------------------- */
void FixIntel::acc_timers() {
void FixIntel::acc_timers()
{
_timers[TIME_OFFLOAD_PAIR] += *_stopwatch_offload_pair;
if (neighbor->ago == 0) {
_timers[TIME_OFFLOAD_NEIGHBOR] += *_stopwatch_offload_neighbor;
@ -437,7 +448,8 @@ void FixIntel::acc_timers() {
/* ---------------------------------------------------------------------- */
void FixIntel::set_neighbor_host_sizes() {
void FixIntel::set_neighbor_host_sizes()
{
_host_min_local = _overflow_flag[LMP_LOCAL_MIN];
_host_min_ghost = _overflow_flag[LMP_GHOST_MIN];
_host_used_local = atom->nlocal - _host_min_local;
@ -450,7 +462,7 @@ void FixIntel::set_neighbor_host_sizes() {
#endif
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -35,7 +35,7 @@ class FixNPTIntel : public FixNHIntel {
~FixNPTIntel() {}
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -46,7 +46,7 @@ class FixNVEAsphereIntel : public FixNVE {
class AtomVecEllipsoid *avec;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -44,7 +44,7 @@ class FixNVEIntel : public FixNVE {
int _nlocal3, _nlocal_max;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -35,7 +35,7 @@ class FixNVTIntel : public FixNHIntel {
~FixNVTIntel() {}
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -41,7 +41,7 @@ class FixNVTSllodIntel : public FixNHIntel {
void nh_v_temp();
};
}
} // namespace LAMMPS_NS
#endif
#endif
@ -70,4 +70,3 @@ E: Using fix nvt/sllod with no fix deform defined
Self-explanatory.
*/

View File

@ -25,8 +25,8 @@ ImproperStyle(cvff/intel,ImproperCvffIntel);
#ifndef LMP_IMPROPER_CVFF_INTEL_H
#define LMP_IMPROPER_CVFF_INTEL_H
#include "improper_cvff.h"
#include "fix_intel.h"
#include "improper_cvff.h"
namespace LAMMPS_NS {
@ -42,23 +42,23 @@ class ImproperCvffIntel : public ImproperCvff {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc);
void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _use_base;
#endif
#endif
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t k; int sign, multiplicity; } fc_packed1;
typedef struct {
flt_t k;
int sign, multiplicity;
} fc_packed1;
fc_packed1 *fc;
@ -75,7 +75,7 @@ class ImproperCvffIntel : public ImproperCvff {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -25,8 +25,8 @@ ImproperStyle(harmonic/intel,ImproperHarmonicIntel);
#ifndef LMP_IMPROPER_HARMONIC_INTEL_H
#define LMP_IMPROPER_HARMONIC_INTEL_H
#include "improper_harmonic.h"
#include "fix_intel.h"
#include "improper_harmonic.h"
namespace LAMMPS_NS {
@ -42,23 +42,22 @@ class ImproperHarmonicIntel : public ImproperHarmonic {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EVFLAG, int EFLAG, int NEWTON_BOND, class flt_t, class acc_t>
void eval(const int vflag, IntelBuffers<flt_t,acc_t> * buffers,
const ForceConst<flt_t> &fc);
void eval(const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _use_base;
#endif
#endif
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t k, chi; } fc_packed1;
typedef struct {
flt_t k, chi;
} fc_packed1;
fc_packed1 *fc;
@ -75,7 +74,7 @@ class ImproperHarmonicIntel : public ImproperHarmonic {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -23,9 +23,9 @@ NBinStyle(intel,
#ifndef LMP_NBIN_INTEL_H
#define LMP_NBIN_INTEL_H
#include "nbin_standard.h"
#include "fix_intel.h"
#include "memory.h"
#include "nbin_standard.h"
namespace LAMMPS_NS {
@ -35,7 +35,7 @@ class NBinIntel : public NBinStandard {
~NBinIntel();
void bin_atoms_setup(int);
void bin_atoms();
int * get_binpacked() { return _binpacked; }
int *get_binpacked() { return _binpacked; }
private:
FixIntel *_fix;
@ -43,15 +43,14 @@ class NBinIntel : public NBinStandard {
int _precision_mode;
double memory_usage();
template <class flt_t, class acc_t>
void bin_atoms(IntelBuffers<flt_t,acc_t> *);
template <class flt_t, class acc_t> void bin_atoms(IntelBuffers<flt_t, acc_t> *);
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _cop, _offload_alloc;
#endif
#endif
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -37,16 +37,16 @@ class NPairFullBinGhostIntel : public NPairIntel {
NPairFullBinGhostIntel(class LAMMPS *);
~NPairFullBinGhostIntel() {}
void build(class NeighList *);
private:
template<class flt_t, class acc_t>
void fbi(NeighList * list, IntelBuffers<flt_t,acc_t> * buffers);
template<class flt_t, class acc_t, int need_ic>
void fbi(const int offload, NeighList * list,
IntelBuffers<flt_t,acc_t> * buffers,
template <class flt_t, class acc_t>
void fbi(NeighList *list, IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t, int need_ic>
void fbi(const int offload, NeighList *list, IntelBuffers<flt_t, acc_t> *buffers,
const int astart, const int aend);
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -24,8 +24,8 @@ NPairStyle(full/bin/intel,
#ifndef LMP_NPAIR_FULL_BIN_INTEL_H
#define LMP_NPAIR_FULL_BIN_INTEL_H
#include "npair_intel.h"
#include "fix_intel.h"
#include "npair_intel.h"
namespace LAMMPS_NS {
@ -36,11 +36,10 @@ class NPairFullBinIntel : public NPairIntel {
void build(class NeighList *);
private:
template <class flt_t, class acc_t>
void fbi(NeighList *, IntelBuffers<flt_t,acc_t> *);
template <class flt_t, class acc_t> void fbi(NeighList *, IntelBuffers<flt_t, acc_t> *);
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -23,8 +23,8 @@ NPairStyle(half/bin/newton/intel,
#ifndef LMP_NPAIR_HALF_BIN_NEWTON_INTEL_H
#define LMP_NPAIR_HALF_BIN_NEWTON_INTEL_H
#include "npair_intel.h"
#include "fix_intel.h"
#include "npair_intel.h"
namespace LAMMPS_NS {
@ -35,11 +35,10 @@ class NPairHalfBinNewtonIntel : public NPairIntel {
void build(class NeighList *);
private:
template <class flt_t, class acc_t>
void hbni(NeighList *, IntelBuffers<flt_t,acc_t> *);
template <class flt_t, class acc_t> void hbni(NeighList *, IntelBuffers<flt_t, acc_t> *);
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -23,8 +23,8 @@ NPairStyle(half/bin/newton/tri/intel,
#ifndef LMP_NPAIR_HALF_BIN_NEWTON_INTEL_TRI_H
#define LMP_NPAIR_HALF_BIN_NEWTON_INTEL_TRI_H
#include "npair_intel.h"
#include "fix_intel.h"
#include "npair_intel.h"
namespace LAMMPS_NS {
@ -35,11 +35,10 @@ class NPairHalfBinNewtonTriIntel : public NPairIntel {
void build(class NeighList *);
private:
template <class flt_t, class acc_t>
void hbnti(NeighList *, IntelBuffers<flt_t,acc_t> *);
template <class flt_t, class acc_t> void hbnti(NeighList *, IntelBuffers<flt_t, acc_t> *);
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -33,14 +33,13 @@ NPairStyle(halffull/newton/skip/intel,
#ifndef LMP_NPAIR_HALFFULL_NEWTON_INTEL_H
#define LMP_NPAIR_HALFFULL_NEWTON_INTEL_H
#include "npair.h"
#include "fix_intel.h"
#include "npair.h"
#if defined(_OPENMP)
#include <omp.h>
#endif
namespace LAMMPS_NS {
class NPairHalffullNewtonIntel : public NPair {
@ -52,14 +51,12 @@ class NPairHalffullNewtonIntel : public NPair {
protected:
FixIntel *_fix;
template<class flt_t, class acc_t>
void build_t(NeighList *, IntelBuffers<flt_t,acc_t> *);
template <class flt_t, class acc_t> void build_t(NeighList *, IntelBuffers<flt_t, acc_t> *);
template<class flt_t>
void build_t3(NeighList *, int *);
template <class flt_t> void build_t3(NeighList *, int *);
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -31,14 +31,13 @@ NPairStyle(skip/ghost/intel,
#ifndef LMP_NPAIR_SKIP_INTEL_H
#define LMP_NPAIR_SKIP_INTEL_H
#include "npair.h"
#include "fix_intel.h"
#include "npair.h"
#if defined(_OPENMP)
#include <omp.h>
#endif
namespace LAMMPS_NS {
class NPairSkipIntel : public NPair {
@ -52,11 +51,11 @@ class NPairSkipIntel : public NPair {
FixIntel *_fix;
int *_inum_starts, *_inum_counts, *_full_props;
template<class flt_t, int THREE>
template <class flt_t, int THREE>
void build_t(NeighList *, int *numhalf, int *cnumneigh, int *numhalf_skip);
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -25,14 +25,13 @@ PairStyle(airebo/intel,PairAIREBOIntel);
#ifndef LMP_PAIR_AIREBO_INTEL_H
#define LMP_PAIR_AIREBO_INTEL_H
#include "pair.h"
#include "fix_intel.h"
#include "pair.h"
#include "pair_airebo.h"
namespace LAMMPS_NS {
template<class flt_t, class acc_t>
struct PairAIREBOIntelParam;
template <class flt_t, class acc_t> struct PairAIREBOIntelParam;
class PairAIREBOIntel : public PairAIREBO {
public:
@ -40,32 +39,28 @@ class PairAIREBOIntel : public PairAIREBO {
virtual ~PairAIREBOIntel();
virtual void compute(int, int);
virtual void init_style();
protected:
protected:
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers);
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers);
template <int EVFLAG, int EFLAG, class flt_t, class acc_t>
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers,
void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const int astart, const int aend);
template <class flt_t, class acc_t>
void pack_force_const(IntelBuffers<flt_t,acc_t> * buffers);
template <class flt_t, class acc_t> void pack_force_const(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t>
PairAIREBOIntelParam<flt_t,acc_t> get_param();
template <class flt_t, class acc_t> PairAIREBOIntelParam<flt_t, acc_t> get_param();
FixIntel * fix;
FixIntel *fix;
int _cop;
int * REBO_cnumneigh;
int * REBO_num_skin;
int * REBO_list_data;
int *REBO_cnumneigh;
int *REBO_num_skin;
int *REBO_list_data;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -35,7 +35,7 @@ class PairAIREBOMorseIntel : public PairAIREBOIntel {
virtual void settings(int, char **);
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -26,8 +26,8 @@ PairStyle(buck/coul/cut/intel,PairBuckCoulCutIntel);
#ifndef LMP_PAIR_BUCK_COUL_CUT_INTEL_H
#define LMP_PAIR_BUCK_COUL_CUT_INTEL_H
#include "pair_buck_coul_cut.h"
#include "fix_intel.h"
#include "pair_buck_coul_cut.h"
namespace LAMMPS_NS {
@ -38,7 +38,10 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut {
virtual ~PairBuckCoulCutIntel();
virtual void compute(int, int);
void init_style();
typedef struct { float x, y, z; int w; } sng4_t;
typedef struct {
float x, y, z;
int w;
} sng4_t;
private:
FixIntel *fix;
@ -47,36 +50,38 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> * buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers,
void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t buck1, buck2, rhoinv, pad; } c_force_t;
typedef struct { flt_t cutsq, cut_ljsq, cut_coulsq, pad; } c_cut_t;
typedef struct { flt_t a, c, offset, pad; } c_energy_t;
_alignvar(flt_t special_coul[4],64);
_alignvar(flt_t special_lj[4],64);
typedef struct {
flt_t buck1, buck2, rhoinv, pad;
} c_force_t;
typedef struct {
flt_t cutsq, cut_ljsq, cut_coulsq, pad;
} c_cut_t;
typedef struct {
flt_t a, c, offset, pad;
} c_energy_t;
_alignvar(flt_t special_coul[4], 64);
_alignvar(flt_t special_lj[4], 64);
c_force_t **c_force;
c_energy_t **c_energy;
c_cut_t **c_cut;
ForceConst() : _ntypes(0), _ntable(0) {}
~ForceConst() { set_ntypes(0,0,nullptr,_cop); }
~ForceConst() { set_ntypes(0, 0, nullptr, _cop); }
void set_ntypes(const int ntypes, const int ntable, Memory *memory,
const int cop);
void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop);
private:
int _ntypes, _ntable, _cop;
@ -86,7 +91,7 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif // LMP_PAIR_BUCK_COUL_CUT_INTEL_H
#endif

View File

@ -25,8 +25,8 @@ PairStyle(buck/coul/long/intel,PairBuckCoulLongIntel);
#ifndef LMP_PAIR_BUCK_COUL_LONG_INTEL_H
#define LMP_PAIR_BUCK_COUL_LONG_INTEL_H
#include "pair_buck_coul_long.h"
#include "fix_intel.h"
#include "pair_buck_coul_long.h"
namespace LAMMPS_NS {
@ -37,7 +37,10 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong {
virtual ~PairBuckCoulLongIntel();
virtual void compute(int, int);
void init_style();
typedef struct { float x, y, z; int w; } sng4_t;
typedef struct {
float x, y, z;
int w;
} sng4_t;
private:
FixIntel *fix;
@ -46,26 +49,29 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> * buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers,
void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t cutsq, cut_ljsq, buck1, buck2; } c_force_t;
typedef struct { flt_t a, c, offset, pad; } c_energy_t;
typedef struct { flt_t r, dr, f, df; } table_t;
_alignvar(flt_t special_coul[4],64);
_alignvar(flt_t special_lj[4],64);
typedef struct {
flt_t cutsq, cut_ljsq, buck1, buck2;
} c_force_t;
typedef struct {
flt_t a, c, offset, pad;
} c_energy_t;
typedef struct {
flt_t r, dr, f, df;
} table_t;
_alignvar(flt_t special_coul[4], 64);
_alignvar(flt_t special_lj[4], 64);
flt_t g_ewald, tabinnersq;
c_force_t **c_force;
c_energy_t **c_energy;
@ -74,10 +80,9 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong {
flt_t *etable, *detable, *ctable, *dctable;
ForceConst() : _ntypes(0), _ntable(0) {}
~ForceConst() { set_ntypes(0,0,nullptr,_cop); }
~ForceConst() { set_ntypes(0, 0, nullptr, _cop); }
void set_ntypes(const int ntypes, const int ntable, Memory *memory,
const int cop);
void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop);
private:
int _ntypes, _ntable, _cop;
@ -87,7 +92,7 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif // LMP_PAIR_BUCK_COUL_LONG_INTEL_H
#endif

View File

@ -25,55 +25,58 @@ PairStyle(buck/intel,PairBuckIntel);
#ifndef LMP_PAIR_BUCK_INTEL_H
#define LMP_PAIR_BUCK_INTEL_H
#include "pair_buck.h"
#include "fix_intel.h"
#include "pair_buck.h"
namespace LAMMPS_NS {
class PairBuckIntel : public PairBuck {
public:
public:
PairBuckIntel(class LAMMPS *);
virtual ~PairBuckIntel();
virtual void compute(int, int);
void init_style();
typedef struct { float x, y, z; int w; } sng4_t;
typedef struct {
float x, y, z;
int w;
} sng4_t;
private:
private:
FixIntel *fix;
int _cop;
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> * buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers,
void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t buck1, buck2, rhoinv, cutsq; } c_force_t;
typedef struct { flt_t a, c, offset, pad; } c_energy_t;
_alignvar(flt_t special_lj[4],64);
typedef struct {
flt_t buck1, buck2, rhoinv, cutsq;
} c_force_t;
typedef struct {
flt_t a, c, offset, pad;
} c_energy_t;
_alignvar(flt_t special_lj[4], 64);
c_force_t **c_force;
c_energy_t **c_energy;
ForceConst() : _ntypes(0) {}
~ForceConst() { set_ntypes(0,nullptr,_cop); }
~ForceConst() { set_ntypes(0, nullptr, _cop); }
void set_ntypes(const int ntypes, Memory *memory,
const int cop);
void set_ntypes(const int ntypes, Memory *memory, const int cop);
private:
int _ntypes, _cop;
@ -84,7 +87,7 @@ private:
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif // LMP_PAIR_BUCK_INTEL_H
#endif

View File

@ -26,8 +26,8 @@ PairStyle(dpd/intel,PairDPDIntel);
#ifndef LMP_PAIR_DPD_INTEL_H
#define LMP_PAIR_DPD_INTEL_H
#include "pair_dpd.h"
#include "fix_intel.h"
#include "pair_dpd.h"
#ifdef LMP_USE_MKL_RNG
#include "mkl_vsl.h"
@ -52,33 +52,32 @@ class PairDPDIntel : public PairDPD {
FixIntel *fix;
int _cop, _onetype, _nrandom_thread;
#ifdef LMP_USE_MKL_RNG
#ifdef LMP_USE_MKL_RNG
VSLStreamStatePtr *random_thread;
#else
#else
RanMars **random_thread;
#endif
#endif
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int ONETYPE, int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers,
void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
// ----------------------------------------------------------------------
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t icut, a0, gamma, sigma; } fc_packed1;
typedef struct {
flt_t icut, a0, gamma, sigma;
} fc_packed1;
_alignvar(flt_t special_lj[4],64);
_alignvar(flt_t special_lj[4], 64);
fc_packed1 **param;
flt_t **rand_buffer_thread;
int *rngi;
@ -86,8 +85,8 @@ class PairDPDIntel : public PairDPD {
ForceConst() : _ntypes(0) {}
~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); }
void set_ntypes(const int ntypes, const int nthreads, const int max_nbors,
Memory *memory, const int cop);
void set_ntypes(const int ntypes, const int nthreads, const int max_nbors, Memory *memory,
const int cop);
private:
int _ntypes, _cop;
@ -97,7 +96,7 @@ class PairDPDIntel : public PairDPD {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -38,7 +38,7 @@ class PairEAMAlloyIntel : virtual public PairEAMIntel {
void file2array();
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -38,7 +38,7 @@ class PairEAMFSIntel : virtual public PairEAMIntel {
void file2array();
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -21,12 +21,11 @@ PairStyle(eam/intel,PairEAMIntel);
#ifndef LMP_PAIR_EAM_INTEL_H
#define LMP_PAIR_EAM_INTEL_H
#include "pair_eam.h"
#include "fix_intel.h"
#include "pair_eam.h"
namespace LAMMPS_NS {
class PairEAMIntel : public PairEAM {
public:
friend class FixSemiGrandCanonicalMC; // Alex Stukowski option
@ -39,37 +38,34 @@ class PairEAMIntel : public PairEAM {
void unpack_forward_comm(int, int, double *);
protected:
FixIntel *fix;
int _cop, _onetype, _ccache_stride;
float *fp_float;
template <class flt_t>
int pack_forward_comm(int, int *, double *, flt_t *);
template <class flt_t>
void unpack_forward_comm(int, int, double *, flt_t *);
template <class flt_t> int pack_forward_comm(int, int *, double *, flt_t *);
template <class flt_t> void unpack_forward_comm(int, int, double *, flt_t *);
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int ONETYPE, int EFLAG, int NEWTON_PAIR, class flt_t,
class acc_t>
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers,
template <int ONETYPE, int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
// ----------------------------------------------------------------------
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t a, b, c, d; } fc_packed1;
typedef struct { flt_t a, b, c, d, e, f, g, h; } fc_packed2;
typedef struct {
flt_t a, b, c, d;
} fc_packed1;
typedef struct {
flt_t a, b, c, d, e, f, g, h;
} fc_packed2;
flt_t **scale_f;
fc_packed1 *rhor_spline_f, *rhor_spline_e;
@ -79,8 +75,7 @@ class PairEAMIntel : public PairEAM {
ForceConst() : _ntypes(0), _nr(0) {}
~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); }
void set_ntypes(const int ntypes, const int nr, const int nrho,
Memory *memory, const int cop);
void set_ntypes(const int ntypes, const int nr, const int nrho, Memory *memory, const int cop);
inline int rhor_jstride() const { return _nr; }
inline int rhor_istride() const { return _nr * _ntypes; }
inline int frho_stride() const { return _nrho; }
@ -93,7 +88,7 @@ class PairEAMIntel : public PairEAM {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -25,8 +25,8 @@ PairStyle(gayberne/intel,PairGayBerneIntel);
#ifndef LMP_PAIR_GAYBERNE_INTEL_H
#define LMP_PAIR_GAYBERNE_INTEL_H
#include "pair_gayberne.h"
#include "fix_intel.h"
#include "pair_gayberne.h"
namespace LAMMPS_NS {
@ -42,31 +42,32 @@ class PairGayBerneIntel : public PairGayBerne {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers,
void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct {
flt_t cutsq, lj1, lj2, offset, sigma, epsilon, lshape;
int form;
} fc_packed1;
typedef struct { flt_t lj3, lj4; } fc_packed2;
typedef struct { flt_t shape2[4], well[4]; } fc_packed3;
typedef struct {
flt_t lj3, lj4;
} fc_packed2;
typedef struct {
flt_t shape2[4], well[4];
} fc_packed3;
_alignvar(flt_t special_lj[4],64);
_alignvar(flt_t gamma,64);
_alignvar(flt_t upsilon,64);
_alignvar(flt_t mu,64);
_alignvar(flt_t special_lj[4], 64);
_alignvar(flt_t gamma, 64);
_alignvar(flt_t upsilon, 64);
_alignvar(flt_t mu, 64);
fc_packed1 **ijc;
fc_packed2 **lj34;
fc_packed3 *ic;
@ -77,8 +78,8 @@ class PairGayBerneIntel : public PairGayBerne {
ForceConst() : _ntypes(0) {}
~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); }
void set_ntypes(const int ntypes, const int one_length,
const int nthreads, Memory *memory, const int cop);
void set_ntypes(const int ntypes, const int one_length, const int nthreads, Memory *memory,
const int cop);
private:
int _ntypes, _cop;
@ -89,15 +90,14 @@ class PairGayBerneIntel : public PairGayBerne {
ForceConst<double> force_const_double;
int _max_nbors;
double gayberne_lj(const int i, const int j, double a1[3][3],
double b1[3][3], double g1[3][3], double *r12,
const double rsq, double *fforce, double *ttor);
double gayberne_lj(const int i, const int j, double a1[3][3], double b1[3][3], double g1[3][3],
double *r12, const double rsq, double *fforce, double *ttor);
FixIntel *fix;
int _cop;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -25,8 +25,8 @@ PairStyle(lj/charmm/coul/charmm/intel,PairLJCharmmCoulCharmmIntel);
#ifndef LMP_PAIR_LJ_CHARMM_COUL_CHARMM_INTEL_H
#define LMP_PAIR_LJ_CHARMM_COUL_CHARMM_INTEL_H
#include "pair_lj_charmm_coul_charmm.h"
#include "fix_intel.h"
#include "pair_lj_charmm_coul_charmm.h"
namespace LAMMPS_NS {
@ -39,7 +39,10 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm {
virtual void compute(int, int);
void init_style();
typedef struct { float x,y,z; int w; } sng4_t;
typedef struct {
float x, y, z;
int w;
} sng4_t;
private:
FixIntel *fix;
@ -47,30 +50,27 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers,
void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
// ----------------------------------------------------------------------
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
_alignvar(flt_t special_coul[4],64);
_alignvar(flt_t special_lj[4],64);
_alignvar(flt_t special_coul[4], 64);
_alignvar(flt_t special_lj[4], 64);
flt_t **cutsq;
flt_t cut_coulsq, cut_ljsq;
flt_t cut_coul_innersq, cut_lj_innersq;
typename IntelBuffers<flt_t,flt_t>::vec4_t **lj;
typename IntelBuffers<flt_t, flt_t>::vec4_t **lj;
ForceConst() : _ntypes(0) {}
~ForceConst() { set_ntypes(0,nullptr,_cop); }
~ForceConst() { set_ntypes(0, nullptr, _cop); }
void set_ntypes(const int ntypes, Memory *memory, const int cop);
@ -82,7 +82,7 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -25,8 +25,8 @@ PairStyle(lj/charmm/coul/long/intel,PairLJCharmmCoulLongIntel);
#ifndef LMP_PAIR_LJ_CHARMM_COUL_LONG_INTEL_H
#define LMP_PAIR_LJ_CHARMM_COUL_LONG_INTEL_H
#include "pair_lj_charmm_coul_long.h"
#include "fix_intel.h"
#include "pair_lj_charmm_coul_long.h"
namespace LAMMPS_NS {
@ -39,7 +39,10 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong {
virtual void compute(int, int);
void init_style();
typedef struct { float x,y,z; int w; } sng4_t;
typedef struct {
float x, y, z;
int w;
} sng4_t;
private:
FixIntel *fix;
@ -47,36 +50,34 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers,
void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
// ----------------------------------------------------------------------
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t r, dr, f, df; } table_t;
_alignvar(flt_t special_coul[4],64);
_alignvar(flt_t special_lj[4],64);
typedef struct {
flt_t r, dr, f, df;
} table_t;
_alignvar(flt_t special_coul[4], 64);
_alignvar(flt_t special_lj[4], 64);
flt_t **cutsq, g_ewald, tabinnersq;
flt_t cut_coulsq, cut_ljsq;
flt_t cut_lj_innersq;
table_t *table;
flt_t *etable, *detable, *ctable, *dctable;
typename IntelBuffers<flt_t,flt_t>::vec2_t **lj;
typename IntelBuffers<flt_t, flt_t>::vec2_t **lj;
ForceConst() : _ntypes(0), _ntable(0) {}
~ForceConst() { set_ntypes(0,0,nullptr,_cop); }
~ForceConst() { set_ntypes(0, 0, nullptr, _cop); }
void set_ntypes(const int ntypes, const int ntable, Memory *memory,
const int cop);
void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop);
private:
int _ntypes, _ntable, _cop;
@ -86,7 +87,7 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -25,8 +25,8 @@ PairStyle(lj/cut/coul/long/intel,PairLJCutCoulLongIntel);
#ifndef LMP_PAIR_LJ_CUT_COUL_LONG_INTEL_H
#define LMP_PAIR_LJ_CUT_COUL_LONG_INTEL_H
#include "pair_lj_cut_coul_long.h"
#include "fix_intel.h"
#include "pair_lj_cut_coul_long.h"
namespace LAMMPS_NS {
@ -39,7 +39,10 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong {
virtual void compute(int, int);
void init_style();
typedef struct { float x,y,z; int w; } sng4_t;
typedef struct {
float x, y, z;
int w;
} sng4_t;
private:
FixIntel *fix;
@ -47,26 +50,29 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers,
void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
// ----------------------------------------------------------------------
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t cutsq, cut_ljsq, lj1, lj2; } c_force_t;
typedef struct { flt_t lj3, lj4, offset, pad; } c_energy_t;
typedef struct { flt_t r, dr, f, df; } table_t;
_alignvar(flt_t special_coul[4],64);
_alignvar(flt_t special_lj[4],64);
typedef struct {
flt_t cutsq, cut_ljsq, lj1, lj2;
} c_force_t;
typedef struct {
flt_t lj3, lj4, offset, pad;
} c_energy_t;
typedef struct {
flt_t r, dr, f, df;
} table_t;
_alignvar(flt_t special_coul[4], 64);
_alignvar(flt_t special_lj[4], 64);
flt_t g_ewald, tabinnersq;
c_force_t **c_force;
c_energy_t **c_energy;
@ -74,10 +80,9 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong {
flt_t *etable, *detable, *ctable, *dctable;
ForceConst() : _ntypes(0), _ntable(0) {}
~ForceConst() { set_ntypes(0,0,nullptr,_cop); }
~ForceConst() { set_ntypes(0, 0, nullptr, _cop); }
void set_ntypes(const int ntypes, const int ntable, Memory *memory,
const int cop);
void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop);
private:
int _ntypes, _ntable, _cop;
@ -87,7 +92,7 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -25,8 +25,8 @@ PairStyle(lj/cut/intel,PairLJCutIntel);
#ifndef LMP_PAIR_LJ_CUT_INTEL_H
#define LMP_PAIR_LJ_CUT_INTEL_H
#include "pair_lj_cut.h"
#include "fix_intel.h"
#include "pair_lj_cut.h"
namespace LAMMPS_NS {
@ -44,26 +44,27 @@ class PairLJCutIntel : public PairLJCut {
template <class flt_t> class ForceConst;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int ONETYPE, int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t>
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers,
void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
// ----------------------------------------------------------------------
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t cutsq, lj1, lj2, offset; } fc_packed1;
typedef struct { flt_t lj3, lj4; } fc_packed2;
typedef struct {
flt_t cutsq, lj1, lj2, offset;
} fc_packed1;
typedef struct {
flt_t lj3, lj4;
} fc_packed2;
_alignvar(flt_t special_lj[4],64);
_alignvar(flt_t special_lj[4], 64);
fc_packed1 **ljc12o;
fc_packed2 **lj34;
@ -80,7 +81,7 @@ class PairLJCutIntel : public PairLJCut {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -25,16 +25,15 @@ PairStyle(lj/long/coul/long/intel,PairLJLongCoulLongIntel);
#ifndef LMP_PAIR_LJ_LONG_COUL_LONG_INTEL_H
#define LMP_PAIR_LJ_LONG_COUL_LONG_INTEL_H
#include "pair_lj_long_coul_long.h"
#include "fix_intel.h"
#include "pair_lj_long_coul_long.h"
namespace LAMMPS_NS {
class PairLJLongCoulLongIntel : public PairLJLongCoulLong {
class PairLJLongCoulLongIntel : public PairLJLongCoulLong {
public:
PairLJLongCoulLongIntel(class LAMMPS *);
virtual ~PairLJLongCoulLongIntel();
};
}
};
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -35,7 +35,7 @@ class PairREBOIntel : public PairAIREBOIntel {
virtual void settings(int, char **);
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -25,8 +25,8 @@ PairStyle(sw/intel,PairSWIntel);
#ifndef LMP_PAIR_SW_INTEL_H
#define LMP_PAIR_SW_INTEL_H
#include "pair_sw.h"
#include "fix_intel.h"
#include "pair_sw.h"
namespace LAMMPS_NS {
@ -45,26 +45,23 @@ class PairSWIntel : public PairSW {
virtual void allocate();
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int SPQ, int ONETYPE, int EFLAG, class flt_t, class acc_t>
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers, const ForceConst<flt_t> &fc,
const int astart, const int aend);
void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
int _ccache_stride, _spq, _onetype, _onetype3;
#ifdef LMP_USE_AVXCD
#ifdef LMP_USE_AVXCD
int _ccache_stride3;
#endif
#endif
// ----------------------------------------------------------------------
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct {
flt_t cutsq, cut, sigma_gamma, pad;
@ -101,7 +98,7 @@ class PairSWIntel : public PairSW {
ForceConst<double> force_const_double;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -24,8 +24,8 @@ PairStyle(tersoff/intel,PairTersoffIntel);
#ifndef LMP_PAIR_TERSOFF_INTEL_H
#define LMP_PAIR_TERSOFF_INTEL_H
#include "pair.h"
#include "fix_intel.h"
#include "pair.h"
#include "pair_tersoff.h"
#ifdef __INTEL_COMPILER
@ -39,7 +39,10 @@ class PairTersoffIntel : public PairTersoff {
void init_style();
protected:
typedef struct { float x,y,z; int w; } sng4_t;
typedef struct {
float x, y, z;
int w;
} sng4_t;
private:
FixIntel *fix;
@ -48,29 +51,40 @@ class PairTersoffIntel : public PairTersoff {
public: // wo needs secrets?
// ----------------------------------------------------------------------
//
template <class flt_t>
class ForceConst {
template <class flt_t> class ForceConst {
public:
typedef struct { flt_t cutsq; } c_cutoff_t;
typedef struct { flt_t bigr, bigd, lam1, biga; } c_first_loop_t;
typedef struct { flt_t lam2, beta, bigb, powern, c1, c2, c3, c4; } c_second_loop_t;
typedef struct { flt_t lam3, bigr, bigd, c2, d2, h, gamma, powermint; } c_inner_loop_t;
typedef struct { flt_t cutsq, pad[3];
typedef struct {
flt_t cutsq;
} c_cutoff_t;
typedef struct {
flt_t bigr, bigd, lam1, biga;
} c_first_loop_t;
typedef struct {
flt_t lam2, beta, bigb, powern, c1, c2, c3, c4;
} c_second_loop_t;
typedef struct {
flt_t lam3, bigr, bigd, c2, d2, h, gamma, powermint;
} c_inner_loop_t;
typedef struct {
flt_t cutsq, pad[3];
flt_t bigr, bigd, lam1, biga;
flt_t lam2, beta, bigb, powern;
flt_t c1, c2, c3, c4; } c_outer_t;
typedef struct { flt_t cutsq, pad[7];
flt_t c1, c2, c3, c4;
} c_outer_t;
typedef struct {
flt_t cutsq, pad[7];
flt_t lam3, powermint, bigr, bigd;
flt_t c2, d2, h, gamma; } c_inner_t;
c_cutoff_t * * c_cutoff_outer;
c_cutoff_t * * * c_cutoff_inner;
c_first_loop_t * * c_first_loop;
c_second_loop_t * * c_second_loop;
c_inner_loop_t * * * c_inner_loop;
c_outer_t * * c_outer;
c_inner_t * * * c_inner;
flt_t c2, d2, h, gamma;
} c_inner_t;
c_cutoff_t **c_cutoff_outer;
c_cutoff_t ***c_cutoff_inner;
c_first_loop_t **c_first_loop;
c_second_loop_t **c_second_loop;
c_inner_loop_t ***c_inner_loop;
c_outer_t **c_outer;
c_inner_t ***c_inner;
ForceConst() : _ntypes(0) {}
~ForceConst() { set_ntypes(0,nullptr,_cop); }
~ForceConst() { set_ntypes(0, nullptr, _cop); }
void set_ntypes(const int ntypes, Memory *memory, const int cop);
@ -82,19 +96,17 @@ class PairTersoffIntel : public PairTersoff {
ForceConst<double> force_const_double;
template <class flt_t, class acc_t>
void compute(int eflag, int vflag, IntelBuffers<flt_t,acc_t> *buffers,
void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc);
template <int EFLAG, class flt_t, class acc_t>
void eval(const int offload, const int vflag,
IntelBuffers<flt_t,acc_t> * buffers,
void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers,
const ForceConst<flt_t> &fc, const int astart, const int aend);
template <class flt_t, class acc_t>
void pack_force_const(ForceConst<flt_t> &fc,
IntelBuffers<flt_t, acc_t> *buffers);
void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers);
};
}
} // namespace LAMMPS_NS
#endif // __INTEL_COMPILER
#endif

View File

@ -25,21 +25,21 @@ KSpaceStyle(pppm/disp/intel,PPPMDispIntel);
#ifndef LMP_PPPMINTEL_DISP_H
#define LMP_PPPMINTEL_DISP_H
#include "pppm_disp.h"
#include "fix_intel.h"
#include "pppm_disp.h"
namespace LAMMPS_NS {
class PPPMDispIntel : public PPPMDisp {
class PPPMDispIntel : public PPPMDisp {
public:
PPPMDispIntel(class LAMMPS *);
virtual ~PPPMDispIntel();
virtual void init();
virtual void compute(int, int);
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int use_base();
#endif
#endif
protected:
FixIntel *fix;
@ -81,156 +81,148 @@ namespace LAMMPS_NS {
int _use_packing;
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _use_base;
#endif
#endif
template<class flt_t, class acc_t>
void particle_map(double, double, double,
double, int **, int, int,
int, int, int,
int, int, int,
IntelBuffers<flt_t,acc_t> *buffers);
template <class flt_t, class acc_t>
void particle_map(double, double, double, double, int **, int, int, int, int, int, int, int, int,
IntelBuffers<flt_t, acc_t> *buffers);
template<class flt_t, class acc_t, int use_table>
void make_rho_c(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void make_rho_c(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void make_rho_c(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void make_rho_c(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
make_rho_c<flt_t,acc_t,1>(buffers);
make_rho_c<flt_t, acc_t, 1>(buffers);
} else {
make_rho_c<flt_t,acc_t,0>(buffers);
make_rho_c<flt_t, acc_t, 0>(buffers);
}
}
template<class flt_t, class acc_t, int use_table>
void make_rho_g(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void make_rho_g(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void make_rho_g(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void make_rho_g(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
make_rho_g<flt_t,acc_t,1>(buffers);
make_rho_g<flt_t, acc_t, 1>(buffers);
} else {
make_rho_g<flt_t,acc_t,0>(buffers);
make_rho_g<flt_t, acc_t, 0>(buffers);
}
}
template<class flt_t, class acc_t, int use_table>
void make_rho_a(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void make_rho_a(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void make_rho_a(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void make_rho_a(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
make_rho_a<flt_t,acc_t,1>(buffers);
make_rho_a<flt_t, acc_t, 1>(buffers);
} else {
make_rho_a<flt_t,acc_t,0>(buffers);
make_rho_a<flt_t, acc_t, 0>(buffers);
}
}
template<class flt_t, class acc_t, int use_table>
void make_rho_none(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void make_rho_none(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void make_rho_none(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void make_rho_none(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
make_rho_none<flt_t,acc_t,1>(buffers);
make_rho_none<flt_t, acc_t, 1>(buffers);
} else {
make_rho_none<flt_t,acc_t,0>(buffers);
make_rho_none<flt_t, acc_t, 0>(buffers);
}
}
template<class flt_t, class acc_t, int use_table>
void fieldforce_c_ik(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void fieldforce_c_ik(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void fieldforce_c_ik(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void fieldforce_c_ik(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
fieldforce_c_ik<flt_t,acc_t,1>(buffers);
fieldforce_c_ik<flt_t, acc_t, 1>(buffers);
} else {
fieldforce_c_ik<flt_t,acc_t,0>(buffers);
fieldforce_c_ik<flt_t, acc_t, 0>(buffers);
}
}
template<class flt_t, class acc_t, int use_table>
void fieldforce_c_ad(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void fieldforce_c_ad(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void fieldforce_c_ad(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void fieldforce_c_ad(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
fieldforce_c_ad<flt_t,acc_t,1>(buffers);
fieldforce_c_ad<flt_t, acc_t, 1>(buffers);
} else {
fieldforce_c_ad<flt_t,acc_t,0>(buffers);
fieldforce_c_ad<flt_t, acc_t, 0>(buffers);
}
}
template<class flt_t, class acc_t, int use_table>
void fieldforce_g_ik(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void fieldforce_g_ik(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void fieldforce_g_ik(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void fieldforce_g_ik(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
fieldforce_g_ik<flt_t,acc_t,1>(buffers);
fieldforce_g_ik<flt_t, acc_t, 1>(buffers);
} else {
fieldforce_g_ik<flt_t,acc_t,0>(buffers);
fieldforce_g_ik<flt_t, acc_t, 0>(buffers);
}
}
template<class flt_t, class acc_t, int use_table>
void fieldforce_g_ad(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void fieldforce_g_ad(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void fieldforce_g_ad(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void fieldforce_g_ad(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
fieldforce_g_ad<flt_t,acc_t,1>(buffers);
fieldforce_g_ad<flt_t, acc_t, 1>(buffers);
} else {
fieldforce_g_ad<flt_t,acc_t,0>(buffers);
fieldforce_g_ad<flt_t, acc_t, 0>(buffers);
}
}
template<class flt_t, class acc_t, int use_table>
void fieldforce_a_ik(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void fieldforce_a_ik(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void fieldforce_a_ik(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void fieldforce_a_ik(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
fieldforce_a_ik<flt_t,acc_t,1>(buffers);
fieldforce_a_ik<flt_t, acc_t, 1>(buffers);
} else {
fieldforce_a_ik<flt_t,acc_t,0>(buffers);
fieldforce_a_ik<flt_t, acc_t, 0>(buffers);
}
}
template<class flt_t, class acc_t, int use_table>
void fieldforce_a_ad(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void fieldforce_a_ad(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void fieldforce_a_ad(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void fieldforce_a_ad(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
fieldforce_a_ad<flt_t,acc_t,1>(buffers);
fieldforce_a_ad<flt_t, acc_t, 1>(buffers);
} else {
fieldforce_a_ad<flt_t,acc_t,0>(buffers);
fieldforce_a_ad<flt_t, acc_t, 0>(buffers);
}
}
template<class flt_t, class acc_t, int use_table>
void fieldforce_none_ik(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void fieldforce_none_ik(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void fieldforce_none_ik(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void fieldforce_none_ik(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
fieldforce_none_ik<flt_t,acc_t,1>(buffers);
fieldforce_none_ik<flt_t, acc_t, 1>(buffers);
} else {
fieldforce_none_ik<flt_t,acc_t,0>(buffers);
fieldforce_none_ik<flt_t, acc_t, 0>(buffers);
}
}
template<class flt_t, class acc_t, int use_table>
void fieldforce_none_ad(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void fieldforce_none_ad(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void fieldforce_none_ad(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void fieldforce_none_ad(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
fieldforce_none_ad<flt_t,acc_t,1>(buffers);
fieldforce_none_ad<flt_t, acc_t, 1>(buffers);
} else {
fieldforce_none_ad<flt_t,acc_t,0>(buffers);
fieldforce_none_ad<flt_t, acc_t, 0>(buffers);
}
}
void precompute_rho();
};
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -28,8 +28,8 @@ KSpaceStyle(pppm/intel,PPPMIntel);
#ifndef LMP_PPPMINTEL_H
#define LMP_PPPMINTEL_H
#include "pppm.h"
#include "fix_intel.h"
#include "pppm.h"
namespace LAMMPS_NS {
@ -44,9 +44,9 @@ class PPPMIntel : public PPPM {
void compute_second(int, int);
void pack_buffers();
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int use_base();
#endif
#endif
protected:
FixIntel *fix;
@ -63,53 +63,50 @@ class PPPMIntel : public PPPM {
FFT_SCALAR **drho_lookup;
FFT_SCALAR half_rho_scale, half_rho_scale_plus;
#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
int _use_base;
#endif
#endif
virtual void allocate();
template<class flt_t, class acc_t>
void test_function(IntelBuffers<flt_t,acc_t> *buffers);
template <class flt_t, class acc_t> void test_function(IntelBuffers<flt_t, acc_t> *buffers);
void precompute_rho();
template<class flt_t, class acc_t>
void particle_map(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t, int use_table>
void make_rho(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void make_rho(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t> void particle_map(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t, int use_table>
void make_rho(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void make_rho(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
make_rho<flt_t,acc_t,1>(buffers);
make_rho<flt_t, acc_t, 1>(buffers);
} else {
make_rho<flt_t,acc_t,0>(buffers);
make_rho<flt_t, acc_t, 0>(buffers);
}
}
template<class flt_t, class acc_t, int use_table>
void fieldforce_ik(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void fieldforce_ik(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void fieldforce_ik(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void fieldforce_ik(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
fieldforce_ik<flt_t, acc_t, 1>(buffers);
} else {
fieldforce_ik<flt_t, acc_t, 0>(buffers);
}
}
template<class flt_t, class acc_t, int use_table>
void fieldforce_ad(IntelBuffers<flt_t,acc_t> *buffers);
template<class flt_t, class acc_t>
void fieldforce_ad(IntelBuffers<flt_t,acc_t> *buffers) {
template <class flt_t, class acc_t, int use_table>
void fieldforce_ad(IntelBuffers<flt_t, acc_t> *buffers);
template <class flt_t, class acc_t> void fieldforce_ad(IntelBuffers<flt_t, acc_t> *buffers)
{
if (_use_table == 1) {
fieldforce_ad<flt_t,acc_t,1>(buffers);
fieldforce_ad<flt_t, acc_t, 1>(buffers);
} else {
fieldforce_ad<flt_t,acc_t,0>(buffers);
fieldforce_ad<flt_t, acc_t, 0>(buffers);
}
}
FFT_SCALAR ***create3d_offset(FFT_SCALAR ***&, int, int, int,
int, int, int, const char *name);
FFT_SCALAR ***create3d_offset(FFT_SCALAR ***&, int, int, int, int, int, int, const char *name);
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -21,24 +21,24 @@ IntegrateStyle(verlet/lrt/intel,VerletLRTIntel);
#ifndef LMP_VERLET_LRT_INTEL_H
#define LMP_VERLET_LRT_INTEL_H
#include "verlet.h"
#include "pppm_intel.h"
#include "verlet.h"
#ifdef LMP_INTEL_USELRT
#if defined(LMP_INTEL_LRT11) || defined(__APPLE__)
#if __cplusplus > 199711L
#define _LMP_INTEL_LRT_11
#include <thread>
#else
#undef LMP_INTEL_USELRT
#ifdef LMP_INTEL_LRT11
#error C++11 support required for LMP_INTEL_LRT11 define
#endif
#endif
#else
#define _LMP_INTEL_LRT_PTHREAD
#include <pthread.h>
#endif
#if defined(LMP_INTEL_LRT11) || defined(__APPLE__)
#if __cplusplus > 199711L
#define _LMP_INTEL_LRT_11
#include <thread>
#else
#undef LMP_INTEL_USELRT
#ifdef LMP_INTEL_LRT11
#error C++11 support required for LMP_INTEL_LRT11 define
#endif
#endif
#else
#define _LMP_INTEL_LRT_PTHREAD
#include <pthread.h>
#endif
#endif
namespace LAMMPS_NS {
@ -54,17 +54,17 @@ class VerletLRTIntel : public Verlet {
protected:
PPPMIntel *_intel_kspace;
#if defined(_LMP_INTEL_LRT_PTHREAD)
#if defined(_LMP_INTEL_LRT_PTHREAD)
static void *k_launch_loop(void *context);
pthread_t _kspace_thread;
pthread_attr_t _kspace_attr;
pthread_mutex_t _kmutex;
pthread_cond_t _kcond;
int _kspace_ready, _kspace_done, _krun_n;
#endif
#endif
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -261,7 +261,7 @@ void AtomKokkos::map_set()
if (modify->fix[n]->execution_space == Device) device_hash_flag = 1;
if (device_hash_flag) {
Kokkos::deep_copy(d_map_hash,h_map_hash);
Kokkos::deep_copy(d_map_hash, h_map_hash);
k_map_hash.view<LMPDeviceType>() = d_map_hash;
}
}

View File

@ -20,7 +20,6 @@ FixStyle(nvt/kk/host,FixNVTKokkos<LMPHostType>);
// clang-format on
#else
// clang-format off
#ifndef LMP_FIX_NVT_KOKKOS_H
#define LMP_FIX_NVT_KOKKOS_H

View File

@ -778,7 +778,7 @@ void PairEDIP::read_file(char *file)
if (comm->me == 0) {
fp = utils::open_potential(file, lmp, nullptr);
if (fp == nullptr)
error->one(FLERR,"Cannot open EDIP potential file {}: {}", file,utils::getsyserror());
error->one(FLERR, "Cannot open EDIP potential file {}: {}", file, utils::getsyserror());
}
// read each set of params from potential file

View File

@ -886,7 +886,8 @@ void FixMDIEngine::receive_cell(Error *error)
double small = std::numeric_limits<double>::min();
if (fabs(celldata[1]) > small or fabs(celldata[2]) > small or fabs(celldata[3]) > small or
fabs(celldata[5]) > small or fabs(celldata[6]) > small or fabs(celldata[7]) > small) {
error->all(FLERR, "MDI: LAMMPS currently only supports the >CELL command for orthogonal cell vectors");
error->all(FLERR,
"MDI: LAMMPS currently only supports the >CELL command for orthogonal cell vectors");
}
// set the new LAMMPS cell dimensions

View File

@ -340,6 +340,6 @@ char *MDIEngine::mdi_optg()
if (strcmp(command, "@DEFAULT") == 0 || strcmp(command, "EXIT") == 0) return command;
error->all(FLERR,"MDI reached end of OPTG simulation with invalid command: {}", command);
error->all(FLERR, "MDI reached end of OPTG simulation with invalid command: {}", command);
return nullptr;
}

View File

@ -1,4 +1,3 @@
// clang-format off
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@ -28,6 +27,7 @@ PairStyle(mgpt,PairMGPT);
// clang-format on
#else
// clang-format off
#ifndef LMP_PAIR_MGPT_H
#define LMP_PAIR_MGPT_H

View File

@ -435,7 +435,7 @@ void PairTracker::read_restart_settings(FILE *fp)
/* ---------------------------------------------------------------------- */
double PairTracker::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*/)
{
return 0.0;
}

View File

@ -25,9 +25,9 @@
#include "comm.h"
#include "error.h"
#include "memory.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "update.h"
#include "InterfaceLammps.h" // n2p2 interface header
@ -38,7 +38,8 @@ static const char cite_user_hdnnp_package[] =
"ML-HDNNP package: 10.1021/acs.jctc.8b00770\n\n"
"@Article{Singraber19,\n"
" author = {Singraber, Andreas and Behler, J{\"o}rg and Dellago, Christoph},\n"
" title = {Library-{{Based LAMMPS Implementation}} of {{High}}-{{Dimensional Neural Network Potentials}}},\n"
" title = {Library-{{Based LAMMPS Implementation}} of {{High}}-{{Dimensional Neural Network "
"Potentials}}},\n"
" year = {2019},\n"
" month = mar,\n"
" volume = {15},\n"
@ -58,7 +59,8 @@ PairHDNNP::PairHDNNP(LAMMPS *lmp) : Pair(lmp)
restartinfo = 0; // 1 if pair style writes restart info
one_coeff = 1; // 1 if allows only one coeff * * call
manybody_flag = 1; // 1 if a manybody potential
unit_convert_flag = 0; // TODO: Check possible values. value != 0 indicates support for unit conversion.
unit_convert_flag =
0; // TODO: Check possible values. value != 0 indicates support for unit conversion.
reinitflag = 0; // 1 if compatible with fix adapt and alike
interface = new nnp::InterfaceLammps();
@ -77,10 +79,10 @@ PairHDNNP::~PairHDNNP()
void PairHDNNP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
ev_init(eflag, vflag);
// Set number of local atoms and add element.
interface->setLocalAtoms(atom->nlocal,atom->type);
interface->setLocalAtoms(atom->nlocal, atom->type);
// Transfer tags separately. Interface::setLocalTags is overloaded internally
// to work with both -DLAMMPS_SMALLBIG (tagint = int) and -DLAMMPS_BIGBIG
// (tagint = int64_t)
@ -93,21 +95,18 @@ void PairHDNNP::compute(int eflag, int vflag)
interface->process();
// Do all stuff related to extrapolation warnings.
if(showew == true || showewsum > 0 || maxew >= 0) {
handleExtrapolationWarnings();
}
if (showew == true || showewsum > 0 || maxew >= 0) { handleExtrapolationWarnings(); }
// Calculate forces of local and ghost atoms.
interface->getForces(atom->f);
// Add energy contribution to total energy.
if (eflag_global)
ev_tally(0,0,atom->nlocal,1,interface->getEnergy(),0.0,0.0,0.0,0.0,0.0);
ev_tally(0, 0, atom->nlocal, 1, interface->getEnergy(), 0.0, 0.0, 0.0, 0.0, 0.0);
// Add atomic energy if requested (CAUTION: no physical meaning!).
if (eflag_atom)
for (int i = 0; i < atom->nlocal; ++i)
eatom[i] = interface->getAtomicEnergy(i);
for (int i = 0; i < atom->nlocal; ++i) eatom[i] = interface->getAtomicEnergy(i);
// If virial needed calculate via F dot r.
if (vflag_fdotr) virial_fdotr_compute();
@ -121,9 +120,9 @@ void PairHDNNP::settings(int narg, char **arg)
{
int iarg = 0;
if (narg < 1) error->all(FLERR,"Illegal pair_style command");
if (narg < 1) error->all(FLERR, "Illegal pair_style command");
maxCutoffRadius = utils::numeric(FLERR,arg[0],false,lmp);
maxCutoffRadius = utils::numeric(FLERR, arg[0], false, lmp);
iarg++;
// default settings
@ -137,61 +136,55 @@ void PairHDNNP::settings(int narg, char **arg)
numExtrapolationWarningsTotal = 0;
numExtrapolationWarningsSummary = 0;
while(iarg < narg) {
while (iarg < narg) {
// set HDNNP directory
if (strcmp(arg[iarg],"dir") == 0) {
if (iarg+2 > narg)
error->all(FLERR,"Illegal pair_style command");
if (strcmp(arg[iarg], "dir") == 0) {
if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
delete[] directory;
directory = utils::strdup(arg[iarg+1]);
directory = utils::strdup(arg[iarg + 1]);
iarg += 2;
// show extrapolation warnings
} else if (strcmp(arg[iarg],"showew") == 0) {
if (iarg+2 > narg)
error->all(FLERR,"Illegal pair_style command");
if (strcmp(arg[iarg+1],"yes") == 0)
} else if (strcmp(arg[iarg], "showew") == 0) {
if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
if (strcmp(arg[iarg + 1], "yes") == 0)
showew = true;
else if (strcmp(arg[iarg+1],"no") == 0)
else if (strcmp(arg[iarg + 1], "no") == 0)
showew = false;
else
error->all(FLERR,"Illegal pair_style command");
error->all(FLERR, "Illegal pair_style command");
iarg += 2;
// show extrapolation warning summary
} else if (strcmp(arg[iarg],"showewsum") == 0) {
if (iarg+2 > narg)
error->all(FLERR,"Illegal pair_style command");
showewsum = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
} else if (strcmp(arg[iarg], "showewsum") == 0) {
if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
showewsum = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
iarg += 2;
// maximum allowed extrapolation warnings
} else if (strcmp(arg[iarg],"maxew") == 0) {
if (iarg+2 > narg)
error->all(FLERR,"Illegal pair_style command");
maxew = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
} else if (strcmp(arg[iarg], "maxew") == 0) {
if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
maxew = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
iarg += 2;
// reset extrapolation warning counter
} else if (strcmp(arg[iarg],"resetew") == 0) {
if (iarg+2 > narg)
error->all(FLERR,"Illegal pair_style command");
if (strcmp(arg[iarg+1],"yes") == 0)
} else if (strcmp(arg[iarg], "resetew") == 0) {
if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
if (strcmp(arg[iarg + 1], "yes") == 0)
resetew = true;
else if (strcmp(arg[iarg+1],"no") == 0)
else if (strcmp(arg[iarg + 1], "no") == 0)
resetew = false;
else
error->all(FLERR,"Illegal pair_style command");
error->all(FLERR, "Illegal pair_style command");
iarg += 2;
// length unit conversion factor
} else if (strcmp(arg[iarg],"cflength") == 0) {
if (iarg+2 > narg)
error->all(FLERR,"Illegal pair_style command");
cflength = utils::numeric(FLERR,arg[iarg+1],false,lmp);
} else if (strcmp(arg[iarg], "cflength") == 0) {
if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
cflength = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
iarg += 2;
// energy unit conversion factor
} else if (strcmp(arg[iarg],"cfenergy") == 0) {
if (iarg+2 > narg)
error->all(FLERR,"Illegal pair_style command");
cfenergy = utils::numeric(FLERR,arg[iarg+1],false,lmp);
} else if (strcmp(arg[iarg], "cfenergy") == 0) {
if (iarg + 2 > narg) error->all(FLERR, "Illegal pair_style command");
cfenergy = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
iarg += 2;
} else error->all(FLERR,"Illegal pair_style command");
} else
error->all(FLERR, "Illegal pair_style command");
}
}
@ -205,21 +198,20 @@ void PairHDNNP::coeff(int narg, char **arg)
if (!allocated) allocate();
if (narg != 2 + n)
error->all(FLERR,"Incorrect args for pair coefficients");
if (narg != 2 + n) error->all(FLERR, "Incorrect args for pair coefficients");
if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0)
error->all(FLERR,"Incorrect args for pair coefficients");
if (strcmp(arg[0], "*") != 0 || strcmp(arg[1], "*") != 0)
error->all(FLERR, "Incorrect args for pair coefficients");
int *map = new int[n+1];
int *map = new int[n + 1];
for (int i = 0; i < n; i++) map[i] = 0;
emap = "";
for (int i = 2; i < narg; i++) {
if (strcmp(arg[i],"NULL") != 0) {
if (strcmp(arg[i], "NULL") != 0) {
if (i != 2) emap += ",";
emap += std::to_string(i-1) + ":" + arg[i];
map[i-1] = 1;
emap += std::to_string(i - 1) + ":" + arg[i];
map[i - 1] = 1;
}
}
@ -231,7 +223,7 @@ void PairHDNNP::coeff(int narg, char **arg)
count++;
}
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients");
delete[] map;
}
@ -251,29 +243,18 @@ void PairHDNNP::init_style()
// Activate screen and logfile output only for rank 0.
if (comm->me == 0) {
if (lmp->screen != nullptr)
interface->log.registerCFilePointer(&(lmp->screen));
if (lmp->logfile != nullptr)
interface->log.registerCFilePointer(&(lmp->logfile));
if (lmp->screen != nullptr) interface->log.registerCFilePointer(&(lmp->screen));
if (lmp->logfile != nullptr) interface->log.registerCFilePointer(&(lmp->logfile));
}
// Initialize interface on all processors.
interface->initialize(directory,
emap.c_str(),
showew,
resetew,
showewsum,
maxew,
cflength,
cfenergy,
maxCutoffRadius,
atom->ntypes,
comm->me);
interface->initialize(directory, emap.c_str(), showew, resetew, showewsum, maxew, cflength,
cfenergy, maxCutoffRadius, atom->ntypes, comm->me);
// LAMMPS cutoff radius (given via pair_coeff) should not be smaller than
// maximum symmetry function cutoff radius.
if (maxCutoffRadius < interface->getMaxCutoffRadius())
error->all(FLERR,"Inconsistent cutoff radius");
error->all(FLERR, "Inconsistent cutoff radius");
}
/* ----------------------------------------------------------------------
@ -294,12 +275,11 @@ void PairHDNNP::allocate()
allocated = 1;
int n = atom->ntypes;
memory->create(setflag,n+1,n+1,"pair:setflag");
memory->create(setflag, n + 1, n + 1, "pair:setflag");
for (int i = 1; i <= n; i++)
for (int j = i; j <= n; j++)
setflag[i][j] = 0;
for (int j = i; j <= n; j++) setflag[i][j] = 0;
memory->create(cutsq,n+1,n+1,"pair:cutsq"); // TODO: Is this required?
memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); // TODO: Is this required?
}
void PairHDNNP::transferNeighborList()
@ -315,9 +295,7 @@ void PairHDNNP::transferNeighborList()
double dy = atom->x[i][1] - atom->x[j][1];
double dz = atom->x[i][2] - atom->x[j][2];
double d2 = dx * dx + dy * dy + dz * dz;
if (d2 <= rc2) {
interface->addNeighbor(i,j,atom->tag[j],atom->type[j],dx,dy,dz,d2);
}
if (d2 <= rc2) { interface->addNeighbor(i, j, atom->tag[j], atom->type[j], dx, dy, dz, d2); }
}
}
}
@ -325,29 +303,29 @@ void PairHDNNP::transferNeighborList()
void PairHDNNP::handleExtrapolationWarnings()
{
// Get number of extrapolation warnings for local atoms.
long numCurrentEW = (long)interface->getNumExtrapolationWarnings();
long numCurrentEW = (long) interface->getNumExtrapolationWarnings();
// Update (or set, resetew == true) total warnings counter.
if (resetew) numExtrapolationWarningsTotal = numCurrentEW;
else numExtrapolationWarningsTotal += numCurrentEW;
if (resetew)
numExtrapolationWarningsTotal = numCurrentEW;
else
numExtrapolationWarningsTotal += numCurrentEW;
// Update warnings summary counter.
if(showewsum > 0) {
numExtrapolationWarningsSummary += numCurrentEW;
}
if (showewsum > 0) { numExtrapolationWarningsSummary += numCurrentEW; }
// If requested write extrapolation warnings.
// Requires communication of all symmetry functions statistics entries to
// rank 0.
if(showew > 0) {
if (showew > 0) {
// First collect an overview of extrapolation warnings per process.
long *numEWPerProc = nullptr;
if(comm->me == 0) numEWPerProc = new long[comm->nprocs];
if (comm->me == 0) numEWPerProc = new long[comm->nprocs];
MPI_Gather(&numCurrentEW, 1, MPI_LONG, numEWPerProc, 1, MPI_LONG, 0, world);
if(comm->me == 0) {
for(int i=1;i<comm->nprocs;i++) {
if(numEWPerProc[i] > 0) {
if (comm->me == 0) {
for (int i = 1; i < comm->nprocs; i++) {
if (numEWPerProc[i] > 0) {
long bs = 0;
MPI_Status ms;
// Get buffer size.
@ -360,8 +338,7 @@ void PairHDNNP::handleExtrapolationWarnings()
}
}
interface->writeExtrapolationWarnings();
}
else if(numCurrentEW > 0) {
} else if (numCurrentEW > 0) {
// Get desired buffer length for all extrapolation warning entries.
long bs = interface->getEWBufferSize();
// Allocate and fill buffer.
@ -373,18 +350,17 @@ void PairHDNNP::handleExtrapolationWarnings()
delete[] buf;
}
if(comm->me == 0) delete[] numEWPerProc;
if (comm->me == 0) delete[] numEWPerProc;
}
// If requested gather number of warnings to display summary.
if(showewsum > 0 && update->ntimestep % showewsum == 0) {
if (showewsum > 0 && update->ntimestep % showewsum == 0) {
long globalEW = 0;
// Communicate the sum over all processors to proc 0.
MPI_Reduce(&numExtrapolationWarningsSummary,
&globalEW, 1, MPI_LONG, MPI_SUM, 0, world);
MPI_Reduce(&numExtrapolationWarningsSummary, &globalEW, 1, MPI_LONG, MPI_SUM, 0, world);
// Write to screen or logfile.
if(comm->me == 0)
utils::logmesg(lmp,"### NNP EW SUMMARY ### TS: {:10d} EW {:10d} EWPERSTEP {:10.3e}\n",
if (comm->me == 0)
utils::logmesg(lmp, "### NNP EW SUMMARY ### TS: {:10d} EW {:10d} EWPERSTEP {:10.3e}\n",
update->ntimestep, globalEW, double(globalEW) / showewsum);
// Reset summary counter.
numExtrapolationWarningsSummary = 0;
@ -392,7 +368,7 @@ void PairHDNNP::handleExtrapolationWarnings()
// Stop if maximum number of extrapolation warnings is exceeded.
if (numExtrapolationWarningsTotal > maxew) {
error->one(FLERR,"Too many extrapolation warnings");
error->one(FLERR, "Too many extrapolation warnings");
}
// Reset internal extrapolation warnings counters.

View File

@ -30,7 +30,7 @@ PairStyle(hdnnp,PairHDNNP);
#include "pair.h"
namespace nnp {
class InterfaceLammps;
class InterfaceLammps;
}
namespace LAMMPS_NS {
@ -38,7 +38,6 @@ namespace LAMMPS_NS {
class PairHDNNP : public Pair {
public:
PairHDNNP(class LAMMPS *);
virtual ~PairHDNNP();
virtual void compute(int, int);
@ -48,7 +47,6 @@ class PairHDNNP : public Pair {
virtual double init_one(int, int);
protected:
virtual void allocate();
void transferNeighborList();
void handleExtrapolationWarnings();
@ -67,7 +65,7 @@ class PairHDNNP : public Pair {
nnp::InterfaceLammps *interface;
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -47,9 +47,9 @@ MLIAPDescriptor::~MLIAPDescriptor()
double MLIAPDescriptor::memory_usage()
{
double bytes = (double)nelements*sizeof(double); // radelem
bytes += (double)nelements*sizeof(double); // welem
bytes += (double)nelements*nelements*sizeof(double); // cutsq
double bytes = (double) nelements * sizeof(double); // radelem
bytes += (double) nelements * sizeof(double); // welem
bytes += (double) nelements * nelements * sizeof(double); // cutsq
return bytes;
}

View File

@ -39,18 +39,18 @@ PairStyle(rann,PairRANN);
#include "pair.h"
#include <vector>
#include <string>
#include <vector>
namespace LAMMPS_NS {
namespace RANN {
namespace RANN {
//forward declarations
class Activation;
class Fingerprint;
}
} // namespace RANN
class PairRANN : public Pair {
class PairRANN : public Pair {
public:
//inherited functions
PairRANN(class LAMMPS *);
@ -60,8 +60,8 @@ namespace LAMMPS_NS {
void coeff(int, char **);
void init_style();
double init_one(int, int);
void init_list(int , NeighList *);
void errorf(const char*,int,const char*);
void init_list(int, NeighList *);
void errorf(const char *, int, const char *);
int factorial(int);
RANN::Fingerprint *create_fingerprint(const char *);
@ -78,10 +78,11 @@ namespace LAMMPS_NS {
int *fingerprintcount; // static variable used in initialization
int *fingerprintlength; // # of input neurons defined by fingerprints of each element.
int *fingerprintperelement; // # of fingerprints for each element
bool doscreen;//screening is calculated if any defined fingerprint uses it
bool allscreen;//all fingerprints use screening so screened neighbors can be completely ignored
bool doscreen; //screening is calculated if any defined fingerprint uses it
bool
allscreen; //all fingerprints use screening so screened neighbors can be completely ignored
bool dospin;
int res;//Resolution of function tables for cubic interpolation.
int res; //Resolution of function tables for cubic interpolation.
int memguess;
double *screening_min;
double *screening_max;
@ -92,13 +93,15 @@ namespace LAMMPS_NS {
int fmax;
int fnmax;
//memory actively written to during each compute:
double *xn,*yn,*zn,*Sik,*dSikx,*dSiky,*dSikz,*dSijkx,*dSijky,*dSijkz,*sx,*sy,*sz,**dSijkxc,**dSijkyc,**dSijkzc,*dfeaturesx,*dfeaturesy,*dfeaturesz,*features;
double *layer,*sum,*sum1,**dlayerx,**dlayery,**dlayerz,**dlayersumx,**dlayersumy,**dlayersumz;
double **dsx,**dsy,**dsz,**dssumx,**dssumy,**dssumz;
int *tn,*jl;
double *xn, *yn, *zn, *Sik, *dSikx, *dSiky, *dSikz, *dSijkx, *dSijky, *dSijkz, *sx, *sy, *sz,
**dSijkxc, **dSijkyc, **dSijkzc, *dfeaturesx, *dfeaturesy, *dfeaturesz, *features;
double *layer, *sum, *sum1, **dlayerx, **dlayery, **dlayerz, **dlayersumx, **dlayersumy,
**dlayersumz;
double **dsx, **dsy, **dsz, **dssumx, **dssumy, **dssumz;
int *tn, *jl;
bool *Bij;
struct Simulation{
struct Simulation {
int *id;
bool forces;
bool spins;
@ -114,20 +117,20 @@ namespace LAMMPS_NS {
double **dsx;
double **dsy;
double **dsz;
int *ilist,*numneigh,**firstneigh,*type,inum,gnum;
int *ilist, *numneigh, **firstneigh, *type, inum, gnum;
};
struct NNarchitecture{
struct NNarchitecture {
int layers;
int *dimensions;//vector of length layers with entries for neurons per layer
int *dimensions; //vector of length layers with entries for neurons per layer
double **Weights;
double **Biases;
int *activations;//unused
int maxlayer;//longest layer (for memory allocation)
int *activations; //unused
int maxlayer; //longest layer (for memory allocation)
};
Simulation *sims;
NNarchitecture *net;//array of networks, 1 for each element.
NNarchitecture *net; //array of networks, 1 for each element.
protected:
RANN::Activation ***activation;
@ -135,32 +138,39 @@ namespace LAMMPS_NS {
private:
//new functions
void allocate(const std::vector<std::string> &);//called after reading element list, but before reading the rest of the potential
void allocate(
const std::vector<std::string>
&); //called after reading element list, but before reading the rest of the potential
void deallocate();
void read_file(char *);//read potential file
void read_atom_types(std::vector<std::string>,char*,int);
void read_fpe(std::vector<std::string>,std::vector<std::string>,char*,int);//fingerprints per element. Count total fingerprints defined for each 1st element in element combinations
void read_fingerprints(std::vector<std::string>,std::vector<std::string>,char*,int);
void read_fingerprint_constants(std::vector<std::string>,std::vector<std::string>,char*,int);
void read_network_layers(std::vector<std::string>,std::vector<std::string>,char*,int);//include input and output layer (hidden layers + 2)
void read_layer_size(std::vector<std::string>,std::vector<std::string>,char*,int);
void read_weight(std::vector<std::string>,std::vector<std::string>,FILE*,char*,int*);//weights should be formatted as properly shaped matrices
void read_bias(std::vector<std::string>,std::vector<std::string>,FILE*,char*,int*);//biases should be formatted as properly shaped vectors
void read_activation_functions(std::vector<std::string>,std::vector<std::string>,char*,int);
void read_screening(std::vector<std::string>,std::vector<std::string>,char*,int);
void read_mass(const std::vector<std::string> &, const std::vector<std::string> &,const char*,int);
bool check_potential();//after finishing reading potential file
void propagateforward(double *,double **,int,int);//called by compute to get force and energy
void propagateforwardspin(double *,double **,double**,int,int);//called by compute to get force and energy
void screening(int,int,int);
void cull_neighbor_list(int *,int,int);
void read_file(char *); //read potential file
void read_atom_types(std::vector<std::string>, char *, int);
void read_fpe(
std::vector<std::string>, std::vector<std::string>, char *,
int); //fingerprints per element. Count total fingerprints defined for each 1st element in element combinations
void read_fingerprints(std::vector<std::string>, std::vector<std::string>, char *, int);
void read_fingerprint_constants(std::vector<std::string>, std::vector<std::string>, char *, int);
void read_network_layers(std::vector<std::string>, std::vector<std::string>, char *,
int); //include input and output layer (hidden layers + 2)
void read_layer_size(std::vector<std::string>, std::vector<std::string>, char *, int);
void read_weight(std::vector<std::string>, std::vector<std::string>, FILE *, char *,
int *); //weights should be formatted as properly shaped matrices
void read_bias(std::vector<std::string>, std::vector<std::string>, FILE *, char *,
int *); //biases should be formatted as properly shaped vectors
void read_activation_functions(std::vector<std::string>, std::vector<std::string>, char *, int);
void read_screening(std::vector<std::string>, std::vector<std::string>, char *, int);
void read_mass(const std::vector<std::string> &, const std::vector<std::string> &, const char *,
int);
bool check_potential(); //after finishing reading potential file
void propagateforward(double *, double **, int,
int); //called by compute to get force and energy
void propagateforwardspin(double *, double **, double **, int,
int); //called by compute to get force and energy
void screening(int, int, int);
void cull_neighbor_list(int *, int, int);
void screen_neighbor_list(int *);
};
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -31,9 +31,8 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
#ifndef LMP_RANN_ACTIVATION_H
#define LMP_RANN_ACTIVATION_H
namespace LAMMPS_NS {
namespace RANN {
namespace RANN {
class Activation {
public:
Activation(class PairRANN *);
@ -45,28 +44,21 @@ namespace LAMMPS_NS {
const char *style;
};
Activation::Activation(PairRANN *) {
Activation::Activation(PairRANN *)
{
empty = true;
style = "empty";
}
Activation::~Activation() {
}
Activation::~Activation() {}
//default is linear activation (no change).
double Activation::activation_function(double A) {
return A;
}
double Activation::activation_function(double A) { return A; }
double Activation::dactivation_function(double) {
return 1.0;
}
double Activation::ddactivation_function(double) {
return 0.0;
}
}
}
double Activation::dactivation_function(double) { return 1.0; }
double Activation::ddactivation_function(double) { return 0.0; }
} // namespace RANN
} // namespace LAMMPS_NS
#endif /* RANN_ACTIVATION_H_ */

View File

@ -33,7 +33,7 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
#include "rann_activation.h"
namespace LAMMPS_NS {
namespace RANN {
namespace RANN {
class Activation_linear : public Activation {
public:
@ -43,25 +43,18 @@ namespace LAMMPS_NS {
double ddactivation_function(double);
};
Activation_linear::Activation_linear(PairRANN *_pair) : Activation(_pair) {
Activation_linear::Activation_linear(PairRANN *_pair) : Activation(_pair)
{
empty = false;
style = "linear";
}
double Activation_linear::activation_function(double A)
{
return A;
}
double Activation_linear::activation_function(double A) { return A; }
double Activation_linear::dactivation_function(double)
{
return 1.0;
}
double Activation_linear::dactivation_function(double) { return 1.0; }
double Activation_linear::ddactivation_function(double) {
return 0.0;
}
}
}
double Activation_linear::ddactivation_function(double) { return 0.0; }
} // namespace RANN
} // namespace LAMMPS_NS
#endif /* ACTIVATION_LINEAR_H_ */

View File

@ -34,7 +34,7 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
#include "rann_activation.h"
namespace LAMMPS_NS {
namespace RANN {
namespace RANN {
class Activation_sigI : public Activation {
public:
@ -44,27 +44,32 @@ namespace LAMMPS_NS {
double ddactivation_function(double);
};
Activation_sigI::Activation_sigI(PairRANN *_pair) : Activation(_pair) {
Activation_sigI::Activation_sigI(PairRANN *_pair) : Activation(_pair)
{
empty = false;
style = "sigI";
}
double Activation_sigI::activation_function(double in) {
if (in>34)return in;
return 0.1*in + 0.9*log(exp(in) + 1);
double Activation_sigI::activation_function(double in)
{
if (in > 34) return in;
return 0.1 * in + 0.9 * log(exp(in) + 1);
}
double Activation_sigI::dactivation_function(double in) {
if (in>34)return 1;
return 0.1 + 0.9/(exp(in)+1)*exp(in);
double Activation_sigI::dactivation_function(double in)
{
if (in > 34) return 1;
return 0.1 + 0.9 / (exp(in) + 1) * exp(in);
}
double Activation_sigI::ddactivation_function(double in) {
if (in>34)return 0;
return 0.9*exp(in)/(exp(in)+1)/(exp(in)+1);;
double Activation_sigI::ddactivation_function(double in)
{
if (in > 34) return 0;
return 0.9 * exp(in) / (exp(in) + 1) / (exp(in) + 1);
;
}
}
}
} // namespace RANN
} // namespace LAMMPS_NS
#endif /* ACTIVATION_SIGI_H_ */

View File

@ -74,7 +74,7 @@ namespace RANN {
{
}
virtual int get_length(){return 0;};
virtual int get_length() { return 0; };
virtual double cutofffunction(double, double, double);
virtual void generate_rinvssqrttable();
bool spin;

View File

@ -34,19 +34,22 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
#include "rann_fingerprint.h"
namespace LAMMPS_NS {
namespace RANN {
namespace RANN {
class Fingerprint_bond : public Fingerprint {
public:
Fingerprint_bond(PairRANN *);
~Fingerprint_bond();
bool parse_values(std::string,std::vector<std::string>);
bool parse_values(std::string, std::vector<std::string>);
void write_values(FILE *);
void init(int*,int);
void init(int *, int);
void allocate();
void compute_fingerprint(double*,double*,double*,double*,int,int,double *,double *,double *,int *,int,int *);
void do3bodyfeatureset_doubleneighborloop(double *,double *,double *,double *,int,int,double *,double *,double *,int *,int,int *);
void do3bodyfeatureset_singleneighborloop(double *,double *,double *,double *,int,int,double *,double *,double *,int *,int,int *);
void compute_fingerprint(double *, double *, double *, double *, int, int, double *, double *,
double *, int *, int, int *);
void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, int, int,
double *, double *, double *, int *, int, int *);
void do3bodyfeatureset_singleneighborloop(double *, double *, double *, double *, int, int,
double *, double *, double *, int *, int, int *);
void generate_exp_cut_table();
void generate_coefficients();
int get_length();
@ -63,10 +66,9 @@ namespace LAMMPS_NS {
int kmax;
int mlength;
int **Mf;
};
}
}
} // namespace RANN
} // namespace LAMMPS_NS
#endif /* FINGERPRINT_BOND_H_ */

View File

@ -34,19 +34,27 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
#include "rann_fingerprint.h"
namespace LAMMPS_NS {
namespace RANN {
namespace RANN {
class Fingerprint_bondscreened : public Fingerprint {
public:
Fingerprint_bondscreened(PairRANN *);
~Fingerprint_bondscreened();
bool parse_values(std::string,std::vector<std::string>);
bool parse_values(std::string, std::vector<std::string>);
void write_values(FILE *);
void init(int*,int);
void init(int *, int);
void allocate();
void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*);
void do3bodyfeatureset_doubleneighborloop(double *,double *,double *,double *,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*);
void do3bodyfeatureset_singleneighborloop(double *,double *,double *,double *,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*);
void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, bool *, int, int, double *,
double *, double *, int *, int, int *);
void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *,
double *, bool *, int, int, double *, double *,
double *, int *, int, int *);
void do3bodyfeatureset_singleneighborloop(double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *,
double *, bool *, int, int, double *, double *,
double *, int *, int, int *);
void generate_exp_cut_table();
void generate_coefficients();
int get_length();
@ -63,10 +71,9 @@ namespace LAMMPS_NS {
int kmax;
int mlength;
int **Mf;
};
}
} // namespace RANN
}
} // namespace LAMMPS_NS
#endif /* FINGERPRINT_BOND_H_ */

View File

@ -34,19 +34,27 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
#include "rann_fingerprint.h"
namespace LAMMPS_NS {
namespace RANN {
namespace RANN {
class Fingerprint_bondscreenedspin : public Fingerprint {
public:
Fingerprint_bondscreenedspin(PairRANN *);
~Fingerprint_bondscreenedspin();
bool parse_values(std::string,std::vector<std::string>);
bool parse_values(std::string, std::vector<std::string>);
void write_values(FILE *);
void init(int*,int);
void init(int *, int);
void allocate();
void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*);
void do3bodyfeatureset_doubleneighborloop(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int *);
void do3bodyfeatureset_singleneighborloop(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*);
void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
bool *, int, int, double *, double *, double *, int *, int, int *);
void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *,
double *, double *, double *, double *, bool *, int,
int, double *, double *, double *, int *, int, int *);
void do3bodyfeatureset_singleneighborloop(double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *,
double *, double *, double *, double *, bool *, int,
int, double *, double *, double *, int *, int, int *);
void generate_exp_cut_table();
void generate_coefficients();
int get_length();
@ -63,10 +71,9 @@ namespace LAMMPS_NS {
int kmax;
int mlength;
int **Mf;
};
}
}
} // namespace RANN
} // namespace LAMMPS_NS
#endif /* FINGERPRINT_BOND_H_ */

View File

@ -34,18 +34,24 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
#include "rann_fingerprint.h"
namespace LAMMPS_NS {
namespace RANN {
namespace RANN {
class Fingerprint_bondspin : public Fingerprint {
public:
Fingerprint_bondspin(PairRANN *);
~Fingerprint_bondspin();
bool parse_values(std::string,std::vector<std::string>);
bool parse_values(std::string, std::vector<std::string>);
void write_values(FILE *);
void init(int*,int);
void init(int *, int);
void allocate();
virtual void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*);//spin
void do3bodyfeatureset_doubleneighborloop(double*,double*,double*,double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*);
void do3bodyfeatureset_singleneighborloop(double*,double*,double*,double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*);
virtual void compute_fingerprint(double *, double *, double *, double *, double *, double *,
double *, int, int, double *, double *, double *, int *, int,
int *); //spin
void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, double *,
double *, double *, int, int, double *, double *,
double *, int *, int, int *);
void do3bodyfeatureset_singleneighborloop(double *, double *, double *, double *, double *,
double *, double *, int, int, double *, double *,
double *, int *, int, int *);
void generate_exp_cut_table();
void generate_coefficients();
int get_length();
@ -62,10 +68,9 @@ namespace LAMMPS_NS {
int kmax;
int mlength;
int **Mf;
};
}
}
} // namespace RANN
} // namespace LAMMPS_NS
#endif /* FINGERPRINT_BOND_H_ */

View File

@ -34,17 +34,18 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
#include "rann_fingerprint.h"
namespace LAMMPS_NS {
namespace RANN {
namespace RANN {
class Fingerprint_radial : public Fingerprint {
public:
Fingerprint_radial(PairRANN *);
~Fingerprint_radial();
bool parse_values(std::string,std::vector<std::string>);
bool parse_values(std::string, std::vector<std::string>);
void write_values(FILE *);
void init(int*,int);
void init(int *, int);
void allocate();
void compute_fingerprint(double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*);
void compute_fingerprint(double *, double *, double *, double *, int, int, double *, double *,
double *, int *, int, int *);
int get_length();
double *radialtable;
@ -52,12 +53,11 @@ namespace LAMMPS_NS {
double dr;
double *alpha;
double re;
int nmax;//highest term
int omin;//lowest term
int nmax; //highest term
int omin; //lowest term
};
}
}
} // namespace RANN
} // namespace LAMMPS_NS
#endif /* FINGERPRINT_RADIAL_H_ */

View File

@ -34,16 +34,18 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
#include "rann_fingerprint.h"
namespace LAMMPS_NS {
namespace RANN {
namespace RANN {
class Fingerprint_radialscreened : public Fingerprint {
public:
Fingerprint_radialscreened(PairRANN *);
~Fingerprint_radialscreened();
bool parse_values(std::string,std::vector<std::string>);
bool parse_values(std::string, std::vector<std::string>);
void write_values(FILE *);
void init(int*,int);
void init(int *, int);
void allocate();
void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*);
void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, bool *, int, int, double *,
double *, double *, int *, int, int *);
int get_length();
double *radialtable;
@ -51,12 +53,11 @@ namespace LAMMPS_NS {
double dr;
double *alpha;
double re;
int nmax;//highest term
int omin;//lowest term
int nmax; //highest term
int omin; //lowest term
};
}
} // namespace RANN
}
} // namespace LAMMPS_NS
#endif /* FINGERPRINT_RADIALSCREENED_H_ */

View File

@ -34,16 +34,19 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
#include "rann_fingerprint.h"
namespace LAMMPS_NS {
namespace RANN {
namespace RANN {
class Fingerprint_radialscreenedspin : public Fingerprint {
public:
Fingerprint_radialscreenedspin(PairRANN *);
~Fingerprint_radialscreenedspin();
bool parse_values(std::string,std::vector<std::string>);
bool parse_values(std::string, std::vector<std::string>);
void write_values(FILE *);
void init(int*,int);
void init(int *, int);
void allocate();
virtual void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*);//spin,screen
virtual void compute_fingerprint(double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, bool *, int, int, double *, double *,
double *, int *, int, int *); //spin,screen
int get_length();
double *radialtable;
@ -51,12 +54,11 @@ namespace LAMMPS_NS {
double dr;
double *alpha;
double re;
int nmax;//highest term
int omin;//lowest term
int nmax; //highest term
int omin; //lowest term
};
}
} // namespace RANN
}
} // namespace LAMMPS_NS
#endif /* FINGERPRINT_RADIALSCREENED_H_ */

View File

@ -34,16 +34,17 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
#include "rann_fingerprint.h"
namespace LAMMPS_NS {
namespace RANN {
namespace RANN {
class Fingerprint_radialspin : public Fingerprint {
public:
Fingerprint_radialspin(PairRANN *);
~Fingerprint_radialspin();
bool parse_values(std::string,std::vector<std::string>);
bool parse_values(std::string, std::vector<std::string>);
void write_values(FILE *);
void init(int*,int);
void init(int *, int);
void allocate();
void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*);
void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *,
int, int, double *, double *, double *, int *, int, int *);
int get_length();
double *radialtable;
@ -51,12 +52,11 @@ namespace LAMMPS_NS {
double dr;
double *alpha;
double re;
int nmax;//highest term
int omin;//lowest term
int nmax; //highest term
int omin; //lowest term
};
}
} // namespace RANN
}
} // namespace LAMMPS_NS
#endif /* FINGERPRINT_RADIAL_H_ */

View File

@ -114,7 +114,7 @@ void DumpAtomMPIIO::openfile()
mpifo = 0;
MPI_File_set_size(mpifh, (MPI_Offset)(headerSize + sumFileSize));
MPI_File_set_size(mpifh, (MPI_Offset) (headerSize + sumFileSize));
currentFileSize = (headerSize + sumFileSize);
}
}

View File

@ -129,7 +129,7 @@ void DumpCustomMPIIO::openfile()
mpifo = 0;
MPI_File_set_size(mpifh, (MPI_Offset)(headerSize + sumFileSize));
MPI_File_set_size(mpifh, (MPI_Offset) (headerSize + sumFileSize));
currentFileSize = (headerSize + sumFileSize);
}
}

View File

@ -221,7 +221,8 @@ void PairLJCutCoulCutDielectricOMP::eval(int iifrom, int iito, ThrData *const th
}
if (EVFLAG)
ev_tally_thr(this, i, j, nlocal, NEWTON_PAIR, evdwl, ecoul, fpair_i, delx, dely, delz, thr);
ev_tally_thr(this, i, j, nlocal, NEWTON_PAIR, evdwl, ecoul, fpair_i, delx, dely, delz,
thr);
}
}
f[i].x += fxtmp;

View File

@ -33,10 +33,10 @@ class PairLJCutCoulCutDielectricOMP : public PairLJCutCoulCutDielectric, public
protected:
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
void eval(int ifrom, int ito, ThrData * const thr);
void eval(int ifrom, int ito, ThrData *const thr);
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -34,10 +34,10 @@ class PairLJCutCoulLongDielectricOMP : public PairLJCutCoulLongDielectric, publi
protected:
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
void eval(int ifrom, int ito, ThrData * const thr);
void eval(int ifrom, int ito, ThrData *const thr);
};
}
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -48,31 +48,29 @@ class PairReaxFFOMP : public PairReaxFF, public ThrOMP {
reduce_thr(styleparm, eflagparm, vflagparm, thrparm);
}
inline void ev_tally_thr_proxy(const int iparm, const int jparm,
const int nlocalparm, const int newton_pairparm,
const double evdwlparm, const double ecoulparm,
const double fpairparm, const double delxparm,
const double delyparm, const double delzparm,
ThrData *const thrparm)
{
ev_tally_thr(this, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm,
fpairparm, delxparm, delyparm, delzparm, thrparm);
}
inline void ev_tally_xyz_thr_proxy(const int iparm, const int jparm,
const int nlocalparm, const int newton_pairparm,
const double evdwlparm, const double ecoulparm,
const double fxparm, const double fyparm, const double fzparm,
inline void ev_tally_thr_proxy(const int iparm, const int jparm, const int nlocalparm,
const int newton_pairparm, const double evdwlparm,
const double ecoulparm, const double fpairparm,
const double delxparm, const double delyparm,
const double delzparm, ThrData *const thrparm)
{
ev_tally_xyz_thr(this, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm,
fxparm, fyparm, fzparm, delxparm, delyparm, delzparm, thrparm);
ev_tally_thr(this, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm, fpairparm,
delxparm, delyparm, delzparm, thrparm);
}
inline void ev_tally3_thr_proxy(int i, int j, int k, double evdwl,
double ecoul, double *fj, double *fk, double *drji, double *drki,
ThrData *const thrparm)
inline void ev_tally_xyz_thr_proxy(const int iparm, const int jparm, const int nlocalparm,
const int newton_pairparm, const double evdwlparm,
const double ecoulparm, const double fxparm,
const double fyparm, const double fzparm,
const double delxparm, const double delyparm,
const double delzparm, ThrData *const thrparm)
{
ev_tally_xyz_thr(this, iparm, jparm, nlocalparm, newton_pairparm, evdwlparm, ecoulparm, fxparm,
fyparm, fzparm, delxparm, delyparm, delzparm, thrparm);
}
inline void ev_tally3_thr_proxy(int i, int j, int k, double evdwl, double ecoul, double *fj,
double *fk, double *drji, double *drki, ThrData *const thrparm)
{
ev_tally3_thr(this, i, j, k, evdwl, ecoul, fj, fk, drji, drki, thrparm);
}

View File

@ -27,77 +27,73 @@
#include <omp.h>
#endif
namespace ReaxFF
{
// exported Functions
namespace ReaxFF {
// exported Functions
// bond orders OpenMP
// bond orders OpenMP
extern void Add_dBond_to_ForcesOMP(reax_system *, int, int, storage *, reax_list **);
extern void Add_dBond_to_Forces_NPTOMP(reax_system *, int, int, storage *, reax_list **);
extern int BOp_OMP(storage *, reax_list *, double, int, int, far_neighbor_data *,
single_body_parameters *, single_body_parameters *,
two_body_parameters *, int, double, double, double,
double, double, double, double);
extern void Add_dBond_to_ForcesOMP(reax_system *, int, int, storage *, reax_list **);
extern void Add_dBond_to_Forces_NPTOMP(reax_system *, int, int, storage *, reax_list **);
extern int BOp_OMP(storage *, reax_list *, double, int, int, far_neighbor_data *,
single_body_parameters *, single_body_parameters *, two_body_parameters *, int,
double, double, double, double, double, double, double);
extern void BOOMP(reax_system *, storage *, reax_list **);
extern void BOOMP(reax_system *, storage *, reax_list **);
// bonds OpenMP
// bonds OpenMP
extern void BondsOMP(reax_system *, simulation_data *,
storage *, reax_list **);
extern void BondsOMP(reax_system *, simulation_data *, storage *, reax_list **);
// forces OpenMP
// forces OpenMP
extern void Compute_ForcesOMP(reax_system *, control_params *,
simulation_data *, storage *, reax_list **);
// hydrogen bonds
extern void Hydrogen_BondsOMP(reax_system *, control_params *,
simulation_data *, storage *, reax_list **);
// init md OpenMP
extern void InitializeOMP(reax_system *, control_params *, simulation_data *,
storage *, reax_list **,MPI_Comm);
// multi body
extern void Atom_EnergyOMP(reax_system *, simulation_data *, storage *, reax_list **);
// nonbonded
extern void vdW_Coulomb_Energy_OMP(reax_system *, control_params *,
simulation_data *, storage *, reax_list **);
extern void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *, control_params *,
simulation_data *, storage *,
extern void Compute_ForcesOMP(reax_system *, control_params *, simulation_data *, storage *,
reax_list **);
extern void LR_vdW_CoulombOMP(reax_system *, storage *, control_params *,
int, int, double, LR_data *);
// torsion angles
// hydrogen bonds
extern void Torsion_AnglesOMP(reax_system *, control_params *,
simulation_data *, storage *, reax_list **);
extern void Hydrogen_BondsOMP(reax_system *, control_params *, simulation_data *, storage *,
reax_list **);
// valence angles
// init md OpenMP
extern void Calculate_ThetaOMP(rvec, double, rvec, double, double *, double *);
extern void Calculate_dCos_ThetaOMP(rvec, double, rvec, double,
rvec *, rvec *, rvec *);
extern void Valence_AnglesOMP(reax_system *, control_params *, simulation_data *,
extern void InitializeOMP(reax_system *, control_params *, simulation_data *, storage *,
reax_list **, MPI_Comm);
// multi body
extern void Atom_EnergyOMP(reax_system *, simulation_data *, storage *, reax_list **);
// nonbonded
extern void vdW_Coulomb_Energy_OMP(reax_system *, control_params *, simulation_data *, storage *,
reax_list **);
extern void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *, control_params *, simulation_data *,
storage *, reax_list **);
extern void LR_vdW_CoulombOMP(reax_system *, storage *, control_params *, int, int, double,
LR_data *);
// OpenMP helpers
// torsion angles
inline int get_tid() {
extern void Torsion_AnglesOMP(reax_system *, control_params *, simulation_data *, storage *,
reax_list **);
// valence angles
extern void Calculate_ThetaOMP(rvec, double, rvec, double, double *, double *);
extern void Calculate_dCos_ThetaOMP(rvec, double, rvec, double, rvec *, rvec *, rvec *);
extern void Valence_AnglesOMP(reax_system *, control_params *, simulation_data *, storage *,
reax_list **);
// OpenMP helpers
inline int get_tid()
{
#if defined(_OPENMP)
return omp_get_thread_num();
#else
return 0;
#endif
}
}
} // namespace ReaxFF
#endif

View File

@ -135,8 +135,10 @@ class ThrOMP {
void ev_tally_xyz_full_thr(Pair *const, const int, const double, const double, const double,
const double, const double, const double, const double, const double,
ThrData *const);
void v_tally2_thr(Pair *const, const int, const int, const double, const double *const, ThrData *const);
void v_tally2_newton_thr(Pair *const, const int, const double *const, const double *const, ThrData *const);
void v_tally2_thr(Pair *const, const int, const int, const double, const double *const,
ThrData *const);
void v_tally2_newton_thr(Pair *const, const int, const double *const, const double *const,
ThrData *const);
void ev_tally3_thr(Pair *const, const int, const int, const int, const double, const double,
const double *const, const double *const, const double *const,
const double *const, ThrData *const);

View File

@ -1340,13 +1340,17 @@ void FixSRD::collisions_single()
std::string mesg;
if (type != WALL)
mesg = fmt::format("SRD particle {} started inside big particle {} on step {} "
" bounce {}", tag[i], tag[j], update->ntimestep, ibounce + 1);
" bounce {}",
tag[i], tag[j], update->ntimestep, ibounce + 1);
else
mesg = fmt::format("SRD particle {} started inside wall {} on step {} "
"bounce {}", tag[i], j, update->ntimestep, ibounce + 1);
"bounce {}",
tag[i], j, update->ntimestep, ibounce + 1);
if (insideflag == INSIDE_ERROR) error->one(FLERR, mesg);
else error->warning(FLERR, mesg);
if (insideflag == INSIDE_ERROR)
error->one(FLERR, mesg);
else
error->warning(FLERR, mesg);
}
break;
}
@ -1490,10 +1494,12 @@ void FixSRD::collisions_multi()
std::string mesg;
if (type != WALL)
mesg = fmt::format("SRD particle {} started inside big particle {} on step {} "
"bounce {}", tag[i], tag[j], update->ntimestep, ibounce + 1);
"bounce {}",
tag[i], tag[j], update->ntimestep, ibounce + 1);
else
mesg = fmt::format("SRD particle {} started inside wall {} on step {} "
"bounce {}", tag[i], j, update->ntimestep, ibounce + 1);
"bounce {}",
tag[i], j, update->ntimestep, ibounce + 1);
if (insideflag == INSIDE_ERROR) error->one(FLERR, mesg);
error->warning(FLERR, mesg);

View File

@ -214,6 +214,6 @@ void ComputeForceTally::compute_peratom()
double ComputeForceTally::memory_usage()
{
double bytes = (nmax < 0) ? 0 : nmax * (double)size_peratom_cols * sizeof(double);
double bytes = (nmax < 0) ? 0 : nmax * (double) size_peratom_cols * sizeof(double);
return bytes;
}

View File

@ -281,6 +281,6 @@ void ComputeHeatFluxTally::compute_vector()
double ComputeHeatFluxTally::memory_usage()
{
double bytes = (nmax < 0) ? 0 : nmax * (double)comm_reverse * sizeof(double);
double bytes = (nmax < 0) ? 0 : nmax * (double) comm_reverse * sizeof(double);
return bytes;
}

View File

@ -233,6 +233,6 @@ void ComputeHeatFluxVirialTally::compute_peratom()
double ComputeHeatFluxVirialTally::memory_usage()
{
double bytes = (nmax < 0) ? 0 : nmax * (double)size_peratom_cols * sizeof(double);
double bytes = (nmax < 0) ? 0 : nmax * (double) size_peratom_cols * sizeof(double);
return bytes;
}

View File

@ -203,6 +203,6 @@ void ComputePETally::compute_peratom()
double ComputePETally::memory_usage()
{
double bytes = (nmax < 0) ? 0 : nmax * (double)size_peratom_cols * sizeof(double);
double bytes = (nmax < 0) ? 0 : nmax * (double) size_peratom_cols * sizeof(double);
return bytes;
}

View File

@ -253,6 +253,6 @@ void ComputeStressTally::compute_peratom()
double ComputeStressTally::memory_usage()
{
double bytes = (nmax < 0) ? 0 : nmax * (double)size_peratom_cols * sizeof(double);
double bytes = (nmax < 0) ? 0 : nmax * (double) size_peratom_cols * sizeof(double);
return bytes;
}